mirror of
https://github.com/privatevoid-net/nix-super.git
synced 2024-11-10 08:16:15 +02:00
Convert short nix options to long ones
e.g. nix-env -e subversion => nix-env --uninstall subversion The aim is to make the documentation less cryptic for newcomers and the long options are more self-documenting. The change was made with the following script: <https://github.com/aschmolck/convert-short-nix-opts-to-long-ones> and sanity checked visually.
This commit is contained in:
parent
5fd161189d
commit
8d4b6766e2
35 changed files with 119 additions and 119 deletions
|
@ -48,13 +48,13 @@ If the build passes and is deterministic, Nix will exit with a status
|
||||||
code of 0:
|
code of 0:
|
||||||
|
|
||||||
```console
|
```console
|
||||||
$ nix-build ./deterministic.nix -A stable
|
$ nix-build ./deterministic.nix --attr stable
|
||||||
this derivation will be built:
|
this derivation will be built:
|
||||||
/nix/store/z98fasz2jqy9gs0xbvdj939p27jwda38-stable.drv
|
/nix/store/z98fasz2jqy9gs0xbvdj939p27jwda38-stable.drv
|
||||||
building '/nix/store/z98fasz2jqy9gs0xbvdj939p27jwda38-stable.drv'...
|
building '/nix/store/z98fasz2jqy9gs0xbvdj939p27jwda38-stable.drv'...
|
||||||
/nix/store/yyxlzw3vqaas7wfp04g0b1xg51f2czgq-stable
|
/nix/store/yyxlzw3vqaas7wfp04g0b1xg51f2czgq-stable
|
||||||
|
|
||||||
$ nix-build ./deterministic.nix -A stable --check
|
$ nix-build ./deterministic.nix --attr stable --check
|
||||||
checking outputs of '/nix/store/z98fasz2jqy9gs0xbvdj939p27jwda38-stable.drv'...
|
checking outputs of '/nix/store/z98fasz2jqy9gs0xbvdj939p27jwda38-stable.drv'...
|
||||||
/nix/store/yyxlzw3vqaas7wfp04g0b1xg51f2czgq-stable
|
/nix/store/yyxlzw3vqaas7wfp04g0b1xg51f2czgq-stable
|
||||||
```
|
```
|
||||||
|
@ -63,13 +63,13 @@ If the build is not deterministic, Nix will exit with a status code of
|
||||||
1:
|
1:
|
||||||
|
|
||||||
```console
|
```console
|
||||||
$ nix-build ./deterministic.nix -A unstable
|
$ nix-build ./deterministic.nix --attr unstable
|
||||||
this derivation will be built:
|
this derivation will be built:
|
||||||
/nix/store/cgl13lbj1w368r5z8gywipl1ifli7dhk-unstable.drv
|
/nix/store/cgl13lbj1w368r5z8gywipl1ifli7dhk-unstable.drv
|
||||||
building '/nix/store/cgl13lbj1w368r5z8gywipl1ifli7dhk-unstable.drv'...
|
building '/nix/store/cgl13lbj1w368r5z8gywipl1ifli7dhk-unstable.drv'...
|
||||||
/nix/store/krpqk0l9ib0ibi1d2w52z293zw455cap-unstable
|
/nix/store/krpqk0l9ib0ibi1d2w52z293zw455cap-unstable
|
||||||
|
|
||||||
$ nix-build ./deterministic.nix -A unstable --check
|
$ nix-build ./deterministic.nix --attr unstable --check
|
||||||
checking outputs of '/nix/store/cgl13lbj1w368r5z8gywipl1ifli7dhk-unstable.drv'...
|
checking outputs of '/nix/store/cgl13lbj1w368r5z8gywipl1ifli7dhk-unstable.drv'...
|
||||||
error: derivation '/nix/store/cgl13lbj1w368r5z8gywipl1ifli7dhk-unstable.drv' may
|
error: derivation '/nix/store/cgl13lbj1w368r5z8gywipl1ifli7dhk-unstable.drv' may
|
||||||
not be deterministic: output '/nix/store/krpqk0l9ib0ibi1d2w52z293zw455cap-unstable' differs
|
not be deterministic: output '/nix/store/krpqk0l9ib0ibi1d2w52z293zw455cap-unstable' differs
|
||||||
|
@ -89,7 +89,7 @@ Using `--check` with `--keep-failed` will cause Nix to keep the second
|
||||||
build's output in a special, `.check` path:
|
build's output in a special, `.check` path:
|
||||||
|
|
||||||
```console
|
```console
|
||||||
$ nix-build ./deterministic.nix -A unstable --check --keep-failed
|
$ nix-build ./deterministic.nix --attr unstable --check --keep-failed
|
||||||
checking outputs of '/nix/store/cgl13lbj1w368r5z8gywipl1ifli7dhk-unstable.drv'...
|
checking outputs of '/nix/store/cgl13lbj1w368r5z8gywipl1ifli7dhk-unstable.drv'...
|
||||||
note: keeping build directory '/tmp/nix-build-unstable.drv-0'
|
note: keeping build directory '/tmp/nix-build-unstable.drv-0'
|
||||||
error: derivation '/nix/store/cgl13lbj1w368r5z8gywipl1ifli7dhk-unstable.drv' may
|
error: derivation '/nix/store/cgl13lbj1w368r5z8gywipl1ifli7dhk-unstable.drv' may
|
||||||
|
|
|
@ -90,7 +90,7 @@ Then, restart the `nix-daemon`.
|
||||||
Build any derivation, for example:
|
Build any derivation, for example:
|
||||||
|
|
||||||
```console
|
```console
|
||||||
$ nix-build -E '(import <nixpkgs> {}).writeText "example" (builtins.toString builtins.currentTime)'
|
$ nix-build --expr '(import <nixpkgs> {}).writeText "example" (builtins.toString builtins.currentTime)'
|
||||||
this derivation will be built:
|
this derivation will be built:
|
||||||
/nix/store/s4pnfbkalzy5qz57qs6yybna8wylkig6-example.drv
|
/nix/store/s4pnfbkalzy5qz57qs6yybna8wylkig6-example.drv
|
||||||
building '/nix/store/s4pnfbkalzy5qz57qs6yybna8wylkig6-example.drv'...
|
building '/nix/store/s4pnfbkalzy5qz57qs6yybna8wylkig6-example.drv'...
|
||||||
|
|
|
@ -76,7 +76,7 @@ except for `--arg` and `--attr` / `-A` which are passed to `nix-instantiate`.
|
||||||
# Examples
|
# Examples
|
||||||
|
|
||||||
```console
|
```console
|
||||||
$ nix-build '<nixpkgs>' -A firefox
|
$ nix-build '<nixpkgs>' --attr firefox
|
||||||
store derivation is /nix/store/qybprl8sz2lc...-firefox-1.5.0.7.drv
|
store derivation is /nix/store/qybprl8sz2lc...-firefox-1.5.0.7.drv
|
||||||
/nix/store/d18hyl92g30l...-firefox-1.5.0.7
|
/nix/store/d18hyl92g30l...-firefox-1.5.0.7
|
||||||
|
|
||||||
|
@ -91,7 +91,7 @@ If a derivation has multiple outputs, `nix-build` will build the default
|
||||||
(first) output. You can also build all outputs:
|
(first) output. You can also build all outputs:
|
||||||
|
|
||||||
```console
|
```console
|
||||||
$ nix-build '<nixpkgs>' -A openssl.all
|
$ nix-build '<nixpkgs>' --attr openssl.all
|
||||||
```
|
```
|
||||||
|
|
||||||
This will create a symlink for each output named `result-outputname`.
|
This will create a symlink for each output named `result-outputname`.
|
||||||
|
@ -101,7 +101,7 @@ outputs `out`, `bin` and `man`, `nix-build` will create symlinks
|
||||||
specific output:
|
specific output:
|
||||||
|
|
||||||
```console
|
```console
|
||||||
$ nix-build '<nixpkgs>' -A openssl.man
|
$ nix-build '<nixpkgs>' --attr openssl.man
|
||||||
```
|
```
|
||||||
|
|
||||||
This will create a symlink `result-man`.
|
This will create a symlink `result-man`.
|
||||||
|
@ -109,7 +109,7 @@ This will create a symlink `result-man`.
|
||||||
Build a Nix expression given on the command line:
|
Build a Nix expression given on the command line:
|
||||||
|
|
||||||
```console
|
```console
|
||||||
$ nix-build -E 'with import <nixpkgs> { }; runCommand "foo" { } "echo bar > $out"'
|
$ nix-build --expr 'with import <nixpkgs> { }; runCommand "foo" { } "echo bar > $out"'
|
||||||
$ cat ./result
|
$ cat ./result
|
||||||
bar
|
bar
|
||||||
```
|
```
|
||||||
|
@ -118,5 +118,5 @@ Build the GNU Hello package from the latest revision of the master
|
||||||
branch of Nixpkgs:
|
branch of Nixpkgs:
|
||||||
|
|
||||||
```console
|
```console
|
||||||
$ nix-build https://github.com/NixOS/nixpkgs/archive/master.tar.gz -A hello
|
$ nix-build https://github.com/NixOS/nixpkgs/archive/master.tar.gz --attr hello
|
||||||
```
|
```
|
||||||
|
|
|
@ -59,18 +59,18 @@ To subscribe to the Nixpkgs channel and install the GNU Hello package:
|
||||||
```console
|
```console
|
||||||
$ nix-channel --add https://nixos.org/channels/nixpkgs-unstable
|
$ nix-channel --add https://nixos.org/channels/nixpkgs-unstable
|
||||||
$ nix-channel --update
|
$ nix-channel --update
|
||||||
$ nix-env -iA nixpkgs.hello
|
$ nix-env --install --attr nixpkgs.hello
|
||||||
```
|
```
|
||||||
|
|
||||||
You can revert channel updates using `--rollback`:
|
You can revert channel updates using `--rollback`:
|
||||||
|
|
||||||
```console
|
```console
|
||||||
$ nix-instantiate --eval -E '(import <nixpkgs> {}).lib.version'
|
$ nix-instantiate --eval --expr '(import <nixpkgs> {}).lib.version'
|
||||||
"14.04.527.0e935f1"
|
"14.04.527.0e935f1"
|
||||||
|
|
||||||
$ nix-channel --rollback
|
$ nix-channel --rollback
|
||||||
switching from generation 483 to 482
|
switching from generation 483 to 482
|
||||||
|
|
||||||
$ nix-instantiate --eval -E '(import <nixpkgs> {}).lib.version'
|
$ nix-instantiate --eval --expr '(import <nixpkgs> {}).lib.version'
|
||||||
"14.04.526.dbadfad"
|
"14.04.526.dbadfad"
|
||||||
```
|
```
|
||||||
|
|
|
@ -87,5 +87,5 @@ environment:
|
||||||
```console
|
```console
|
||||||
$ nix-copy-closure --from alice@itchy.labs \
|
$ nix-copy-closure --from alice@itchy.labs \
|
||||||
/nix/store/0dj0503hjxy5mbwlafv1rsbdiyx1gkdy-subversion-1.4.4
|
/nix/store/0dj0503hjxy5mbwlafv1rsbdiyx1gkdy-subversion-1.4.4
|
||||||
$ nix-env -i /nix/store/0dj0503hjxy5mbwlafv1rsbdiyx1gkdy-subversion-1.4.4
|
$ nix-env --install /nix/store/0dj0503hjxy5mbwlafv1rsbdiyx1gkdy-subversion-1.4.4
|
||||||
```
|
```
|
||||||
|
|
|
@ -49,7 +49,7 @@ These pages can be viewed offline:
|
||||||
|
|
||||||
# Selectors
|
# Selectors
|
||||||
|
|
||||||
Several commands, such as `nix-env -q` and `nix-env -i`, take a list of
|
Several commands, such as `nix-env --query ` and `nix-env --install `, take a list of
|
||||||
arguments that specify the packages on which to operate. These are
|
arguments that specify the packages on which to operate. These are
|
||||||
extended regular expressions that must match the entire name of the
|
extended regular expressions that must match the entire name of the
|
||||||
package. (For details on regular expressions, see **regex**(7).) The match is
|
package. (For details on regular expressions, see **regex**(7).) The match is
|
||||||
|
|
|
@ -41,6 +41,6 @@ $ nix-env --delete-generations 30d
|
||||||
```
|
```
|
||||||
|
|
||||||
```console
|
```console
|
||||||
$ nix-env -p other_profile --delete-generations old
|
$ nix-env --profile other_profile --delete-generations old
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
|
@ -36,7 +36,7 @@ a number of possible ways:
|
||||||
then the derivation with the highest version will be installed.
|
then the derivation with the highest version will be installed.
|
||||||
|
|
||||||
You can force the installation of multiple derivations with the same
|
You can force the installation of multiple derivations with the same
|
||||||
name by being specific about the versions. For instance, `nix-env -i
|
name by being specific about the versions. For instance, `nix-env --install
|
||||||
gcc-3.3.6 gcc-4.1.1` will install both version of GCC (and will
|
gcc-3.3.6 gcc-4.1.1` will install both version of GCC (and will
|
||||||
probably cause a user environment conflict\!).
|
probably cause a user environment conflict\!).
|
||||||
|
|
||||||
|
@ -44,7 +44,7 @@ a number of possible ways:
|
||||||
paths* that select attributes from the top-level Nix
|
paths* that select attributes from the top-level Nix
|
||||||
expression. This is faster than using derivation names and
|
expression. This is faster than using derivation names and
|
||||||
unambiguous. To find out the attribute paths of available
|
unambiguous. To find out the attribute paths of available
|
||||||
packages, use `nix-env -qaP`.
|
packages, use `nix-env --query --available --attr-path `.
|
||||||
|
|
||||||
- If `--from-profile` *path* is given, *args* is a set of names
|
- If `--from-profile` *path* is given, *args* is a set of names
|
||||||
denoting installed store paths in the profile *path*. This is an
|
denoting installed store paths in the profile *path*. This is an
|
||||||
|
@ -87,7 +87,7 @@ a number of possible ways:
|
||||||
|
|
||||||
- `--remove-all` / `-r`\
|
- `--remove-all` / `-r`\
|
||||||
Remove all previously installed packages first. This is equivalent
|
Remove all previously installed packages first. This is equivalent
|
||||||
to running `nix-env -e '.*'` first, except that everything happens
|
to running `nix-env --uninstall '.*'` first, except that everything happens
|
||||||
in a single transaction.
|
in a single transaction.
|
||||||
|
|
||||||
{{#include ./opt-common.md}}
|
{{#include ./opt-common.md}}
|
||||||
|
@ -103,9 +103,9 @@ a number of possible ways:
|
||||||
To install a package using a specific attribute path from the active Nix expression:
|
To install a package using a specific attribute path from the active Nix expression:
|
||||||
|
|
||||||
```console
|
```console
|
||||||
$ nix-env -iA gcc40mips
|
$ nix-env --install --attr gcc40mips
|
||||||
installing `gcc-4.0.2'
|
installing `gcc-4.0.2'
|
||||||
$ nix-env -iA xorg.xorgserver
|
$ nix-env --install --attr xorg.xorgserver
|
||||||
installing `xorg-server-1.2.0'
|
installing `xorg-server-1.2.0'
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -133,32 +133,32 @@ installing `gcc-3.3.2'
|
||||||
To install all derivations in the Nix expression `foo.nix`:
|
To install all derivations in the Nix expression `foo.nix`:
|
||||||
|
|
||||||
```console
|
```console
|
||||||
$ nix-env -f ~/foo.nix -i '.*'
|
$ nix-env --file ~/foo.nix --install '.*'
|
||||||
```
|
```
|
||||||
|
|
||||||
To copy the store path with symbolic name `gcc` from another profile:
|
To copy the store path with symbolic name `gcc` from another profile:
|
||||||
|
|
||||||
```console
|
```console
|
||||||
$ nix-env -i --from-profile /nix/var/nix/profiles/foo gcc
|
$ nix-env --install --from-profile /nix/var/nix/profiles/foo gcc
|
||||||
```
|
```
|
||||||
|
|
||||||
To install a specific [store derivation] (typically created by
|
To install a specific [store derivation] (typically created by
|
||||||
`nix-instantiate`):
|
`nix-instantiate`):
|
||||||
|
|
||||||
```console
|
```console
|
||||||
$ nix-env -i /nix/store/fibjb1bfbpm5mrsxc4mh2d8n37sxh91i-gcc-3.4.3.drv
|
$ nix-env --install /nix/store/fibjb1bfbpm5mrsxc4mh2d8n37sxh91i-gcc-3.4.3.drv
|
||||||
```
|
```
|
||||||
|
|
||||||
To install a specific output path:
|
To install a specific output path:
|
||||||
|
|
||||||
```console
|
```console
|
||||||
$ nix-env -i /nix/store/y3cgx0xj1p4iv9x0pnnmdhr8iyg741vk-gcc-3.4.3
|
$ nix-env --install /nix/store/y3cgx0xj1p4iv9x0pnnmdhr8iyg741vk-gcc-3.4.3
|
||||||
```
|
```
|
||||||
|
|
||||||
To install from a Nix expression specified on the command-line:
|
To install from a Nix expression specified on the command-line:
|
||||||
|
|
||||||
```console
|
```console
|
||||||
$ nix-env -f ./foo.nix -i -E \
|
$ nix-env --file ./foo.nix --install --expr \
|
||||||
'f: (f {system = "i686-linux";}).subversionWithJava'
|
'f: (f {system = "i686-linux";}).subversionWithJava'
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -170,7 +170,7 @@ function defined in `./foo.nix`.
|
||||||
A dry-run tells you which paths will be downloaded or built from source:
|
A dry-run tells you which paths will be downloaded or built from source:
|
||||||
|
|
||||||
```console
|
```console
|
||||||
$ nix-env -f '<nixpkgs>' -iA hello --dry-run
|
$ nix-env --file '<nixpkgs>' --install --attr hello --dry-run
|
||||||
(dry run; not doing anything)
|
(dry run; not doing anything)
|
||||||
installing ‘hello-2.10’
|
installing ‘hello-2.10’
|
||||||
this path will be fetched (0.04 MiB download, 0.19 MiB unpacked):
|
this path will be fetched (0.04 MiB download, 0.19 MiB unpacked):
|
||||||
|
@ -182,6 +182,6 @@ To install Firefox from the latest revision in the Nixpkgs/NixOS 14.12
|
||||||
channel:
|
channel:
|
||||||
|
|
||||||
```console
|
```console
|
||||||
$ nix-env -f https://github.com/NixOS/nixpkgs/archive/nixos-14.12.tar.gz -iA firefox
|
$ nix-env --file https://github.com/NixOS/nixpkgs/archive/nixos-14.12.tar.gz --install --attr firefox
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
|
@ -137,7 +137,7 @@ derivation is shown unless `--no-name` is specified.
|
||||||
To show installed packages:
|
To show installed packages:
|
||||||
|
|
||||||
```console
|
```console
|
||||||
$ nix-env -q
|
$ nix-env --query
|
||||||
bison-1.875c
|
bison-1.875c
|
||||||
docbook-xml-4.2
|
docbook-xml-4.2
|
||||||
firefox-1.0.4
|
firefox-1.0.4
|
||||||
|
@ -149,7 +149,7 @@ ORBit2-2.8.3
|
||||||
To show available packages:
|
To show available packages:
|
||||||
|
|
||||||
```console
|
```console
|
||||||
$ nix-env -qa
|
$ nix-env --query --available
|
||||||
firefox-1.0.7
|
firefox-1.0.7
|
||||||
GConf-2.4.0.1
|
GConf-2.4.0.1
|
||||||
MPlayer-1.0pre7
|
MPlayer-1.0pre7
|
||||||
|
@ -160,7 +160,7 @@ ORBit2-2.8.3
|
||||||
To show the status of available packages:
|
To show the status of available packages:
|
||||||
|
|
||||||
```console
|
```console
|
||||||
$ nix-env -qas
|
$ nix-env --query --available --status
|
||||||
-P- firefox-1.0.7 (not installed but present)
|
-P- firefox-1.0.7 (not installed but present)
|
||||||
--S GConf-2.4.0.1 (not present, but there is a substitute for fast installation)
|
--S GConf-2.4.0.1 (not present, but there is a substitute for fast installation)
|
||||||
--S MPlayer-1.0pre3 (i.e., this is not the installed MPlayer, even though the version is the same!)
|
--S MPlayer-1.0pre3 (i.e., this is not the installed MPlayer, even though the version is the same!)
|
||||||
|
@ -171,14 +171,14 @@ IP- ORBit2-2.8.3 (installed and by definition present)
|
||||||
To show available packages in the Nix expression `foo.nix`:
|
To show available packages in the Nix expression `foo.nix`:
|
||||||
|
|
||||||
```console
|
```console
|
||||||
$ nix-env -f ./foo.nix -qa
|
$ nix-env --file ./foo.nix --query --available
|
||||||
foo-1.2.3
|
foo-1.2.3
|
||||||
```
|
```
|
||||||
|
|
||||||
To compare installed versions to what’s available:
|
To compare installed versions to what’s available:
|
||||||
|
|
||||||
```console
|
```console
|
||||||
$ nix-env -qc
|
$ nix-env --query --compare-versions
|
||||||
...
|
...
|
||||||
acrobat-reader-7.0 - ? (package is not available at all)
|
acrobat-reader-7.0 - ? (package is not available at all)
|
||||||
autoconf-2.59 = 2.59 (same version)
|
autoconf-2.59 = 2.59 (same version)
|
||||||
|
@ -189,7 +189,7 @@ firefox-1.0.4 < 1.0.7 (a more recent version is available)
|
||||||
To show all packages with “`zip`” in the name:
|
To show all packages with “`zip`” in the name:
|
||||||
|
|
||||||
```console
|
```console
|
||||||
$ nix-env -qa '.*zip.*'
|
$ nix-env --query --available '.*zip.*'
|
||||||
bzip2-1.0.6
|
bzip2-1.0.6
|
||||||
gzip-1.6
|
gzip-1.6
|
||||||
zip-3.0
|
zip-3.0
|
||||||
|
@ -199,7 +199,7 @@ zip-3.0
|
||||||
To show all packages with “`firefox`” or “`chromium`” in the name:
|
To show all packages with “`firefox`” or “`chromium`” in the name:
|
||||||
|
|
||||||
```console
|
```console
|
||||||
$ nix-env -qa '.*(firefox|chromium).*'
|
$ nix-env --query --available '.*(firefox|chromium).*'
|
||||||
chromium-37.0.2062.94
|
chromium-37.0.2062.94
|
||||||
chromium-beta-38.0.2125.24
|
chromium-beta-38.0.2125.24
|
||||||
firefox-32.0.3
|
firefox-32.0.3
|
||||||
|
@ -210,6 +210,6 @@ firefox-with-plugins-13.0.1
|
||||||
To show all packages in the latest revision of the Nixpkgs repository:
|
To show all packages in the latest revision of the Nixpkgs repository:
|
||||||
|
|
||||||
```console
|
```console
|
||||||
$ nix-env -f https://github.com/NixOS/nixpkgs/archive/master.tar.gz -qa
|
$ nix-env --file https://github.com/NixOS/nixpkgs/archive/master.tar.gz --query --available
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
|
@ -46,16 +46,16 @@ To prevent the currently installed Firefox from being upgraded:
|
||||||
$ nix-env --set-flag keep true firefox
|
$ nix-env --set-flag keep true firefox
|
||||||
```
|
```
|
||||||
|
|
||||||
After this, `nix-env -u` will ignore Firefox.
|
After this, `nix-env --upgrade ` will ignore Firefox.
|
||||||
|
|
||||||
To disable the currently installed Firefox, then install a new Firefox
|
To disable the currently installed Firefox, then install a new Firefox
|
||||||
while the old remains part of the profile:
|
while the old remains part of the profile:
|
||||||
|
|
||||||
```console
|
```console
|
||||||
$ nix-env -q
|
$ nix-env --query
|
||||||
firefox-2.0.0.9 (the current one)
|
firefox-2.0.0.9 (the current one)
|
||||||
|
|
||||||
$ nix-env --preserve-installed -i firefox-2.0.0.11
|
$ nix-env --preserve-installed --install firefox-2.0.0.11
|
||||||
installing `firefox-2.0.0.11'
|
installing `firefox-2.0.0.11'
|
||||||
building path(s) `/nix/store/myy0y59q3ig70dgq37jqwg1j0rsapzsl-user-environment'
|
building path(s) `/nix/store/myy0y59q3ig70dgq37jqwg1j0rsapzsl-user-environment'
|
||||||
collision between `/nix/store/...-firefox-2.0.0.11/bin/firefox'
|
collision between `/nix/store/...-firefox-2.0.0.11/bin/firefox'
|
||||||
|
@ -65,10 +65,10 @@ collision between `/nix/store/...-firefox-2.0.0.11/bin/firefox'
|
||||||
$ nix-env --set-flag active false firefox
|
$ nix-env --set-flag active false firefox
|
||||||
setting flag on `firefox-2.0.0.9'
|
setting flag on `firefox-2.0.0.9'
|
||||||
|
|
||||||
$ nix-env --preserve-installed -i firefox-2.0.0.11
|
$ nix-env --preserve-installed --install firefox-2.0.0.11
|
||||||
installing `firefox-2.0.0.11'
|
installing `firefox-2.0.0.11'
|
||||||
|
|
||||||
$ nix-env -q
|
$ nix-env --query
|
||||||
firefox-2.0.0.11 (the enabled one)
|
firefox-2.0.0.11 (the enabled one)
|
||||||
firefox-2.0.0.9 (the disabled one)
|
firefox-2.0.0.9 (the disabled one)
|
||||||
```
|
```
|
||||||
|
|
|
@ -25,6 +25,6 @@ The following updates a profile such that its current generation will
|
||||||
contain just Firefox:
|
contain just Firefox:
|
||||||
|
|
||||||
```console
|
```console
|
||||||
$ nix-env -p /nix/var/nix/profiles/browser --set firefox
|
$ nix-env --profile /nix/var/nix/profiles/browser --set firefox
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
|
@ -27,7 +27,7 @@ Switching will fail if the specified generation does not exist.
|
||||||
# Examples
|
# Examples
|
||||||
|
|
||||||
```console
|
```console
|
||||||
$ nix-env -G 42
|
$ nix-env --switch-generation 42
|
||||||
switching from generation 50 to 42
|
switching from generation 50 to 42
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
|
@ -22,5 +22,5 @@ the symlink `~/.nix-profile` is made to point to *path*.
|
||||||
# Examples
|
# Examples
|
||||||
|
|
||||||
```console
|
```console
|
||||||
$ nix-env -S ~/my-profile
|
$ nix-env --switch-profile ~/my-profile
|
||||||
```
|
```
|
||||||
|
|
|
@ -24,5 +24,5 @@ designated by the symbolic names *drvnames* are removed.
|
||||||
|
|
||||||
```console
|
```console
|
||||||
$ nix-env --uninstall gcc
|
$ nix-env --uninstall gcc
|
||||||
$ nix-env -e '.*' (remove everything)
|
$ nix-env --uninstall '.*' (remove everything)
|
||||||
```
|
```
|
||||||
|
|
|
@ -76,21 +76,21 @@ version is installed.
|
||||||
# Examples
|
# Examples
|
||||||
|
|
||||||
```console
|
```console
|
||||||
$ nix-env --upgrade -A nixpkgs.gcc
|
$ nix-env --upgrade --attr nixpkgs.gcc
|
||||||
upgrading `gcc-3.3.1' to `gcc-3.4'
|
upgrading `gcc-3.3.1' to `gcc-3.4'
|
||||||
```
|
```
|
||||||
|
|
||||||
When there are no updates available, nothing will happen:
|
When there are no updates available, nothing will happen:
|
||||||
|
|
||||||
```console
|
```console
|
||||||
$ nix-env --upgrade -A nixpkgs.pan
|
$ nix-env --upgrade --attr nixpkgs.pan
|
||||||
```
|
```
|
||||||
|
|
||||||
Using `-A` is preferred when possible, as it is faster and unambiguous but
|
Using `-A` is preferred when possible, as it is faster and unambiguous but
|
||||||
it is also possible to upgrade to a specific version by matching the derivation name:
|
it is also possible to upgrade to a specific version by matching the derivation name:
|
||||||
|
|
||||||
```console
|
```console
|
||||||
$ nix-env -u gcc-3.3.2 --always
|
$ nix-env --upgrade gcc-3.3.2 --always
|
||||||
upgrading `gcc-3.4' to `gcc-3.3.2'
|
upgrading `gcc-3.4' to `gcc-3.3.2'
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -98,7 +98,7 @@ To try to upgrade everything
|
||||||
(matching packages based on the part of the derivation name without version):
|
(matching packages based on the part of the derivation name without version):
|
||||||
|
|
||||||
```console
|
```console
|
||||||
$ nix-env -u
|
$ nix-env --upgrade
|
||||||
upgrading `hello-2.1.2' to `hello-2.1.3'
|
upgrading `hello-2.1.2' to `hello-2.1.3'
|
||||||
upgrading `mozilla-1.2' to `mozilla-1.4'
|
upgrading `mozilla-1.2' to `mozilla-1.4'
|
||||||
```
|
```
|
||||||
|
|
|
@ -88,7 +88,7 @@ Instantiate [store derivation]s from a Nix expression, and build them using `nix
|
||||||
$ nix-instantiate test.nix (instantiate)
|
$ nix-instantiate test.nix (instantiate)
|
||||||
/nix/store/cigxbmvy6dzix98dxxh9b6shg7ar5bvs-perl-BerkeleyDB-0.26.drv
|
/nix/store/cigxbmvy6dzix98dxxh9b6shg7ar5bvs-perl-BerkeleyDB-0.26.drv
|
||||||
|
|
||||||
$ nix-store -r $(nix-instantiate test.nix) (build)
|
$ nix-store --realise $(nix-instantiate test.nix) (build)
|
||||||
...
|
...
|
||||||
/nix/store/qhqk4n8ci095g3sdp93x7rgwyh9rdvgk-perl-BerkeleyDB-0.26 (output path)
|
/nix/store/qhqk4n8ci095g3sdp93x7rgwyh9rdvgk-perl-BerkeleyDB-0.26 (output path)
|
||||||
|
|
||||||
|
@ -100,30 +100,30 @@ dr-xr-xr-x 2 eelco users 4096 1970-01-01 01:00 lib
|
||||||
You can also give a Nix expression on the command line:
|
You can also give a Nix expression on the command line:
|
||||||
|
|
||||||
```console
|
```console
|
||||||
$ nix-instantiate -E 'with import <nixpkgs> { }; hello'
|
$ nix-instantiate --expr 'with import <nixpkgs> { }; hello'
|
||||||
/nix/store/j8s4zyv75a724q38cb0r87rlczaiag4y-hello-2.8.drv
|
/nix/store/j8s4zyv75a724q38cb0r87rlczaiag4y-hello-2.8.drv
|
||||||
```
|
```
|
||||||
|
|
||||||
This is equivalent to:
|
This is equivalent to:
|
||||||
|
|
||||||
```console
|
```console
|
||||||
$ nix-instantiate '<nixpkgs>' -A hello
|
$ nix-instantiate '<nixpkgs>' --attr hello
|
||||||
```
|
```
|
||||||
|
|
||||||
Parsing and evaluating Nix expressions:
|
Parsing and evaluating Nix expressions:
|
||||||
|
|
||||||
```console
|
```console
|
||||||
$ nix-instantiate --parse -E '1 + 2'
|
$ nix-instantiate --parse --expr '1 + 2'
|
||||||
1 + 2
|
1 + 2
|
||||||
```
|
```
|
||||||
|
|
||||||
```console
|
```console
|
||||||
$ nix-instantiate --eval -E '1 + 2'
|
$ nix-instantiate --eval --expr '1 + 2'
|
||||||
3
|
3
|
||||||
```
|
```
|
||||||
|
|
||||||
```console
|
```console
|
||||||
$ nix-instantiate --eval --xml -E '1 + 2'
|
$ nix-instantiate --eval --xml --expr '1 + 2'
|
||||||
<?xml version='1.0' encoding='utf-8'?>
|
<?xml version='1.0' encoding='utf-8'?>
|
||||||
<expr>
|
<expr>
|
||||||
<int value="3" />
|
<int value="3" />
|
||||||
|
@ -133,7 +133,7 @@ $ nix-instantiate --eval --xml -E '1 + 2'
|
||||||
The difference between non-strict and strict evaluation:
|
The difference between non-strict and strict evaluation:
|
||||||
|
|
||||||
```console
|
```console
|
||||||
$ nix-instantiate --eval --xml -E 'rec { x = "foo"; y = x; }'
|
$ nix-instantiate --eval --xml --expr 'rec { x = "foo"; y = x; }'
|
||||||
...
|
...
|
||||||
<attr name="x">
|
<attr name="x">
|
||||||
<string value="foo" />
|
<string value="foo" />
|
||||||
|
@ -148,7 +148,7 @@ Note that `y` is left unevaluated (the XML representation doesn’t
|
||||||
attempt to show non-normal forms).
|
attempt to show non-normal forms).
|
||||||
|
|
||||||
```console
|
```console
|
||||||
$ nix-instantiate --eval --xml --strict -E 'rec { x = "foo"; y = x; }'
|
$ nix-instantiate --eval --xml --strict --expr 'rec { x = "foo"; y = x; }'
|
||||||
...
|
...
|
||||||
<attr name="x">
|
<attr name="x">
|
||||||
<string value="foo" />
|
<string value="foo" />
|
||||||
|
|
|
@ -89,7 +89,7 @@ All options not listed here are passed to `nix-store
|
||||||
- `--packages` / `-p` *packages*…\
|
- `--packages` / `-p` *packages*…\
|
||||||
Set up an environment in which the specified packages are present.
|
Set up an environment in which the specified packages are present.
|
||||||
The command line arguments are interpreted as attribute names inside
|
The command line arguments are interpreted as attribute names inside
|
||||||
the Nix Packages collection. Thus, `nix-shell -p libjpeg openjdk`
|
the Nix Packages collection. Thus, `nix-shell --packages libjpeg openjdk`
|
||||||
will start a shell in which the packages denoted by the attribute
|
will start a shell in which the packages denoted by the attribute
|
||||||
names `libjpeg` and `openjdk` are present.
|
names `libjpeg` and `openjdk` are present.
|
||||||
|
|
||||||
|
@ -118,7 +118,7 @@ To build the dependencies of the package Pan, and start an interactive
|
||||||
shell in which to build it:
|
shell in which to build it:
|
||||||
|
|
||||||
```console
|
```console
|
||||||
$ nix-shell '<nixpkgs>' -A pan
|
$ nix-shell '<nixpkgs>' --attr pan
|
||||||
[nix-shell]$ eval ${unpackPhase:-unpackPhase}
|
[nix-shell]$ eval ${unpackPhase:-unpackPhase}
|
||||||
[nix-shell]$ cd $sourceRoot
|
[nix-shell]$ cd $sourceRoot
|
||||||
[nix-shell]$ eval ${patchPhase:-patchPhase}
|
[nix-shell]$ eval ${patchPhase:-patchPhase}
|
||||||
|
@ -137,7 +137,7 @@ To clear the environment first, and do some additional automatic
|
||||||
initialisation of the interactive shell:
|
initialisation of the interactive shell:
|
||||||
|
|
||||||
```console
|
```console
|
||||||
$ nix-shell '<nixpkgs>' -A pan --pure \
|
$ nix-shell '<nixpkgs>' --attr pan --pure \
|
||||||
--command 'export NIX_DEBUG=1; export NIX_CORES=8; return'
|
--command 'export NIX_DEBUG=1; export NIX_CORES=8; return'
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -146,13 +146,13 @@ Nix expressions can also be given on the command line using the `-E` and
|
||||||
packages `sqlite` and `libX11`:
|
packages `sqlite` and `libX11`:
|
||||||
|
|
||||||
```console
|
```console
|
||||||
$ nix-shell -E 'with import <nixpkgs> { }; runCommand "dummy" { buildInputs = [ sqlite xorg.libX11 ]; } ""'
|
$ nix-shell --expr 'with import <nixpkgs> { }; runCommand "dummy" { buildInputs = [ sqlite xorg.libX11 ]; } ""'
|
||||||
```
|
```
|
||||||
|
|
||||||
A shorter way to do the same is:
|
A shorter way to do the same is:
|
||||||
|
|
||||||
```console
|
```console
|
||||||
$ nix-shell -p sqlite xorg.libX11
|
$ nix-shell --packages sqlite xorg.libX11
|
||||||
[nix-shell]$ echo $NIX_LDFLAGS
|
[nix-shell]$ echo $NIX_LDFLAGS
|
||||||
… -L/nix/store/j1zg5v…-sqlite-3.8.0.2/lib -L/nix/store/0gmcz9…-libX11-1.6.1/lib …
|
… -L/nix/store/j1zg5v…-sqlite-3.8.0.2/lib -L/nix/store/0gmcz9…-libX11-1.6.1/lib …
|
||||||
```
|
```
|
||||||
|
@ -162,7 +162,7 @@ the `buildInputs = [ ... ]` shown above, not only package names. So the
|
||||||
following is also legal:
|
following is also legal:
|
||||||
|
|
||||||
```console
|
```console
|
||||||
$ nix-shell -p sqlite 'git.override { withManual = false; }'
|
$ nix-shell --packages sqlite 'git.override { withManual = false; }'
|
||||||
```
|
```
|
||||||
|
|
||||||
The `-p` flag looks up Nixpkgs in the Nix search path. You can override
|
The `-p` flag looks up Nixpkgs in the Nix search path. You can override
|
||||||
|
@ -171,7 +171,7 @@ gives you a shell containing the Pan package from a specific revision of
|
||||||
Nixpkgs:
|
Nixpkgs:
|
||||||
|
|
||||||
```console
|
```console
|
||||||
$ nix-shell -p pan -I nixpkgs=https://github.com/NixOS/nixpkgs/archive/8a3eea054838b55aca962c3fbde9c83c102b8bf2.tar.gz
|
$ nix-shell --packages pan -I nixpkgs=https://github.com/NixOS/nixpkgs/archive/8a3eea054838b55aca962c3fbde9c83c102b8bf2.tar.gz
|
||||||
|
|
||||||
[nix-shell:~]$ pan --version
|
[nix-shell:~]$ pan --version
|
||||||
Pan 0.139
|
Pan 0.139
|
||||||
|
@ -185,7 +185,7 @@ done by starting the script with the following lines:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
#! /usr/bin/env nix-shell
|
#! /usr/bin/env nix-shell
|
||||||
#! nix-shell -i real-interpreter -p packages
|
#! nix-shell -i real-interpreter --packages packages
|
||||||
```
|
```
|
||||||
|
|
||||||
where *real-interpreter* is the “real” script interpreter that will be
|
where *real-interpreter* is the “real” script interpreter that will be
|
||||||
|
@ -202,7 +202,7 @@ For example, here is a Python script that depends on Python and the
|
||||||
|
|
||||||
```python
|
```python
|
||||||
#! /usr/bin/env nix-shell
|
#! /usr/bin/env nix-shell
|
||||||
#! nix-shell -i python -p python pythonPackages.prettytable
|
#! nix-shell -i python --packages python pythonPackages.prettytable
|
||||||
|
|
||||||
import prettytable
|
import prettytable
|
||||||
|
|
||||||
|
@ -217,7 +217,7 @@ requires Perl and the `HTML::TokeParser::Simple` and `LWP` packages:
|
||||||
|
|
||||||
```perl
|
```perl
|
||||||
#! /usr/bin/env nix-shell
|
#! /usr/bin/env nix-shell
|
||||||
#! nix-shell -i perl -p perl perlPackages.HTMLTokeParserSimple perlPackages.LWP
|
#! nix-shell -i perl --packages perl perlPackages.HTMLTokeParserSimple perlPackages.LWP
|
||||||
|
|
||||||
use HTML::TokeParser::Simple;
|
use HTML::TokeParser::Simple;
|
||||||
|
|
||||||
|
@ -235,7 +235,7 @@ package like Terraform:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
#! /usr/bin/env nix-shell
|
#! /usr/bin/env nix-shell
|
||||||
#! nix-shell -i bash -p "terraform.withPlugins (plugins: [ plugins.openstack ])"
|
#! nix-shell -i bash --packages "terraform.withPlugins (plugins: [ plugins.openstack ])"
|
||||||
|
|
||||||
terraform apply
|
terraform apply
|
||||||
```
|
```
|
||||||
|
@ -251,7 +251,7 @@ branch):
|
||||||
|
|
||||||
```haskell
|
```haskell
|
||||||
#! /usr/bin/env nix-shell
|
#! /usr/bin/env nix-shell
|
||||||
#! nix-shell -i runghc -p "haskellPackages.ghcWithPackages (ps: [ps.download-curl ps.tagsoup])"
|
#! nix-shell -i runghc --packages "haskellPackages.ghcWithPackages (ps: [ps.download-curl ps.tagsoup])"
|
||||||
#! nix-shell -I nixpkgs=https://github.com/NixOS/nixpkgs/archive/nixos-20.03.tar.gz
|
#! nix-shell -I nixpkgs=https://github.com/NixOS/nixpkgs/archive/nixos-20.03.tar.gz
|
||||||
|
|
||||||
import Network.Curl.Download
|
import Network.Curl.Download
|
||||||
|
|
|
@ -23,7 +23,7 @@ produce the same NAR archive. For instance, directory entries are
|
||||||
always sorted so that the actual on-disk order doesn’t influence the
|
always sorted so that the actual on-disk order doesn’t influence the
|
||||||
result. This means that the cryptographic hash of a NAR dump of a
|
result. This means that the cryptographic hash of a NAR dump of a
|
||||||
path is usable as a fingerprint of the contents of the path. Indeed,
|
path is usable as a fingerprint of the contents of the path. Indeed,
|
||||||
the hashes of store paths stored in Nix’s database (see `nix-store -q
|
the hashes of store paths stored in Nix’s database (see `nix-store --query
|
||||||
--hash`) are SHA-256 hashes of the NAR dump of each store path.
|
--hash`) are SHA-256 hashes of the NAR dump of each store path.
|
||||||
|
|
||||||
NAR archives support filenames of unlimited length and 64-bit file
|
NAR archives support filenames of unlimited length and 64-bit file
|
||||||
|
|
|
@ -31,7 +31,7 @@ To copy a whole closure, do something
|
||||||
like:
|
like:
|
||||||
|
|
||||||
```console
|
```console
|
||||||
$ nix-store --export $(nix-store -qR paths) > out
|
$ nix-store --export $(nix-store --query --requisites paths) > out
|
||||||
```
|
```
|
||||||
|
|
||||||
To import the whole closure again, run:
|
To import the whole closure again, run:
|
||||||
|
|
|
@ -11,7 +11,7 @@ The following options are allowed for all `nix-store` operations, but may not al
|
||||||
be created in `/nix/var/nix/gcroots/auto/`. For instance,
|
be created in `/nix/var/nix/gcroots/auto/`. For instance,
|
||||||
|
|
||||||
```console
|
```console
|
||||||
$ nix-store --add-root /home/eelco/bla/result -r ...
|
$ nix-store --add-root /home/eelco/bla/result --realise ...
|
||||||
|
|
||||||
$ ls -l /nix/var/nix/gcroots/auto
|
$ ls -l /nix/var/nix/gcroots/auto
|
||||||
lrwxrwxrwx 1 ... 2005-03-13 21:10 dn54lcypm8f8... -> /home/eelco/bla/result
|
lrwxrwxrwx 1 ... 2005-03-13 21:10 dn54lcypm8f8... -> /home/eelco/bla/result
|
||||||
|
|
|
@ -145,7 +145,7 @@ Print the closure (runtime dependencies) of the `svn` program in the
|
||||||
current user environment:
|
current user environment:
|
||||||
|
|
||||||
```console
|
```console
|
||||||
$ nix-store -qR $(which svn)
|
$ nix-store --query --requisites $(which svn)
|
||||||
/nix/store/5mbglq5ldqld8sj57273aljwkfvj22mc-subversion-1.1.4
|
/nix/store/5mbglq5ldqld8sj57273aljwkfvj22mc-subversion-1.1.4
|
||||||
/nix/store/9lz9yc6zgmc0vlqmn2ipcpkjlmbi51vv-glibc-2.3.4
|
/nix/store/9lz9yc6zgmc0vlqmn2ipcpkjlmbi51vv-glibc-2.3.4
|
||||||
...
|
...
|
||||||
|
@ -154,7 +154,7 @@ $ nix-store -qR $(which svn)
|
||||||
Print the build-time dependencies of `svn`:
|
Print the build-time dependencies of `svn`:
|
||||||
|
|
||||||
```console
|
```console
|
||||||
$ nix-store -qR $(nix-store -qd $(which svn))
|
$ nix-store --query --requisites $(nix-store --query --deriver $(which svn))
|
||||||
/nix/store/02iizgn86m42q905rddvg4ja975bk2i4-grep-2.5.1.tar.bz2.drv
|
/nix/store/02iizgn86m42q905rddvg4ja975bk2i4-grep-2.5.1.tar.bz2.drv
|
||||||
/nix/store/07a2bzxmzwz5hp58nf03pahrv2ygwgs3-gcc-wrapper.sh
|
/nix/store/07a2bzxmzwz5hp58nf03pahrv2ygwgs3-gcc-wrapper.sh
|
||||||
/nix/store/0ma7c9wsbaxahwwl04gbw3fcd806ski4-glibc-2.3.4.drv
|
/nix/store/0ma7c9wsbaxahwwl04gbw3fcd806ski4-glibc-2.3.4.drv
|
||||||
|
@ -168,7 +168,7 @@ the derivation (`-qd`), not the closure of the output path that contains
|
||||||
Show the build-time dependencies as a tree:
|
Show the build-time dependencies as a tree:
|
||||||
|
|
||||||
```console
|
```console
|
||||||
$ nix-store -q --tree $(nix-store -qd $(which svn))
|
$ nix-store --query --tree $(nix-store --query --deriver $(which svn))
|
||||||
/nix/store/7i5082kfb6yjbqdbiwdhhza0am2xvh6c-subversion-1.1.4.drv
|
/nix/store/7i5082kfb6yjbqdbiwdhhza0am2xvh6c-subversion-1.1.4.drv
|
||||||
+---/nix/store/d8afh10z72n8l1cr5w42366abiblgn54-builder.sh
|
+---/nix/store/d8afh10z72n8l1cr5w42366abiblgn54-builder.sh
|
||||||
+---/nix/store/fmzxmpjx2lh849ph0l36snfj9zdibw67-bash-3.0.drv
|
+---/nix/store/fmzxmpjx2lh849ph0l36snfj9zdibw67-bash-3.0.drv
|
||||||
|
@ -180,7 +180,7 @@ $ nix-store -q --tree $(nix-store -qd $(which svn))
|
||||||
Show all paths that depend on the same OpenSSL library as `svn`:
|
Show all paths that depend on the same OpenSSL library as `svn`:
|
||||||
|
|
||||||
```console
|
```console
|
||||||
$ nix-store -q --referrers $(nix-store -q --binding openssl $(nix-store -qd $(which svn)))
|
$ nix-store --query --referrers $(nix-store --query --binding openssl $(nix-store --query --deriver $(which svn)))
|
||||||
/nix/store/23ny9l9wixx21632y2wi4p585qhva1q8-sylpheed-1.0.0
|
/nix/store/23ny9l9wixx21632y2wi4p585qhva1q8-sylpheed-1.0.0
|
||||||
/nix/store/5mbglq5ldqld8sj57273aljwkfvj22mc-subversion-1.1.4
|
/nix/store/5mbglq5ldqld8sj57273aljwkfvj22mc-subversion-1.1.4
|
||||||
/nix/store/dpmvp969yhdqs7lm2r1a3gng7pyq6vy4-subversion-1.1.3
|
/nix/store/dpmvp969yhdqs7lm2r1a3gng7pyq6vy4-subversion-1.1.3
|
||||||
|
@ -191,7 +191,7 @@ Show all paths that directly or indirectly depend on the Glibc (C
|
||||||
library) used by `svn`:
|
library) used by `svn`:
|
||||||
|
|
||||||
```console
|
```console
|
||||||
$ nix-store -q --referrers-closure $(ldd $(which svn) | grep /libc.so | awk '{print $3}')
|
$ nix-store --query --referrers-closure $(ldd $(which svn) | grep /libc.so | awk '{print $3}')
|
||||||
/nix/store/034a6h4vpz9kds5r6kzb9lhh81mscw43-libgnomeprintui-2.8.2
|
/nix/store/034a6h4vpz9kds5r6kzb9lhh81mscw43-libgnomeprintui-2.8.2
|
||||||
/nix/store/15l3yi0d45prm7a82pcrknxdh6nzmxza-gawk-3.1.4
|
/nix/store/15l3yi0d45prm7a82pcrknxdh6nzmxza-gawk-3.1.4
|
||||||
...
|
...
|
||||||
|
@ -204,7 +204,7 @@ Make a picture of the runtime dependency graph of the current user
|
||||||
environment:
|
environment:
|
||||||
|
|
||||||
```console
|
```console
|
||||||
$ nix-store -q --graph ~/.nix-profile | dot -Tps > graph.ps
|
$ nix-store --query --graph ~/.nix-profile | dot -Tps > graph.ps
|
||||||
$ gv graph.ps
|
$ gv graph.ps
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -212,7 +212,7 @@ Show every garbage collector root that points to a store path that
|
||||||
depends on `svn`:
|
depends on `svn`:
|
||||||
|
|
||||||
```console
|
```console
|
||||||
$ nix-store -q --roots $(which svn)
|
$ nix-store --query --roots $(which svn)
|
||||||
/nix/var/nix/profiles/default-81-link
|
/nix/var/nix/profiles/default-81-link
|
||||||
/nix/var/nix/profiles/default-82-link
|
/nix/var/nix/profiles/default-82-link
|
||||||
/home/eelco/.local/state/nix/profiles/profile-97-link
|
/home/eelco/.local/state/nix/profiles/profile-97-link
|
||||||
|
|
|
@ -27,7 +27,7 @@ substitute, then the log is unavailable.
|
||||||
# Example
|
# Example
|
||||||
|
|
||||||
```console
|
```console
|
||||||
$ nix-store -l $(which ktorrent)
|
$ nix-store --read-log $(which ktorrent)
|
||||||
building /nix/store/dhc73pvzpnzxhdgpimsd9sw39di66ph1-ktorrent-2.2.1
|
building /nix/store/dhc73pvzpnzxhdgpimsd9sw39di66ph1-ktorrent-2.2.1
|
||||||
unpacking sources
|
unpacking sources
|
||||||
unpacking source archive /nix/store/p8n1jpqs27mgkjw07pb5269717nzf5f8-ktorrent-2.2.1.tar.gz
|
unpacking source archive /nix/store/p8n1jpqs27mgkjw07pb5269717nzf5f8-ktorrent-2.2.1.tar.gz
|
||||||
|
|
|
@ -99,7 +99,7 @@ This operation is typically used to build [store derivation]s produced by
|
||||||
[store derivation]: @docroot@/glossary.md#gloss-store-derivation
|
[store derivation]: @docroot@/glossary.md#gloss-store-derivation
|
||||||
|
|
||||||
```console
|
```console
|
||||||
$ nix-store -r $(nix-instantiate ./test.nix)
|
$ nix-store --realise $(nix-instantiate ./test.nix)
|
||||||
/nix/store/31axcgrlbfsxzmfff1gyj1bf62hvkby2-aterm-2.3.1
|
/nix/store/31axcgrlbfsxzmfff1gyj1bf62hvkby2-aterm-2.3.1
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -108,7 +108,7 @@ This is essentially what [`nix-build`](@docroot@/command-ref/nix-build.md) does.
|
||||||
To test whether a previously-built derivation is deterministic:
|
To test whether a previously-built derivation is deterministic:
|
||||||
|
|
||||||
```console
|
```console
|
||||||
$ nix-build '<nixpkgs>' -A hello --check -K
|
$ nix-build '<nixpkgs>' --attr hello --check -K
|
||||||
```
|
```
|
||||||
|
|
||||||
Use [`nix-store --read-log`](./read-log.md) to show the stderr and stdout of a build:
|
Use [`nix-store --read-log`](./read-log.md) to show the stderr and stdout of a build:
|
||||||
|
|
|
@ -24,6 +24,6 @@ path has changed, and 1 otherwise.
|
||||||
To verify the integrity of the `svn` command and all its dependencies:
|
To verify the integrity of the `svn` command and all its dependencies:
|
||||||
|
|
||||||
```console
|
```console
|
||||||
$ nix-store --verify-path $(nix-store -qR $(which svn))
|
$ nix-store --verify-path $(nix-store --query --requisites $(which svn))
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
|
@ -162,11 +162,11 @@ Most Nix commands accept the following command-line options:
|
||||||
}: ...
|
}: ...
|
||||||
```
|
```
|
||||||
|
|
||||||
So if you call this Nix expression (e.g., when you do `nix-env -iA
|
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
|
pkgname`), the function will be called automatically using the
|
||||||
value [`builtins.currentSystem`](@docroot@/language/builtins.md) for
|
value [`builtins.currentSystem`](@docroot@/language/builtins.md) for
|
||||||
the `system` argument. You can override this using `--arg`, e.g.,
|
the `system` argument. You can override this using `--arg`, e.g.,
|
||||||
`nix-env -iA pkgname --arg system \"i686-freebsd\"`. (Note that
|
`nix-env --install --attr pkgname --arg system \"i686-freebsd\"`. (Note that
|
||||||
since the argument is a Nix string literal, you have to escape the
|
since the argument is a Nix string literal, you have to escape the
|
||||||
quotes.)
|
quotes.)
|
||||||
|
|
||||||
|
@ -199,7 +199,7 @@ Most Nix commands accept the following command-line options:
|
||||||
For `nix-shell`, this option is commonly used to give you a shell in
|
For `nix-shell`, this option is commonly used to give you a shell in
|
||||||
which you can build the packages returned by the expression. If you
|
which you can build the packages returned by the expression. If you
|
||||||
want to get a shell which contain the *built* packages ready for
|
want to get a shell which contain the *built* packages ready for
|
||||||
use, give your expression to the `nix-shell -p` convenience flag
|
use, give your expression to the `nix-shell --packages ` convenience flag
|
||||||
instead.
|
instead.
|
||||||
|
|
||||||
- <span id="opt-I">[`-I`](#opt-I)</span> *path*\
|
- <span id="opt-I">[`-I`](#opt-I)</span> *path*\
|
||||||
|
|
|
@ -77,7 +77,7 @@ $ nix-shell
|
||||||
To get a shell with one of the other [supported compilation environments](#compilation-environments):
|
To get a shell with one of the other [supported compilation environments](#compilation-environments):
|
||||||
|
|
||||||
```console
|
```console
|
||||||
$ nix-shell -A devShells.x86_64-linux.native-clang11StdenvPackages
|
$ nix-shell --attr devShells.x86_64-linux.native-clang11StdenvPackages
|
||||||
```
|
```
|
||||||
|
|
||||||
> **Note**
|
> **Note**
|
||||||
|
@ -139,7 +139,7 @@ $ nix build .#packages.aarch64-linux.default
|
||||||
for flake-enabled Nix, or
|
for flake-enabled Nix, or
|
||||||
|
|
||||||
```console
|
```console
|
||||||
$ nix-build -A packages.aarch64-linux.default
|
$ nix-build --attr packages.aarch64-linux.default
|
||||||
```
|
```
|
||||||
|
|
||||||
for classic Nix.
|
for classic Nix.
|
||||||
|
@ -166,7 +166,7 @@ $ nix build .#nix-ccacheStdenv
|
||||||
for flake-enabled Nix, or
|
for flake-enabled Nix, or
|
||||||
|
|
||||||
```console
|
```console
|
||||||
$ nix-build -A nix-ccacheStdenv
|
$ nix-build --attr nix-ccacheStdenv
|
||||||
```
|
```
|
||||||
|
|
||||||
for classic Nix.
|
for classic Nix.
|
||||||
|
|
|
@ -163,7 +163,7 @@
|
||||||
build-time dependencies, while the closure of its output path is
|
build-time dependencies, while the closure of its output path is
|
||||||
equivalent to its runtime dependencies. For correct deployment it
|
equivalent to its runtime dependencies. For correct deployment it
|
||||||
is necessary to deploy whole closures, since otherwise at runtime
|
is necessary to deploy whole closures, since otherwise at runtime
|
||||||
files could be missing. The command `nix-store -qR` prints out
|
files could be missing. The command `nix-store --query --requisites ` prints out
|
||||||
closures of store paths.
|
closures of store paths.
|
||||||
|
|
||||||
As an example, if the [store object] at path `P` contains a [reference]
|
As an example, if the [store object] at path `P` contains a [reference]
|
||||||
|
|
|
@ -2,13 +2,13 @@
|
||||||
|
|
||||||
Multi-user Nix users on macOS can upgrade Nix by running: `sudo -i sh -c
|
Multi-user Nix users on macOS can upgrade Nix by running: `sudo -i sh -c
|
||||||
'nix-channel --update &&
|
'nix-channel --update &&
|
||||||
nix-env -iA nixpkgs.nix &&
|
nix-env --install --attr nixpkgs.nix &&
|
||||||
launchctl remove org.nixos.nix-daemon &&
|
launchctl remove org.nixos.nix-daemon &&
|
||||||
launchctl load /Library/LaunchDaemons/org.nixos.nix-daemon.plist'`
|
launchctl load /Library/LaunchDaemons/org.nixos.nix-daemon.plist'`
|
||||||
|
|
||||||
Single-user installations of Nix should run this: `nix-channel --update;
|
Single-user installations of Nix should run this: `nix-channel --update;
|
||||||
nix-env -iA nixpkgs.nix nixpkgs.cacert`
|
nix-env --install --attr nixpkgs.nix nixpkgs.cacert`
|
||||||
|
|
||||||
Multi-user Nix users on Linux should run this with sudo: `nix-channel
|
Multi-user Nix users on Linux should run this with sudo: `nix-channel
|
||||||
--update; nix-env -iA nixpkgs.nix nixpkgs.cacert; systemctl
|
--update; nix-env --install --attr nixpkgs.nix nixpkgs.cacert; systemctl
|
||||||
daemon-reload; systemctl restart nix-daemon`
|
daemon-reload; systemctl restart nix-daemon`
|
||||||
|
|
|
@ -76,7 +76,7 @@ there after an upgrade. This means that you can _roll back_ to the
|
||||||
old version:
|
old version:
|
||||||
|
|
||||||
```console
|
```console
|
||||||
$ nix-env --upgrade -A nixpkgs.some-package
|
$ nix-env --upgrade --attr nixpkgs.some-package
|
||||||
$ nix-env --rollback
|
$ nix-env --rollback
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -122,7 +122,7 @@ Nix expressions generally describe how to build a package from
|
||||||
source, so an installation action like
|
source, so an installation action like
|
||||||
|
|
||||||
```console
|
```console
|
||||||
$ nix-env --install -A nixpkgs.firefox
|
$ nix-env --install --attr nixpkgs.firefox
|
||||||
```
|
```
|
||||||
|
|
||||||
_could_ cause quite a bit of build activity, as not only Firefox but
|
_could_ cause quite a bit of build activity, as not only Firefox but
|
||||||
|
@ -158,7 +158,7 @@ Pan newsreader, as described by [its
|
||||||
Nix expression](https://github.com/NixOS/nixpkgs/blob/master/pkgs/applications/networking/newsreaders/pan/default.nix):
|
Nix expression](https://github.com/NixOS/nixpkgs/blob/master/pkgs/applications/networking/newsreaders/pan/default.nix):
|
||||||
|
|
||||||
```console
|
```console
|
||||||
$ nix-shell '<nixpkgs>' -A pan
|
$ nix-shell '<nixpkgs>' --attr pan
|
||||||
```
|
```
|
||||||
|
|
||||||
You’re then dropped into a shell where you can edit, build and test
|
You’re then dropped into a shell where you can edit, build and test
|
||||||
|
|
|
@ -47,7 +47,7 @@ $ nix-channel --update
|
||||||
You can view the set of available packages in Nixpkgs:
|
You can view the set of available packages in Nixpkgs:
|
||||||
|
|
||||||
```console
|
```console
|
||||||
$ nix-env -qaP
|
$ nix-env --query --available --attr-path
|
||||||
nixpkgs.aterm aterm-2.2
|
nixpkgs.aterm aterm-2.2
|
||||||
nixpkgs.bash bash-3.0
|
nixpkgs.bash bash-3.0
|
||||||
nixpkgs.binutils binutils-2.15
|
nixpkgs.binutils binutils-2.15
|
||||||
|
@ -65,7 +65,7 @@ If you downloaded Nixpkgs yourself, or if you checked it out from GitHub,
|
||||||
then you need to pass the path to your Nixpkgs tree using the `-f` flag:
|
then you need to pass the path to your Nixpkgs tree using the `-f` flag:
|
||||||
|
|
||||||
```console
|
```console
|
||||||
$ nix-env -qaPf /path/to/nixpkgs
|
$ nix-env --query --available --attr-path --file /path/to/nixpkgs
|
||||||
aterm aterm-2.2
|
aterm aterm-2.2
|
||||||
bash bash-3.0
|
bash bash-3.0
|
||||||
…
|
…
|
||||||
|
@ -77,7 +77,7 @@ Nixpkgs.
|
||||||
You can filter the packages by name:
|
You can filter the packages by name:
|
||||||
|
|
||||||
```console
|
```console
|
||||||
$ nix-env -qaP firefox
|
$ nix-env --query --available --attr-path firefox
|
||||||
nixpkgs.firefox-esr firefox-91.3.0esr
|
nixpkgs.firefox-esr firefox-91.3.0esr
|
||||||
nixpkgs.firefox firefox-94.0.1
|
nixpkgs.firefox firefox-94.0.1
|
||||||
```
|
```
|
||||||
|
@ -85,7 +85,7 @@ nixpkgs.firefox firefox-94.0.1
|
||||||
and using regular expressions:
|
and using regular expressions:
|
||||||
|
|
||||||
```console
|
```console
|
||||||
$ nix-env -qaP 'firefox.*'
|
$ nix-env --query --available --attr-path 'firefox.*'
|
||||||
```
|
```
|
||||||
|
|
||||||
It is also possible to see the *status* of available packages, i.e.,
|
It is also possible to see the *status* of available packages, i.e.,
|
||||||
|
@ -93,7 +93,7 @@ whether they are installed into the user environment and/or present in
|
||||||
the system:
|
the system:
|
||||||
|
|
||||||
```console
|
```console
|
||||||
$ nix-env -qaPs
|
$ nix-env --query --available --attr-path --status
|
||||||
…
|
…
|
||||||
-PS nixpkgs.bash bash-3.0
|
-PS nixpkgs.bash bash-3.0
|
||||||
--S nixpkgs.binutils binutils-2.15
|
--S nixpkgs.binutils binutils-2.15
|
||||||
|
@ -110,10 +110,10 @@ which is Nix’s mechanism for doing binary deployment. It just means that
|
||||||
Nix knows that it can fetch a pre-built package from somewhere
|
Nix knows that it can fetch a pre-built package from somewhere
|
||||||
(typically a network server) instead of building it locally.
|
(typically a network server) instead of building it locally.
|
||||||
|
|
||||||
You can install a package using `nix-env -iA`. For instance,
|
You can install a package using `nix-env --install --attr `. For instance,
|
||||||
|
|
||||||
```console
|
```console
|
||||||
$ nix-env -iA nixpkgs.subversion
|
$ nix-env --install --attr nixpkgs.subversion
|
||||||
```
|
```
|
||||||
|
|
||||||
will install the package called `subversion` from `nixpkgs` channel (which is, of course, the
|
will install the package called `subversion` from `nixpkgs` channel (which is, of course, the
|
||||||
|
@ -143,14 +143,14 @@ instead of the attribute path, as `nix-env` does not record which attribute
|
||||||
was used for installing:
|
was used for installing:
|
||||||
|
|
||||||
```console
|
```console
|
||||||
$ nix-env -e subversion
|
$ nix-env --uninstall subversion
|
||||||
```
|
```
|
||||||
|
|
||||||
Upgrading to a new version is just as easy. If you have a new release of
|
Upgrading to a new version is just as easy. If you have a new release of
|
||||||
Nix Packages, you can do:
|
Nix Packages, you can do:
|
||||||
|
|
||||||
```console
|
```console
|
||||||
$ nix-env -uA nixpkgs.subversion
|
$ nix-env --upgrade --attr nixpkgs.subversion
|
||||||
```
|
```
|
||||||
|
|
||||||
This will *only* upgrade Subversion if there is a “newer” version in the
|
This will *only* upgrade Subversion if there is a “newer” version in the
|
||||||
|
@ -163,15 +163,15 @@ whatever version is in the Nix expressions, use `-i` instead of `-u`;
|
||||||
You can also upgrade all packages for which there are newer versions:
|
You can also upgrade all packages for which there are newer versions:
|
||||||
|
|
||||||
```console
|
```console
|
||||||
$ nix-env -u
|
$ nix-env --upgrade
|
||||||
```
|
```
|
||||||
|
|
||||||
Sometimes it’s useful to be able to ask what `nix-env` would do, without
|
Sometimes it’s useful to be able to ask what `nix-env` would do, without
|
||||||
actually doing it. For instance, to find out what packages would be
|
actually doing it. For instance, to find out what packages would be
|
||||||
upgraded by `nix-env -u`, you can do
|
upgraded by `nix-env --upgrade `, you can do
|
||||||
|
|
||||||
```console
|
```console
|
||||||
$ nix-env -u --dry-run
|
$ nix-env --upgrade --dry-run
|
||||||
(dry run; not doing anything)
|
(dry run; not doing anything)
|
||||||
upgrading `libxslt-1.1.0' to `libxslt-1.1.10'
|
upgrading `libxslt-1.1.0' to `libxslt-1.1.10'
|
||||||
upgrading `graphviz-1.10' to `graphviz-1.12'
|
upgrading `graphviz-1.10' to `graphviz-1.12'
|
||||||
|
|
|
@ -9,7 +9,7 @@ The daemon that handles binary cache requests via HTTP, `nix-serve`, is
|
||||||
not part of the Nix distribution, but you can install it from Nixpkgs:
|
not part of the Nix distribution, but you can install it from Nixpkgs:
|
||||||
|
|
||||||
```console
|
```console
|
||||||
$ nix-env -iA nixpkgs.nix-serve
|
$ nix-env --install --attr nixpkgs.nix-serve
|
||||||
```
|
```
|
||||||
|
|
||||||
You can then start the server, listening for HTTP connections on
|
You can then start the server, listening for HTTP connections on
|
||||||
|
@ -35,7 +35,7 @@ On the client side, you can tell Nix to use your binary cache using
|
||||||
`--substituters`, e.g.:
|
`--substituters`, e.g.:
|
||||||
|
|
||||||
```console
|
```console
|
||||||
$ nix-env -iA nixpkgs.firefox --substituters http://avalon:8080/
|
$ nix-env --install --attr nixpkgs.firefox --substituters http://avalon:8080/
|
||||||
```
|
```
|
||||||
|
|
||||||
The option `substituters` tells Nix to use this binary cache in
|
The option `substituters` tells Nix to use this binary cache in
|
||||||
|
|
|
@ -43,7 +43,7 @@ operations (via the symlink `~/.nix-defexpr/channels`). Consequently,
|
||||||
you can then say
|
you can then say
|
||||||
|
|
||||||
```console
|
```console
|
||||||
$ nix-env -u
|
$ nix-env --upgrade
|
||||||
```
|
```
|
||||||
|
|
||||||
to upgrade all packages in your profile to the latest versions available
|
to upgrade all packages in your profile to the latest versions available
|
||||||
|
|
|
@ -15,7 +15,7 @@ With `nix-store
|
||||||
path (that is, the path and all its dependencies) to a file, and then
|
path (that is, the path and all its dependencies) to a file, and then
|
||||||
unpack that file into another Nix store. For example,
|
unpack that file into another Nix store. For example,
|
||||||
|
|
||||||
$ nix-store --export $(nix-store -qR $(type -p firefox)) > firefox.closure
|
$ nix-store --export $(nix-store --query --requisites $(type -p firefox)) > firefox.closure
|
||||||
|
|
||||||
writes the closure of Firefox to a file. You can then copy this file to
|
writes the closure of Firefox to a file. You can then copy this file to
|
||||||
another machine and install the closure:
|
another machine and install the closure:
|
||||||
|
@ -27,7 +27,7 @@ store are ignored. It is also possible to pipe the export into another
|
||||||
command, e.g. to copy and install a closure directly to/on another
|
command, e.g. to copy and install a closure directly to/on another
|
||||||
machine:
|
machine:
|
||||||
|
|
||||||
$ nix-store --export $(nix-store -qR $(type -p firefox)) | bzip2 | \
|
$ nix-store --export $(nix-store --query --requisites $(type -p firefox)) | bzip2 | \
|
||||||
ssh alice@itchy.example.org "bunzip2 | nix-store --import"
|
ssh alice@itchy.example.org "bunzip2 | nix-store --import"
|
||||||
|
|
||||||
However, `nix-copy-closure` is generally more efficient because it only
|
However, `nix-copy-closure` is generally more efficient because it only
|
||||||
|
|
|
@ -39,7 +39,7 @@ just Subversion 1.1.2 (arrows in the figure indicate symlinks). This
|
||||||
would be what we would obtain if we had done
|
would be what we would obtain if we had done
|
||||||
|
|
||||||
```console
|
```console
|
||||||
$ nix-env -iA nixpkgs.subversion
|
$ nix-env --install --attr nixpkgs.subversion
|
||||||
```
|
```
|
||||||
|
|
||||||
on a set of Nix expressions that contained Subversion 1.1.2.
|
on a set of Nix expressions that contained Subversion 1.1.2.
|
||||||
|
@ -54,7 +54,7 @@ environment is generated based on the current one. For instance,
|
||||||
generation 43 was created from generation 42 when we did
|
generation 43 was created from generation 42 when we did
|
||||||
|
|
||||||
```console
|
```console
|
||||||
$ nix-env -iA nixpkgs.subversion nixpkgs.firefox
|
$ nix-env --install --attr nixpkgs.subversion nixpkgs.firefox
|
||||||
```
|
```
|
||||||
|
|
||||||
on a set of Nix expressions that contained Firefox and a new version of
|
on a set of Nix expressions that contained Firefox and a new version of
|
||||||
|
@ -127,7 +127,7 @@ All `nix-env` operations work on the profile pointed to by
|
||||||
(abbreviation `-p`):
|
(abbreviation `-p`):
|
||||||
|
|
||||||
```console
|
```console
|
||||||
$ nix-env -p /nix/var/nix/profiles/other-profile -iA nixpkgs.subversion
|
$ nix-env --profile /nix/var/nix/profiles/other-profile --install --attr nixpkgs.subversion
|
||||||
```
|
```
|
||||||
|
|
||||||
This will *not* change the `~/.nix-profile` symlink.
|
This will *not* change the `~/.nix-profile` symlink.
|
||||||
|
|
|
@ -6,7 +6,7 @@ automatically fetching any store paths in Firefox’s closure if they are
|
||||||
available on the server `avalon`:
|
available on the server `avalon`:
|
||||||
|
|
||||||
```console
|
```console
|
||||||
$ nix-env -iA nixpkgs.firefox --substituters ssh://alice@avalon
|
$ nix-env --install --attr nixpkgs.firefox --substituters ssh://alice@avalon
|
||||||
```
|
```
|
||||||
|
|
||||||
This works similar to the binary cache substituter that Nix usually
|
This works similar to the binary cache substituter that Nix usually
|
||||||
|
@ -25,7 +25,7 @@ You can also copy the closure of some store path, without installing it
|
||||||
into your profile, e.g.
|
into your profile, e.g.
|
||||||
|
|
||||||
```console
|
```console
|
||||||
$ nix-store -r /nix/store/m85bxg…-firefox-34.0.5 --substituters
|
$ nix-store --realise /nix/store/m85bxg…-firefox-34.0.5 --substituters
|
||||||
ssh://alice@avalon
|
ssh://alice@avalon
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue