prev. article next article

running the nix package manager on windows

19 Jan 2011

motivation

nix (see [2])  is a package manager like apt (used in debian/ubuntu) or portage (used in gentoo). windows does have a package manager which is typical among linux distributions. so here some recent findings and how to use nix (and nixpkgs) on windows.

reproduction of my nix system

setup of my system:

components i used (get installed using cygwin::setup.exe:

how to build

as there is no windows installer (for example using NSIS) you have to bootstrap nix from source.

  1. extract nix-0.16 to c:
  2. start the cygwin shell (desktop icon)
  3. in the shell, type: ‘cd /cygdrive/c/nix/nix-0.16
  4. type: ‘./bootstrap.sh’ (this is very important) that is why several of my attempts to get nix running failed ;P
  5. type: ‘./configure
  6. type: ‘make install
  7. afterwards you can use it with: ’**nix-env -qa ’*’**’ for example

how to use nix

this is quite easy but it does not work as mentioned in the documentation (which worked only for unix systems so far). the full cygwin installation installes many tools.

  1. check your environmen for nix, type ‘nix-env.exe’ and test if that program works (should be in the path)
  2. if ‘nix-env.exe’ does not work, check /usr/local/bin for a propper nix installation
  3. check if there is a unrar tool already (not included in full-cygwin installation with: ‘unrar.exe
  4. you have to** subscribe to a nix channel**, see the nix documentation: chapter 2. quick start [4]
  5. if ‘nix-env.exe’ works, install ‘unrar’ using: ‘nix-env.exe -i unrar’ you should see compiler stuff and it installs a million *.drv files…
  6. now type: ‘unrar.exe’, should say: “bash: unrar.exe: command not found”
  7. now type: “export PATH=~./nix-profile/bin:$PATH
  8. and try the command from step 5 again, now you should get a working ‘unrar.exe’ installation

what worked using nix on cygwin-windows

most of the software related to X did not work, as windows and mesa don’t go along nicely. i’ve tried a few programs:

summary

great to have nix on windows. no it’s time to use it, here are a bunch of scenarios:

but both points would be  independent of nix, so this results in a very nice build system. maybe combined with hyrdra this is a great way to build software.

links