LinuxCommandLibrary
GitHubF-DroidGoogle Play Store

nix

package manager CLI

TLDR

Search packages
$ nix search nixpkgs [package]
copy
Run package
$ nix run nixpkgs#[package]
copy
Build derivation
$ nix build
copy
Enter development shell
$ nix develop
copy
Show flake info
$ nix flake show
copy
Update flake
$ nix flake update
copy
Evaluate expression
$ nix eval --expr "[1 + 1]"
copy
Garbage collect unused store paths
$ nix store gc
copy
Install a package to profile
$ nix profile install nixpkgs#[package]
copy
Start an interactive Nix REPL
$ nix repl
copy
Start a temporary shell with a package
$ nix shell nixpkgs#[package]
copy

SYNOPSIS

nix [command] [options]

DESCRIPTION

nix is the unified Nix package manager CLI providing reproducible package management, builds, and development environments. It is the modern replacement for older commands like nix-env and nix-build.The tool uses flakes for reproducible project definitions with lock files. Flakes standardize how Nix projects declare dependencies and outputs.nix develop creates development shells with project dependencies. nix run builds and executes packages directly. nix shell provides a temporary shell with specified packages available.The Nix store holds all packages in isolation, enabling atomic upgrades and rollbacks. Garbage collection with nix store gc removes unused paths.

PARAMETERS

search flakeref query

Search packages in a flake.
run installable
Build and run a package.
build [installable]
Build a derivation or fetch a store path.
develop [installable]
Enter a development shell from a flake.
shell installable...
Run a shell with specified packages available.
flake subcommand
Manage Nix flakes (show, update, init, check, lock).
profile subcommand
Manage Nix profiles (install, remove, list, upgrade).
store subcommand
Manage the Nix store (gc, verify, repair, optimise).
repl
Start an interactive Nix expression evaluator.
eval installable
Evaluate a Nix expression.
--help
Display help information.
--version
Display version information.

CAVEATS

Steep learning curve. The Nix expression language is functional and unique. Many new-style nix commands are still marked as experimental and require enabling experimental features. Requires Nix daemon installation.

HISTORY

Nix was created by Eelco Dolstra as his PhD thesis project at Utrecht University, first released in 2003. The unified nix CLI was introduced in Nix 2.0.

SEE ALSO

Copied to clipboard
Kai