7

I was wondering, why some packages appear in older versions than in the github repo when querying them via nix-env -qa .. . I learned that this is due to the fact that the master branch has not been merged to the unstable-channel.

How would I manually install a derivation from the master branch, in order to get the latest version?

Anton Harald
  • 5,772
  • 4
  • 27
  • 61

2 Answers2

8

Going for the master branch can be a little risky as the binary substitutes might not be available and you can end building lot of packages.
That said, you can specify which nixpkgs will be used by nix-env with the -f flag.

So let's say you want to build hello from master, you can use the following:

$ nix-env -f https://github.com/NixOS/nixpkgs/archive/master.tar.gz -iA hello

It is also possible to try git branches packages in a nix shell by using -I nixpkgs=/path/to/nix/pkgs:

$ nix-shell -p hello -I nixpkgs=https://github.com/NixOS/nixpkgs/archive/master.tar.gz
Eric
  • 2,784
  • 1
  • 20
  • 25
6

The most flexible way is:

git clone https://github.com/nixos/nixpkgs
cd nixpkgs
nix-build -A hello
nix-env -i $(readlink result)
David Grayson
  • 84,103
  • 24
  • 152
  • 189