Nix command: Difference between revisions
imported>Mic92 |
imported>Mic92 No edit summary |
||
Line 19: | Line 19: | ||
In the following we describe all sub commands of nix: | In the following we describe all sub commands of nix: | ||
== Common flags == | |||
* <code>--debug</code> enable debug output | |||
* <code>--help</code> show usage information | |||
* <code>--help-config</code> show configuration options | |||
* <code>--log-format FORMAT</code> format of log output; "raw", "internal-json", "bar" or "bar-with-logs" | |||
* <code>--no-net</code> disable substituters and consider all previously downloaded files up-to-date | |||
* <code>--option NAME VALUE</code> set a Nix configuration option (overriding nix.conf) | |||
* <code>-L</code>, <code>--print-build-logs</code> print full build logs on stderr | |||
* <code>--quiet</code> decrease verbosity level | |||
* <code>--refresh</code> consider all previously downloaded files out-of-date | |||
* <code>-v</code>, </code>--verbose</code> increase verbosity level | |||
* <code>--version</code> show version information | |||
In addition, most configuration settings can be overriden using <code>--name value</code>. | |||
Boolean settings can be overriden using <code>--name</code> or <code>--no-name</code>. See <code>nix | |||
--help-config</code> for a list of configuration settings. | |||
== Main commands == | == Main commands == |
Revision as of 06:09, 7 August 2020
This article is about all nix subcommands. Its written for nix 2.4 or newer. Older nix versions might have different commands.
Enabling the nix command
In nix 2.4 the nix command must be enabled explicitly set experimental-features = nix-command
in ~/.config/nix/nix.conf
or system-wide in /etc/nix/nix.conf
.
In NixOS the latter one can be also achieved by using:
{ pkgs, ... }: {
nix.extraOptions = ''
experimental-features = nix-command
'';
# this is required until nix 2.4 is released
nix.package = pkgs.nixUnstable;
}
In the following we describe all sub commands of nix:
Common flags
--debug
enable debug output--help
show usage information--help-config
show configuration options--log-format FORMAT
format of log output; "raw", "internal-json", "bar" or "bar-with-logs"--no-net
disable substituters and consider all previously downloaded files up-to-date--option NAME VALUE
set a Nix configuration option (overriding nix.conf)-L
,--print-build-logs
print full build logs on stderr--quiet
decrease verbosity level--refresh
consider all previously downloaded files out-of-date-v
, --verbose increase verbosity level--version
show version information
In addition, most configuration settings can be overriden using --name value
.
Boolean settings can be overriden using --name
or --no-name
. See nix
--help-config
for a list of configuration settings.
Main commands
nix build
Build a derivation or fetch a store path.
nix develop
Run a bash shell that provides the build environment of a derivation.
nix flake
Manage Nix flakes.
nix profile
Manage Nix profiles.
nix repl
Start an interactive environment for evaluating Nix expressions.
nix run
Run a Nix application.
nix search
Query available packages.
nix shell
Run a shell in which the specified packages are available.
Infrequently used commands
nix copy
Copy paths between Nix stores.
nix edit
Open the Nix expression of a Nix package in $EDITOR.
nix eval
Evaluate a Nix expression.
nix log
Show the build log of the specified packages or paths, if available.
nix path-info
Query information about store paths.
nix registry
Manage the flake registry.
nix verify
Verify the integrity of store paths.
nix why-depends
Show why a package has another package in its closure.
Utility/scripting commands
nix add-to-store
Add a path to the Nix store.
nix cat-nar
Print the contents of a file inside a NAR file on stdout.
nix cat-store
Print the contents of a file in the Nix store on stdout.
nix copy-sigs
Copy path signatures from substituters (like binary caches).
nix dump-path
Dump a store path to stdout (in NAR format).
nix hash-file
Print cryptographic hash of the NAR serialisation of a path.
nix hash-path
Print cryptographic hash of the NAR serialisation of a path.
nix ls-nar
Show information about a path inside a NAR file.
nix ls-store
Show information about a path in the Nix store.
nix make-content-addressable
Rewrite a path or closure to content-addressable form.
nix optimize-store
Replace identical files in the store by hard links.
nix ping-store
Test whether a store can be opened.
nix print-dev-env
Print shell code that can be sourced by bash to reproduce the build environment of a derivation.
nix show-config
Show the Nix configuration.
nix show-derivation
Show the contents of a store derivation.
nix sign-paths
Sign the specified paths.
nix to-base16
Convert a hash to base-16 representation.
nix to-base32
Convert a hash to base-32 representation.
nix to-base64
Convert a hash to base-64 representation.
nix to-sri
Convert a hash to SRI representation.