2020-07-24 13:56:19 +03:00
|
|
|
# Name
|
2020-07-23 13:58:42 +03:00
|
|
|
|
2020-07-24 13:56:19 +03:00
|
|
|
`nix-env` - manipulate or query Nix user environments
|
2020-07-23 13:58:42 +03:00
|
|
|
|
2020-07-24 13:56:19 +03:00
|
|
|
# Synopsis
|
2020-07-23 13:58:42 +03:00
|
|
|
|
2023-03-23 17:27:41 +02:00
|
|
|
`nix-env` *operation* [*options*] [*arguments…*]
|
2020-07-24 13:56:19 +03:00
|
|
|
[`--option` *name* *value*]
|
|
|
|
[`--arg` *name* *value*]
|
|
|
|
[`--argstr` *name* *value*]
|
|
|
|
[{`--file` | `-f`} *path*]
|
2023-03-23 17:27:41 +02:00
|
|
|
[{`--profile` | `-p`} *path*]
|
2020-07-24 13:56:19 +03:00
|
|
|
[`--system-filter` *system*]
|
|
|
|
[`--dry-run`]
|
2020-07-23 13:58:42 +03:00
|
|
|
|
|
|
|
# Description
|
|
|
|
|
|
|
|
The command `nix-env` is used to manipulate Nix user environments. User
|
|
|
|
environments are sets of software packages available to a user at some
|
|
|
|
point in time. In other words, they are a synthesised view of the
|
|
|
|
programs available in the Nix store. There may be many user
|
|
|
|
environments: different users can have different environments, and
|
|
|
|
individual users can switch between different environments.
|
|
|
|
|
|
|
|
`nix-env` takes exactly one *operation* flag which indicates the
|
2023-03-23 17:27:41 +02:00
|
|
|
subcommand to be performed. The following operations are available:
|
|
|
|
|
|
|
|
- [`--install`](./nix-env/install.md)
|
|
|
|
- [`--upgrade`](./nix-env/upgrade.md)
|
|
|
|
- [`--uninstall`](./nix-env/uninstall.md)
|
|
|
|
- [`--set`](./nix-env/set.md)
|
|
|
|
- [`--set-flag`](./nix-env/set-flag.md)
|
|
|
|
- [`--query`](./nix-env/query.md)
|
|
|
|
- [`--switch-profile`](./nix-env/switch-profile.md)
|
|
|
|
- [`--list-generations`](./nix-env/list-generations.md)
|
|
|
|
- [`--delete-generations`](./nix-env/delete-generations.md)
|
|
|
|
- [`--switch-generation`](./nix-env/switch-generation.md)
|
|
|
|
- [`--rollback`](./nix-env/rollback.md)
|
|
|
|
|
|
|
|
These pages can be viewed offline:
|
|
|
|
|
|
|
|
- `man nix-env-<operation>`.
|
|
|
|
|
|
|
|
Example: `man nix-env-install`
|
|
|
|
|
|
|
|
- `nix-env --help --<operation>`
|
|
|
|
|
|
|
|
Example: `nix-env --help --install`
|
2020-07-23 13:58:42 +03:00
|
|
|
|
|
|
|
# Selectors
|
|
|
|
|
|
|
|
Several commands, such as `nix-env -q` and `nix-env -i`, take a list of
|
|
|
|
arguments that specify the packages on which to operate. These are
|
|
|
|
extended regular expressions that must match the entire name of the
|
2022-07-10 13:09:44 +03:00
|
|
|
package. (For details on regular expressions, see **regex**(7).) The match is
|
2020-07-23 13:58:42 +03:00
|
|
|
case-sensitive. The regular expression can optionally be followed by a
|
|
|
|
dash and a version number; if omitted, any version of the package will
|
|
|
|
match. Here are some examples:
|
|
|
|
|
2021-04-23 15:30:42 +03:00
|
|
|
- `firefox`\
|
2020-07-23 13:58:42 +03:00
|
|
|
Matches the package name `firefox` and any version.
|
|
|
|
|
2021-04-23 15:30:42 +03:00
|
|
|
- `firefox-32.0`\
|
2020-07-23 13:58:42 +03:00
|
|
|
Matches the package name `firefox` and version `32.0`.
|
|
|
|
|
2021-04-23 15:30:42 +03:00
|
|
|
- `gtk\\+`\
|
2020-07-23 13:58:42 +03:00
|
|
|
Matches the package name `gtk+`. The `+` character must be escaped
|
|
|
|
using a backslash to prevent it from being interpreted as a
|
|
|
|
quantifier, and the backslash must be escaped in turn with another
|
|
|
|
backslash to ensure that the shell passes it on.
|
|
|
|
|
2021-04-23 15:30:42 +03:00
|
|
|
- `.\*`\
|
2020-07-23 13:58:42 +03:00
|
|
|
Matches any package name. This is the default for most commands.
|
|
|
|
|
2021-04-23 15:30:42 +03:00
|
|
|
- `'.*zip.*'`\
|
2020-07-23 13:58:42 +03:00
|
|
|
Matches any package name containing the string `zip`. Note the dots:
|
|
|
|
`'*zip*'` does not work, because in a regular expression, the
|
|
|
|
character `*` is interpreted as a quantifier.
|
|
|
|
|
2021-04-23 15:30:42 +03:00
|
|
|
- `'.*(firefox|chromium).*'`\
|
2020-07-23 13:58:42 +03:00
|
|
|
Matches any package name containing the strings `firefox` or
|
|
|
|
`chromium`.
|
|
|
|
|
|
|
|
# Files
|
|
|
|
|
2023-02-17 19:57:15 +02:00
|
|
|
{{#include ./files/default-nix-expression.md}}
|
|
|
|
|
2023-04-27 12:56:52 +03:00
|
|
|
{{#include ./files/profiles.md}}
|