LinuxCommandLibrary

nix

nix

TLDR

Enable the nix command

$ mkdir -p ~/.config/nix; echo 'experimental-features = nix-command flakes' > ~/.config/nix/nix.conf
copy


Search for a package in nixpkgs via its name or description
$ nix search nixpkgs [search_term]
copy


Start a shell with the specified packages from nixpkgs available
$ nix shell [nixpkgs#pkg1 nixpkgs#pkg2 nixpkgs#pkg3 ...]
copy


Install some packages from nixpkgs permanently
$ nix profile install [nixpkgs#pkg1 nixpkgs#pkg2 nixpkgs#pkg3 ...]
copy


Remove unused paths from Nix store to free up space
$ nix store gc
copy


Start an interactive environment for evaluating Nix expressions
$ nix repl
copy


Display help for a specific subcommand
$ nix help [subcommand]
copy

SYNOPSIS

nix <COMMAND> <FLAGS>... <ARGS>...

DESCRIPTION

Common flags:

--debug

enable debug output

--help

show usage information

--help-config

show configuration options

--option <NAME> <VALUE>

set a Nix configuration option (overriding nix.conf)

--quiet

decrease verbosity level

-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.

Available commands:

add-to-store

add a path to the Nix store

build

build a derivation or fetch a store path

cat-nar

print the contents of a file inside a NAR file

cat-store

print the contents of a store file on stdout

copy

copy paths between Nix stores

copy-sigs

copy path signatures from substituters (like binary caches)

dump-path

dump a store path to stdout (in NAR format)

edit

open the Nix expression of a Nix package in $EDITOR

eval

evaluate a Nix expression

hash-file

print cryptographic hash of a regular file

hash-path

print cryptographic hash of the NAR serialisation of a path

log

show the build log of the specified packages or paths, if available

ls-nar

show information about the contents of a NAR file

ls-store

show information about a store path

optimise-store

replace identical files in the store by hard links

path-info

query information about store paths

ping-store

test whether a store can be opened

repl

start an interactive environment for evaluating Nix expressions

run

run a shell in which the specified packages are available

search

query available packages

show-config

show the Nix configuration

show-derivation

show the contents of a store derivation

sign-paths

sign the specified paths

to-base16

convert a hash to base-16 representation

to-base32

convert a hash to base-32 representation

to-base64

convert a hash to base-64 representation

upgrade-nix

upgrade Nix to the latest stable version

verify

verify the integrity of store paths

why-depends

show why a package has another package in its closure

Note: this program is EXPERIMENTAL and subject to change.

Copied to clipboard