Frequently asked questions and common newcomer trouble should be put here so that we can point to this page intsead of answering the same question over and over again.

Contents

edit NixOS segfaults when running on VirtualPC:

You may have hit http://jagbarcelo.blogspot.com/2009/11/segmentation-fault-ubuntu-virtual-pc.html There may be a different cause (out of memory) You can check /var/log/messages to see if there is something about the OOM killer kicking in

edit Nix(OS) substitutes break on older Btrfs implementation since the merge of SQLite support (feb 2011 in trunk)

Subtituted files are padded by zero bytes, which makes them unusable. Upgrading Btrfs to 2.6.37+ kernel resolves the issue.

edit Using nix to install new software requires to download the source from upstream and sometimes that source has moved and therefore the download won't work but after some google search with: 'myfile-0.1.2.tar.gz "index of"' one usually can find the file an download it either:

  • download manually and copy into /tmp, then:

to move that file into the store one can use:

 nix-prefetch-url file:///tmp/myfile-0.1.2.tar.gz if the file is in the /tmp directory
  • download directly
 nix-prefetch-url "http://myfoohost.com/programs/foo/myfile-0.1.2.tar.gz"

edit How to restart an UPSTART service

either:

 restart sshd 

or

 initctl restart sshd

A list of services can be found in "/etc/init".

edit How to keep build-time dependencies around / be able to rebuild while being offline

configuration.nix:

 nix.extraOptions = 
   gc-keep-outputs = true
   gc-keep-derivations = true
 ;

Check 'man configuration.nix' for these options. Rebuild for these options to take effect:

 # nixos-rebuild switch

List all store paths that form the system closure and realise them:

 $ nix-store -qR $(nix-instantiate /etc/nixos/nixos -A system) | xargs nix-store -r
 warning: you did not specify `--add-root'; the result might be removed by the garbage collector
 ...
 <build output and list of successfully realised paths>

Repeat for your user and further profiles:

 $ nix-store -qR ~/.nix-profile |xargs nix-store -r

The warning can be ignored for profiles that are listed/linked in /nix/var/nix/profiles/ or one of its subdirectories.

Consult man pages of nix-store and nix-instantiate for further information.

edit how to add a custom udev rule in nixos

add something like this to your /etc/nixos/configuration.nix file:

 services.udev.extraRules = 
   ATTRS{idVendor}=="0665", ATTRS{idProduct}=="5161", MODE="666", SYMLINK+="hidraw_protecthome"
 ;
Retrieved from "http://nixos.org/wiki/FAQ"