Provided by: nix-bin_2.6.0+dfsg-3_amd64 bug

Name

       nix shell - run a shell in which the specified packages are available

Synopsis

       nix shell [option…] installables

Examples

       • Start a shell providing youtube-dl from the nixpkgs flake:

       # nix shell nixpkgs#youtube-dl
       # youtube-dl --version
       2020.11.01.1

       • Start a shell providing GNU Hello from NixOS 20.03:

       # nix shell nixpkgs/nixos-20.03#hello

       • Run GNU Hello:

       # nix shell nixpkgs#hello -c hello --greeting 'Hi everybody!'
       Hi everybody!

       • Run GNU Hello in a chroot store:

       # nix shell --store ~/my-nix nixpkgs#hello -c hello

       • Start a shell providing GNU Hello in a chroot store:

       # nix shell --store ~/my-nix nixpkgs#hello nixpkgs#bashInteractive -c bash

              Note  that  it’s  necessary  to  specify bash explicitly because your default shell
              (e.g. /bin/bash) generally will not exist in the chroot.

Description

       nix shell runs a command in an environment  in  which  the  $PATH  variable  provides  the
       specified  installables.  If  no command is specified, it starts the default shell of your
       user account specified by $SHELL.

Options

       • --command / -c command args
         Command and arguments to be executed, defaulting to $SHELL

       • --ignore-environment / -i
         Clear the entire environment (except those specified with --keep).

       • --keep / -k name
         Keep the environment variable name.

       • --unset / -u name
         Unset the environment variable name.

       Common evaluation options:

       • --arg name expr
         Pass the value expr as the argument name to Nix functions.

       • --argstr name string
         Pass the string string as the argument name to Nix functions.

       • --eval-store store-url
         The Nix store to use for evaluations.

       • --impure
         Allow access to mutable paths and repositories.

       • --include / -I path
         Add path to the list of locations used to look up <...> file names.

       • --override-flake original-ref resolved-ref
         Override the flake registries, redirecting original-ref to resolved-ref.

       Common flake-related options:

       • --commit-lock-file
         Commit changes to the flake’s lock file.

       • --inputs-from flake-url
         Use the inputs of the specified flake as registry entries.

       • --no-registries
         Don’t allow lookups in the flake registries. This option is  deprecated;  use  --no-use-
         registries.

       • --no-update-lock-file
         Do not allow any updates to the flake’s lock file.

       • --no-write-lock-file
         Do not write the flake’s newly generated lock file.

       • --override-input input-path flake-url
         Override  a  specific  flake input (e.g. dwarffs/nixpkgs). This implies --no-write-lock-
         file.

       • --recreate-lock-file
         Recreate the flake’s lock file from scratch.

       • --update-input input-path
         Update a specific flake input (ignoring its previous entry in the lock file).

       Options that change the interpretation of installables:

       • --derivation
         Operate on the store derivation rather than its outputs.

       • --expr expr
         Interpret installables as attribute paths relative to the Nix expression expr.

       • --file / -f file
         Interpret installables as attribute paths relative to the Nix expression stored in file.

                                                                                    nix3-shell(1)