diff --git a/doc/manual/command-ref/nix-env.xml b/doc/manual/command-ref/nix-env.xml index d257a5e49c7..b16452bc1cd 100644 --- a/doc/manual/command-ref/nix-env.xml +++ b/doc/manual/command-ref/nix-env.xml @@ -509,6 +509,36 @@ selecting the subversionWithJava attribute from the set returned by calling the function defined in ./foo.nix. +To install an expression from a channel: + + +$ nix-env -i -E 'channels: (channels.nixpkgs {}).git' + +Here, -f is not given, so the expression is passed +as an argument the "default expressions" that +are setup by nix-channel by default in +~/.nix-defexpr. +That means we can access the channel from it (using the one called +nixpkgs in the example, as it is named in +nix-channel --list). + +This also allows you to override packages: + + +$ nix-env -i -E 'channels: (channels.nixpkgs {}).git.override { pythonSupport = false; }' + +However, this is not recommended, because the overrides will not be remembered, +so the next update via nix-env --upgrade will undo them. +It is better to define such overrides in ~/.config/nixpkgs/config.nix. + +It is possible to install multiple derivations with an expression +by making it evaluate to an attribute set instead of a single derivation: + + +$ nix-env -i -E 'channels: with channels.nixpkgs {}; { inherit git vim; }' + + + A dry-run tells you which paths will be downloaded or built from source: