nix3-develop - Man Page

run a bash shell that provides the build environment of a derivation

Warning
This program is experimental and its interface is subject to change.

Synopsis

nix develop [option…] installable

Examples

# nix develop

Typical commands to run inside this shell are:

# configurePhase
# buildPhase
# installPhase

Alternatively, you can run whatever build tools your project uses directly, e.g. for a typical Unix project:

# ./configure --prefix=$out
# make
# make install
# nix develop --unpack
# nix develop --configure
# nix develop --build
# nix develop --check
# nix develop --install
# nix develop --installcheck
# nix develop nixpkgs#hello
# nix develop --profile /tmp/my-build-env nixpkgs#hello
# nix develop /tmp/my-build-env
# nix develop --redirect nixpkgs#glibc.dev ~/my-glibc/outputs/dev

Note that this is useful if you’re running a nix develop shell for nixpkgs#glibc in ~/my-glibc and want to compile another package against it.

# nix develop --command bash -c "mkdir build && cmake .. && make"

Description

nix develop starts a bash shell that provides an interactive build environment nearly identical to what Nix would use to build installable . Inside this shell, environment variables and shell functions are set up so that you can interactively and incrementally build your package.

Nix determines the build environment by building a modified version of the derivation installable that just records the environment initialised by stdenv and exits. This build environment can be recorded into a profile using --profile.

The prompt used by the bash shell can be customised by setting the bash-prompt, bash-prompt-prefix, and bash-prompt-suffix settings in nix.conf or in the flake’s nixConfig attribute.

Flake output attributes

If no flake output attribute is given, nix develop tries the following flake output attributes:

If a flake output name is given, nix develop tries the following flake output attributes:

Options

Common evaluation options

  • --arg name expr

    Pass the value expr as the argument name to Nix functions.

  • --arg-from-file name path

    Pass the contents of file path as the argument name to Nix functions.

  • --arg-from-stdin name

    Pass the contents of stdin as the argument name to Nix functions.

  • --argstr name string

    Pass the string string as the argument name to Nix functions.

  • --debugger

    Start an interactive environment if evaluation fails.

  • --eval-store store-url

    The URL of the Nix store to use for evaluation, i.e. to store derivations (.drv files) and inputs referenced by them.

  • --impure

    Allow access to mutable paths and repositories.

  • --include / -I path

    Add path to search path entries used to resolve lookup paths

    This option may be given multiple times.

    Paths added through -I take precedence over the nix-path configuration setting and the NIX_PATH environment variable .

  • --override-flake original-ref resolved-ref

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

Miscellaneous global options

  • --help

    Show usage information.

  • --offline

    Disable substituters and consider all previously downloaded files up-to-date.

  • --option name value

    Set the Nix configuration setting name to value (overriding nix.conf).

  • --refresh

    Consider all previously downloaded files out-of-date.

  • --repair

    During evaluation, rewrite missing or corrupted files in the Nix store. During building, rebuild missing or corrupted store paths.

  • --version

    Show version information.

Options that change environment variables

  • --ignore-env / -i

    Clear the entire environment, except for those specified with --keep-env-var.

  • --keep-env-var / -k name

    Keep the environment variable name, when using --ignore-env.

  • --set-env-var / -s name value

    Sets an environment variable name with value.

  • --unset-env-var / -u name

    Unset the environment variable name.

Options that change the interpretation of installables

  • --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. If file is the character -, then a Nix expression is read from standard input. Implies --impure.

    Note

    See man nix.conf for overriding configuration settings with command line flags.