nix-env-set - Man Page

Name

nix-env --set — set profile to contain a specified derivation

Synopsis

nix-env --set drvname

Description

The --set operation modifies the current generation of a profile so that it contains exactly the specified derivation, and nothing else.

Options

The following options are allowed for all nix-env operations, but may not always have an effect.

Common Options

Most Nix commands accept the following command-line options:

{ # The system (e.g., `i686-linux') for which to build the packages.
system ? builtins.currentSystem
...
}: ...

So if you call this Nix expression (e.g., when you do nix-env --install --attr pkgname), the function will be called automatically using the value builtins.currentSystem for the system argument. You can override this using --arg, e.g., nix-env --install --attr pkgname --arg system \"i686-freebsd\". (Note that since the argument is a Nix string literal, you have to escape the quotes.)

Environment variables

Common Environment Variables

Most Nix commands interpret the following environment variables:

$ mkdir /nix
$ mount -o bind /mnt/otherdisk/nix /nix

Consult the mount 8 manual page for details.

XDG Base Directories

Nix follows the XDG Base Directory Specification\c .

For backwards compatibility, Nix commands will follow the standard only when use-xdg-base-directories is enabled. New Nix commands (experimental) conform to the standard by default.

The following environment variables are used to determine locations of various state and configuration files:

  • [XDG_CONFIG_HOME]{#env-XDGCONFIGHOME} (default ~/.config)
  • [XDG_STATE_HOME]{#env-XDGSTATEHOME} (default ~/.local/state)
  • [XDG_CACHE_HOME]{#env-XDGCACHEHOME} (default ~/.cache)

In addition, setting the following environment variables overrides the XDG base directories:

  • [NIX_CONFIG_HOME]{#env-NIXCONFIGHOME} (default $XDG_CONFIG_HOME/nix)
  • [NIX_STATE_HOME]{#env-NIXSTATEHOME} (default $XDG_STATE_HOME/nix)
  • [NIX_CACHE_HOME]{#env-NIXCACHEHOME} (default $XDG_CACHE_HOME/nix)

When use-xdg-base-directories is enabled, the configuration directory is:

  1. $NIX_CONFIG_HOME, if it is defined
  2. Otherwise, $XDG_CONFIG_HOME/nix, if XDG_CONFIG_HOME is defined
  3. Otherwise, ~/.config/nix.

Likewise for the state and cache directories.

Examples

The following updates a profile such that its current generation will contain just Firefox:

$ nix-env --profile /nix/var/nix/profiles/browser --set firefox