Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

manual: Explain nix-env -E without -f #3208

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions doc/manual/command-ref/nix-env.xml
Original file line number Diff line number Diff line change
Expand Up @@ -509,6 +509,36 @@ selecting the <literal>subversionWithJava</literal> attribute from the
set returned by calling the function defined in
<filename>./foo.nix</filename>.</para>

<para>To install an expression from a channel:

<screen>
$ nix-env -i -E 'channels: (channels.nixpkgs {}).git'</screen>

Here, <literal>-f</literal> is not given, so the expression is passed
as an argument the "default expressions" that
are setup by <command>nix-channel</command> by default in
<filename>~/.nix-defexpr</filename>.
That means we can access the channel from it (using the one called
<literal>nixpkgs</literal> in the example, as it is named in
<command>nix-channel --list</command>).</para>

<para>This also allows you to override packages:

<screen>
$ nix-env -i -E 'channels: (channels.nixpkgs {}).git.override { pythonSupport = false; }'</screen>

However, this is not recommended, because the overrides will not be remembered,
so the next update via <command>nix-env --upgrade</command> will undo them.
It is better to define such overrides in <filename>~/.config/nixpkgs/config.nix</filename>.</para>

<para>It is possible to install multiple derivations with an expression
by making it evaluate to an attribute set instead of a single derivation:

<screen>
$ nix-env -i -E 'channels: with channels.nixpkgs {}; { inherit git vim; }'</screen>

</para>

<para>A dry-run tells you which paths will be downloaded or built from
source:

Expand Down