Home Explore Blog CI



nix

1st chunk of `doc/manual/source/release-notes/rl-2.4.md`
8937fbb34123a4e90ef3c261cf096ffea82e066daa0dae790000000100000fa8
# Release 2.4 (2021-11-01)

This is the first release in more than two years and is the result of
more than 2800 commits from 195 contributors since release 2.3.

## Highlights

* Nix's **error messages** have been improved a lot. For instance,
  evaluation errors now point out the location of the error:

  ```
  $ nix build
  error: undefined variable 'bzip3'

         at /nix/store/449lv242z0zsgwv95a8124xi11sp419f-source/flake.nix:88:13:

             87|           [ curl
             88|             bzip3 xz brotli editline
               |             ^
             89|             openssl sqlite
  ```

* The **`nix` command** has seen a lot of work and is now almost at
  feature parity with the old command-line interface (the `nix-*`
  commands). It aims to be [more modern, consistent and pleasant to
  use](../development/cli-guideline.md) than the old CLI. It is still
  marked as experimental but its interface should not change much
  anymore in future releases.

* **Flakes** are a new format to package Nix-based projects in a more
  discoverable, composable, consistent and reproducible way. A flake
  is just a repository or tarball containing a file named `flake.nix`
  that specifies dependencies on other flakes and returns any Nix
  assets such as packages, Nixpkgs overlays, NixOS modules or CI
  tests. The new `nix` CLI is primarily based around flakes; for
  example, a command like `nix run nixpkgs#hello` runs the `hello`
  application from the `nixpkgs` flake.

  Flakes are currently marked as experimental. For an introduction,
  see [this blog
  post](https://www.tweag.io/blog/2020-05-25-flakes/). For detailed
  information about flake syntax and semantics, see the [`nix flake`
  manual page](../command-ref/new-cli/nix3-flake.md).

* Nix's store can now be **content-addressed**, meaning that the hash
  component of a store path is the hash of the path's
  contents. Previously Nix could only build **input-addressed** store
  paths, where the hash is computed from the derivation dependency
  graph. Content-addressing allows deduplication, early cutoff in
  build systems, and unprivileged closure copying. This is still [an
  experimental
  feature](https://discourse.nixos.org/t/content-addressed-nix-call-for-testers/12881).

* The Nix manual has been converted into Markdown, making it easier to
  contribute. In addition, every `nix` subcommand now has a manual
  page, documenting every option.

* A new setting that allows **experimental features** to be enabled
  selectively. This allows us to merge unstable features into Nix more
  quickly and do more frequent releases.

## Other features

* There are many new `nix` subcommands:

  - `nix develop` is intended to replace `nix-shell`. It has a number
    of new features:

    * It automatically sets the output environment variables (such as
      `$out`) to writable locations (such as `./outputs/out`).

    * It can store the environment in a profile. This is useful for
      offline work.

    * 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`

Title: Nix Release 2.4 Highlights and New Features
Summary
Nix Release 2.4 includes improved error messages, a revamped 'nix' command-line interface, the introduction of Flakes for packaging Nix-based projects, content-addressed Nix store, manual conversion to Markdown, and selective enabling of experimental features. New 'nix' subcommands like 'develop', 'print-dev-env', 'shell', and 'run' enhance development workflows.