nix-shell.2

provides ad-hoc development environments

TLDR

Quick package shell
$ nix-shell -p [package]
Shell with multiple packages
$ nix-shell -p [git] [curl] [jq]
Execute and exit
$ nix-shell -p [ripgrep] --run "rg pattern"
From expression
$ nix-shell -E "with import <nixpkgs> {}; mkShell { buildInputs = [hello]; }"

SYNOPSIS

nix-shell [options]

DESCRIPTION

nix-shell provides ad-hoc development environments. This is alternate documentation.The tool is essential for quick environment setup. No permanent changes.

PARAMETERS

-p PKG

Add package to shell.
--run CMD
Run command and exit.
-E EXPR
Evaluate expression.
--help
Display help information.

INSTALL

sudo apt install nix-bin
sudo dnf install nix
sudo pacman -S nix
sudo apk add nix
sudo zypper install nix
nix profile install nixpkgs#nix

CAVEATS

Downloads packages. Network required. Uses Nix store.

HISTORY

nix-shell is a foundational Nix tool for reproducible development environments.

SEE ALSO

nix-shell(1), nix-develop(1), nix(1)