[Nix-dev] Getting started with nix-build

Oliver Matthews ojm at codersoffortune.net
Tue Mar 24 15:57:17 CET 2015


Peter - thanks, that's exactly what I was needing.

Regards,
Oliver

---- On Tue, 24 Mar 2015 14:29:58 +0000 Peter Simons<simons at cryp.to> wrote ---- 

Hi Oliver, 
 
make sure that you're building changes relative to some version of 
Nixpkgs for which binary packages are already available. If you're 
running NixOS, for example, switch your repository to the version that 
you're currently running: 
 
 $ git checkout -b my-patches origin/master 
 $ git reset --hard $(nixos-version --revision) 
 
Now cherry-pick the Git commit you'd like to test-build into that branch: 
 
 $ git cherry-pick your-hash-here 
 
And build it: 
 
 $ nix-build . -A myNewPackage 
 
Note that the use of "." assumes that you're currently in upper-most 
directory of your Nixpkgs repository. If that's not the case, then you 
must give the appropriate path, i.e. 
 
 $ nix-build ~/src/nixpkgs -A myNewPackage 
 
Once you're happy with the changes you've made, commit them and run 
 
 $ git rebase origin/master 
 
to bring the branch into shape for pushing. 
 
Note that there's also https://github.com/NixOS/nixpkgs-channels. That 
Git repository is a clone of Nixpkgs that provides several branches that 
correspond to the latest available version of the binary channels from 
hydra.nixos.org, i.e. there's a "nixos-unstable" branch that gives you 
the latest possible version of Nixpkgs for which binaries can be 
downloaded. 
 
Last but not least, you can usually work fine on "master", if you add 
the flag "--option extra-binary-caches http://hydra.nixos.org" to the 
nix-build command line. You'll hardly ever have to compile fundamental 
packages like glibc, but you may have to build other, more obscure stuff 
locally because these are still waiting in the Hydra queue. 
 
I hope this helps, 
Peter 
 
_______________________________________________ 
nix-dev mailing list 
nix-dev at lists.science.uu.nl 
http://lists.science.uu.nl/mailman/listinfo/nix-dev 





-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.science.uu.nl/pipermail/nix-dev/attachments/20150324/6aa5523d/attachment.html 


More information about the nix-dev mailing list