Home Explore Blog CI



nix

3rd chunk of `doc/manual/source/release-notes/rl-2.4.md`
1773e1cea8ce3a37b555407af339fc54ee9a96d52beffd840000000100000fa0
  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)

  * Tarballs

  * Arbitrary directories

  The fetcher infrastructure is exposed via flake input specifications
  and via the `fetchTree` built-in.

* **Languages changes**: the only new language feature is that you can
  now have antiquotations in paths, e.g. `./${foo}` instead of `./. +
  foo`.

* **New built-in functions**:

  - `builtins.fetchTree` allows fetching a source tree using any
    backends supported by the fetcher infrastructure. It subsumes the
    functionality of existing built-ins like `fetchGit`,
    `fetchMercurial` and `fetchTarball`.

  - `builtins.getFlake` fetches a flake and returns its output
    attributes. This function should not be used inside flakes! Use
    flake inputs instead.

  - `builtins.floor` and `builtins.ceil` round a floating-point number
    down and up, respectively.

* Experimental support for recursive Nix. This means that Nix
  derivations can now call Nix to build other derivations. This is not
  in a stable state yet and not well
  [documented](https://github.com/NixOS/nix/commit/c4d7c76b641d82b2696fef73ce0ac160043c18da).

* The new experimental feature `no-url-literals` disables URL
  literals. This helps to implement [RFC
  45](https://github.com/NixOS/rfcs/pull/45).

* Nix now uses `libarchive` to decompress and unpack tarballs and zip
  files, so `tar` is no longer required.

* The priority of substituters can now be overridden using the
  `priority` substituter setting (e.g. `--substituters
  'http://cache.nixos.org?priority=100 daemon?priority=10'`).

* `nix edit` now supports non-derivation attributes, e.g. `nix edit
  .#nixosConfigurations.bla`.

* The `nix` command now provides command line completion for `bash`,
  `zsh` and `fish`. Since the support for getting completions is built
  into `nix`, it's easy to add support for other shells.

* The new `--log-format` flag selects what Nix's output looks like. It
  defaults to a terse progress indicator. There is a new
  `internal-json` output format for use by other programs.

* `nix eval` has a new `--apply` flag that applies a function to the
  evaluation result.

* `nix eval` has a new `--write-to` flag that allows it to write a
  nested attribute set of string leaves to a corresponding directory
  tree.

* Memory improvements: many operations that add paths to the store or
  copy paths between stores now run in constant memory.

* Many `nix` commands now support the flag `--derivation` to operate
  on a `.drv` file itself instead of its outputs.

* There is a new store called `dummy://` that does not support
  building or adding paths. This is useful if you want to use the Nix
  evaluator but don't have a Nix store.

* The `ssh-ng://` store now allows substituting paths on the remote,
  as `ssh://` already did.

* When auto-calling a function with an ellipsis, all arguments are now
  passed.

* New `nix-shell` features:

  - It preserves the `PS1` environment variable if
    `NIX_SHELL_PRESERVE_PROMPT` is set.


Title: Nix 2.4: Expanded Features - Source Fetching, Language Changes, Built-in Functions, and More
Summary
This section outlines further enhancements in Nix 2.4, including extensible source tree fetching with Git, Mercurial, GitHub, GitLab, tarball, and directory backends. It details language changes like antiquotations in paths, new built-in functions such as `builtins.fetchTree` and `builtins.getFlake`, experimental recursive Nix support, and the `no-url-literals` feature. It also covers the use of `libarchive`, substituter priority overrides, enhancements to `nix edit`, command-line completion, new logging formats, and improvements to `nix eval`. Additionally, memory management improvements, a `dummy://` store, `ssh-ng://` store substitution, and `nix-shell` features are discussed.