Home Explore Blog CI



nix

4th chunk of `doc/manual/source/release-notes/rl-2.4.md`
72f55f5342b3fef9900d620dfca6b1320ec958b5543796300000000100000d14
  `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.

  - With `-p`, it passes any `--arg`s as Nixpkgs arguments.

  - Support for structured attributes.

* `nix-prefetch-url` has a new `--executable` flag.

* On `x86_64` systems, [`x86_64` microarchitecture
  levels](https://lwn.net/Articles/844831/) are mapped to additional
  system types (e.g. `x86_64-v1-linux`).

* The new `--eval-store` flag allows you to use a different store for
  evaluation than for building or storing the build result. This is
  primarily useful when you want to query whether something exists in
  a read-only store, such as a binary cache:

  ```
  # nix path-info --json --store https://cache.nixos.org \
    --eval-store auto nixpkgs#hello
  ```

  (Here `auto` indicates the local store.)

* The Nix daemon has a new low-latency mechanism for copying
  closures. This is useful when building on remote stores such as
  `ssh-ng://`.

* Plugins can now register `nix` subcommands.

* The `--indirect` flag to `nix-store --add-root` has become a no-op.
  `--add-root` will always generate indirect GC roots from now on.

## Incompatible changes

* The `nix` command is now marked as an experimental feature. This
  means that you need to add

  ```
  experimental-features = nix-command
  ```

  to your `nix.conf` if you want to use it, or pass
  `--extra-experimental-features nix-command` on the command line.

* The `nix` command no longer has a syntax for referring to packages
  in a channel. This means that the following no longer works:

  ```console
  nix build nixpkgs.hello # Nix 2.3
  ```

  Instead, you can either use the `#` syntax to select a package from
  a flake, e.g.

  ```console
  nix build nixpkgs#hello
  ```

  Or, if you want to use the `nixpkgs` channel in the `NIX_PATH`
  environment variable:

  ```console
  nix build -f '<nixpkgs>' hello
  ```

* The old `nix run` has been renamed to `nix shell`, while there is a
  new `nix run` that runs a default command. So instead of

  ```console
  nix run nixpkgs.hello -c hello # Nix 2.3
  ```

  you should use

  ```console
  nix shell nixpkgs#hello -c hello
  ```

  or just

  ```console
  nix run nixpkgs#hello
  ```

  if the command you want to run has the same name as the package.

* It is now an error to modify the `plugin-files` setting via a
  command-line flag that appears after the first non-flag argument to

Title: Nix 2.4: Feature Additions (Eval, Shell, Stores) and Incompatible Changes (Command Syntax, Nix Run)
Summary
This section details additions to Nix 2.4, including flags for `nix eval`, improvements to memory management, the `dummy://` store, `ssh-ng://` store functionality, and `nix-shell` enhancements. It covers new features in `nix-prefetch-url`, system type mapping for `x86_64`, a flag for using a different store during evaluation, a low-latency closure mechanism for the Nix daemon, and plugin registration of Nix subcommands. Additionally, it outlines breaking changes, such as the experimental status of the `nix` command, syntax changes for referring to packages in a channel, renaming of `nix run` to `nix shell`, and restrictions on modifying `plugin-files`.