Home Explore Blog Models CI



nix

2nd chunk of `doc/manual/source/release-notes/rl-2.4.md`
64c6ccdf0cef34919ff3c584b35b4c510f544d4b32cb022b0000000100000fb2
    * It can run specific phases directly. For instance, `nix develop
      --build` runs `buildPhase`.

    - It allows dependencies in the Nix store to be "redirected" to
      arbitrary directories using the `--redirect` flag. This is
      useful if you want to hack on a package *and* some of its
      dependencies at the same time.

  - `nix print-dev-env` prints the environment variables and bash
    functions defined by a derivation. This is useful for users of
    other shells than bash (especially with `--json`).

  - `nix shell` was previously named `nix run` and is intended to
    replace `nix-shell -p`, but without the `stdenv` overhead. It
    simply starts a shell where some packages have been added to
    `$PATH`.

  - `nix run` (not to be confused with the old subcommand that has
    been renamed to `nix shell`) runs an "app", a flake output that
    specifies a command to run, or an eponymous program from a
    package. For example, `nix run nixpkgs#hello` runs the `hello`
    program from the `hello` package in `nixpkgs`.

  - `nix flake` is the container for flake-related operations, such as
    creating a new flake, querying the contents of a flake or updating
    flake lock files.

  - `nix registry` allows you to query and update the flake registry,
    which maps identifiers such as `nixpkgs` to concrete flake URLs.

  - `nix profile` is intended to replace `nix-env`. Its main advantage
    is that it keeps track of the provenance of installed packages
    (e.g. exactly which flake version a package came from). It also
    has some helpful subcommands:

    * `nix profile history` shows what packages were added, upgraded
      or removed between each version of a profile.

    * `nix profile diff-closures` shows the changes between the
      closures of each version of a profile. This allows you to
      discover the addition or removal of dependencies or size
      changes.

    **Warning**: after a profile has been updated using `nix profile`,
    it is no longer usable with `nix-env`.

  - `nix store diff-closures` shows the differences between the
    closures of two store paths in terms of the versions and sizes of
    dependencies in the closures.

  - `nix store make-content-addressable` rewrites an arbitrary closure
    to make it content-addressed. Such paths can be copied into other
    stores without requiring signatures.

  - `nix bundle` uses the [`nix-bundle`
    program](https://github.com/matthewbauer/nix-bundle) to convert a
    closure into a self-extracting executable.

  - Various other replacements for the old CLI, e.g. `nix store gc`,
    `nix store delete`, `nix store repair`, `nix nar dump-path`, `nix
    store prefetch-file`, `nix store prefetch-tarball`, `nix key` and
    `nix daemon`.

* Nix now has an **evaluation cache** for flake outputs. For example,
  a second invocation of the command `nix run nixpkgs#firefox` will
  not need to evaluate the `firefox` attribute because it's already in
  the evaluation cache. This is made possible by the hermetic
  evaluation model of flakes.

  Intermediate results are not cached.

* The new `--offline` flag disables substituters and causes all
  locally cached tarballs and repositories to be considered
  up-to-date.

* The new `--refresh` flag causes all locally cached tarballs and
  repositories to be considered out-of-date.

* Many `nix` subcommands now have a `--json` option to produce
  machine-readable output.

* `nix repl` has a new `:doc` command to show documentation about
  builtin functions (e.g. `:doc builtins.map`).

* Binary cache stores now have an option `index-debug-info` to create
  an index of DWARF debuginfo files for use by
  [`dwarffs`](https://github.com/edolstra/dwarffs).

* To support flakes, Nix now has an extensible mechanism for fetching
  source trees. Currently it has the following backends:

  * Git repositories

  * Mercurial repositories

  * GitHub and GitLab repositories (an optimisation for faster
    fetching than Git)

Title: Nix 2.4: Expanded CLI, Caching, and Source Fetching Enhancements
Summary
Nix 2.4 introduces many new `nix` subcommands and features. `nix develop` replaces `nix-shell`, offering advanced phase execution and dependency redirection. `nix print-dev-env` outputs environment variables, and `nix shell` (previously `nix run`) adds packages to `$PATH`. The new `nix run` executes 'apps' from flakes or packages, while `nix flake` and `nix registry` manage flake operations. `nix profile` replaces `nix-env`, providing provenance tracking, history, and diffs. Store commands include `diff-closures`, `make-content-addressable` for CA paths, and `nix bundle` for self-extracting executables, along with other CLI replacements. The release also features an evaluation cache for flake outputs, `--offline` and `--refresh` flags, `--json` output for many subcommands, a `:doc` command in `nix repl`, and `index-debug-info` for binary caches. Source fetching is enhanced with extensible backends for Git, Mercurial, GitHub, and GitLab.