Nix (Package Manager) Reference
Kip Landergren
(Updated: )
Contents
nix-shell
| -p | --packages | specify the packages needed |
| --run | execute the given bash command | |
| --pure | discard (??most??) environment variables | |
| -I | the source to use for package declarations |
Commands
nix
nix search
nix-shell
nix repl
nix instantiate --eval [FILE]
nix-shell -p nix-info --run "nix-info -m"
Resources
- NixOS Package Search
- Nix Channel Status
- The Purely Functional Software Deployment Model, Eelco Dolstra’s PhD thesis
- Nix: A Safe and Policy-Free System for Software Deployment
Frequently Asked Questions (FAQs)
Why aren’t Nix’s man pages working?
If you get:
% nix-shell --help
No manual entry for nix-shell
it is related to a bunch of issues:
and a fix for darwin mentioned in the latter issue is to run:
nix --extra-experimental-features nix-command --extra-experimental-features flakes profile add nixpkgs#nix
Note: I believe this installs the manuals from the latest version of nix at time of invocation, which may be different than the one you have installed.
Nix Terminology
- build platform
- where the executable is built
- derivation
- precise description of how contents of existing files are used to derive new files
- evaluate
- transform an expression into a value according to the language rules
- host platform
- where the executable runs
- reproducible
- getting the same results no matter when or where you run the command
- target platform
- synonymous with host platform