Home Explore Blog CI



nix

1st chunk of `doc/manual/source/release-notes/rl-2.23.md`
f03898515db4dcab1bc5920721a8b40171dcf1b8262c32e60000000100000b51
# Release 2.23.0 (2024-06-03)

- New builtin: `builtins.warn` [#306026](https://github.com/NixOS/nix/issues/306026) [#10592](https://github.com/NixOS/nix/pull/10592)

  `builtins.warn` behaves like `builtins.trace "warning: ${msg}"`, has an accurate log level, and is controlled by the options
  [`debugger-on-trace`](@docroot@/command-ref/conf-file.md#conf-debugger-on-trace),
  [`debugger-on-warn`](@docroot@/command-ref/conf-file.md#conf-debugger-on-warn) and
  [`abort-on-warn`](@docroot@/command-ref/conf-file.md#conf-abort-on-warn).

- Make `nix build --keep-going` consistent with `nix-build --keep-going`

  This means that if e.g. multiple fixed-output derivations fail to
  build, all hash mismatches are displayed.

- Modify `nix derivation {add,show}` JSON format [#9866](https://github.com/NixOS/nix/issues/9866) [#10722](https://github.com/NixOS/nix/pull/10722)

  The JSON format for derivations has been slightly revised to better conform to our [JSON guidelines](@docroot@/development/cli-guideline.md#returning-future-proof-json).
  In particular, the hash algorithm and content addressing method of content-addressed derivation outputs are now separated into two fields `hashAlgo` and `method`,
  rather than one field with an arcane `:`-separated format.

  This JSON format is only used by the experimental `nix derivation` family of commands, at this time.
  Future revisions are expected as the JSON format is still not entirely in compliance even after these changes.

- Warn on unknown settings anywhere in the command line [#10701](https://github.com/NixOS/nix/pull/10701)

  All `nix` commands will now properly warn when an unknown option is specified anywhere in the command line.

  Before:

  ```console
  $ nix-instantiate --option foobar baz --expr '{}'
  warning: unknown setting 'foobar'
  $ nix-instantiate '{}' --option foobar baz --expr
  $ nix eval --expr '{}' --option foobar baz
  { }
  ```

  After:

  ```console
  $ nix-instantiate --option foobar baz --expr '{}'
  warning: unknown setting 'foobar'
  $ nix-instantiate '{}' --option foobar baz --expr
  warning: unknown setting 'foobar'
  $ nix eval --expr '{}' --option foobar baz
  warning: unknown setting 'foobar'
  { }
  ```

- `nix env shell` is the new `nix shell`, and `nix shell` remains an accepted alias [#10504](https://github.com/NixOS/nix/issues/10504) [#10807](https://github.com/NixOS/nix/pull/10807)

  This is part of an effort to bring more structure to the CLI subcommands.

  `nix env` will be about the process environment.
  Future commands may include `nix env run` and `nix env print-env`.

  It is also somewhat analogous to the [planned](https://github.com/NixOS/nix/issues/10504) `nix dev shell` (currently `nix develop`), which is less about environment variables, and more about running a development shell, which is a more powerful command, but also requires more setup.

Title: Nix Release 2.23.0 Highlights (2024-06-03)
Summary
This release introduces a new `builtins.warn` function, ensures consistent behavior for `nix build --keep-going`, modifies the JSON format for `nix derivation {add,show}`, warns on unknown command-line settings, and renames `nix shell` to `nix env shell` while maintaining `nix shell` as an alias as part of a CLI restructuring effort.