nix3-develop(1)
π nix develop β the build-environment bestie π
β οΈ Warning β οΈ okay so real talk β this program is experimental and its interface is subject to change. Like, it might change on you. Not in a cute way. Just so you know, bestie. π«Ά
Welcome to nix3-develop(1) from the General Commands Manual β aka the glow-up guide to nix develop, the command that hands you a whole bash shell with a derivation's build environment already set up. Iconic behaviour, honestly.
β¨ Name β¨
nix develop β run a bash shell that provides the build environment of a derivation. That's it, that's the whole vibe. π
πΈ Synopsis πΈ
nix develop [optionβ¦] installable
π Examples π
- Start a shell with the build environment of the default package of the flake in the current directory:
# 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
- Run a particular build phase directly:
# nix develop --unpack
# nix develop --configure
# nix develop --build
# nix develop --check
# nix develop --install
# nix develop --installcheck
- Start a shell with the build environment of GNU Hello:
# nix develop nixpkgs#hello
- Record a build environment in a profile:
# nix develop --profile /tmp/my-build-env nixpkgs#hello
- Use a build environment previously recorded in a profile:
# nix develop /tmp/my-build-env
- Replace all occurrences of the store path corresponding to
glibc.devwith a writable directory:
# nix develop --redirect nixpkgs#glibc.dev ~/my-glibc/outputs/dev
π‘ Note that this is useful if you're running anix developshell fornixpkgs#glibcin~/my-glibcand want to compile another package against it.
- Run a series of script commands:
# 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. It's giving "your own personal build room". π
Nix figures out 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. Yes bestie, you can make your prompt cute. π
π Flake output attributes π
If no flake output attribute is given, nix develop tries the following flake output attributes:
devShells.<system>.defaultpackages.<system>.default
If a flake output name is given, nix develop tries the following flake output attributes:
devShells.<system>.<name>packages.<system>.<name>legacyPackages.<system>.<name>
β¨ Options β¨
--buildβ Run the build phase.--checkβ Run the check phase.--command,-ccommand args β Instead of starting an interactive shell, start the specified command and arguments.--configureβ Run the configure phase.--installβ Run the install phase.--installcheckβ Run the installcheck phase.--phasephase-name β The stdenv phase to run (e.g.buildorconfigure).--profilepath β The profile to operate on.--redirectinstallable outputs-dir β Redirect a store path to a mutable location.--unpackβ Run the unpack phase.
π Common evaluation options π
--argname expr β Pass the value expr as the argument name to Nix functions.--arg-from-filename path β Pass the contents of file path as the argument name to Nix functions.--arg-from-stdinname β Pass the contents of stdin as the argument name to Nix functions.--argstrname string β Pass the string string as the argument name to Nix functions.--debuggerβ Start an interactive environment if evaluation fails. (Fails? debugger. Slay.)--eval-storestore-url β The URL of the Nix store to use for evaluation, i.e. to store derivations (.drvfiles) and inputs referenced by them.--impureβ Allow access to mutable paths and repositories.--include,-Ipath β 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-flakeoriginal-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-fromflake-url β Use the inputs of the specified flake as registry entries.--no-registriesβ Don't allow lookups in the flake registries.
π DEPRECATED β Use --no-use-registries instead.
--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.--output-lock-fileflake-lock-path β Write the given lock file instead offlake.lockwithin the top-level flake.--override-inputinput-path flake-url β Override a specific flake input (e.g.dwarffs/nixpkgs). The input path must not be empty. This implies--no-write-lock-file.--recreate-lock-fileβ Recreate the flake's lock file from scratch.
π DEPRECATED β Use nix flake update instead.
--reference-lock-fileflake-lock-path β Read the given lock file instead offlake.lockwithin the top-level flake.--update-inputinput-path β Update a specific flake input (ignoring its previous entry in the lock file).
π DEPRECATED β Use nix flake update instead.
π Logging-related options π
--debugβ Set the logging verbosity level to 'debug'.--log-formatformat β Set the format of log output; one ofraw,internal-json,barorbar-with-logs.--print-build-logs,-Lβ Print full build logs on standard error.--quietβ Decrease the logging verbosity level.--verbose,-vβ Increase the logging verbosity level.
β Miscellaneous global options β
--helpβ Show usage information.--offlineβ Disable substituters and consider all previously downloaded files up-to-date.--optionname value β Set the Nix configuration setting name to value (overridingnix.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,-kname β Keep the environment variable name, when using--ignore-env.--set-env-var,-sname value β Sets an environment variable name with value.--unset-env-var,-uname β Unset the environment variable name.
π Options that change the interpretation of installables π
--exprexpr β Interpret installables as attribute paths relative to the Nix expression expr.--file,-ffile β 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.
and that's the whole page, bestie!! no cap, you now know nix develop better than half the internet π«Άβ¨
signing off from the General Commands Manual, entry nix3-develop(1) β mwah π
π¦ where this page comes from
- fedora 44: nix-core 2.35.3-2.fc44 Β· LGPL-2.1-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms