Home Explore Blog CI



nix

2nd chunk of `doc/manual/source/release-notes/rl-2.20.md`
ace3a803fce032f30217210ac1641ed96f4378de78ef994a0000000100000c3e
  - `nix hash to-base64 $hash1 $hash2`: Use `nix hash convert --to base64 $hash1 $hash2` instead.
  - `nix hash to-sri $hash1 $hash2`: : Use `nix hash convert --to sri $hash1 $hash2` or even just `nix hash convert $hash1 $hash2` instead.

- Rename hash format `base32` to `nix32` [#9452](https://github.com/NixOS/nix/pull/9452)

  Hash format `base32` was renamed to `nix32` since it used a special Nix-specific character set for
  [Base32](https://en.wikipedia.org/wiki/Base32).

- `nix profile` now allows referring to elements by human-readable names [#8678](https://github.com/NixOS/nix/pull/8678)

  [`nix profile`](@docroot@/command-ref/new-cli/nix3-profile.md) now uses names to refer to installed packages when running [`list`](@docroot@/command-ref/new-cli/nix3-profile-list.md), [`remove`](@docroot@/command-ref/new-cli/nix3-profile-remove.md) or [`upgrade`](@docroot@/command-ref/new-cli/nix3-profile-upgrade.md) as opposed to indices. Profile element names are generated when a package is installed and remain the same until the package is removed.

  **Warning**: The `manifest.nix` file used to record the contents of profiles has changed. Nix will automatically upgrade profiles to the new version when you modify the profile. After that, the profile can no longer be used by older versions of Nix.

- Give `nix store add` a `--hash-algo` flag [#9809](https://github.com/NixOS/nix/pull/9809)

  Adds a missing feature that was present in the old CLI, and matches our
  plans to have similar flags for `nix hash convert` and `nix hash path`.

- Coercion errors include the failing value

  The `error: cannot coerce a <TYPE> to a string` message now includes the value
  which caused the error.

  Before:

  ```
  error: cannot coerce a set to a string
  ```

  After:

  ```
  error: cannot coerce a set to a string: { aesSupport = «thunk»;
    avx2Support = «thunk»; avx512Support = «thunk»; avxSupport = «thunk»;
    canExecute = «thunk»; config = «thunk»; darwinArch = «thunk»; darwinMinVersion
    = «thunk»; darwinMinVersionVariable = «thunk»; darwinPlatform = «thunk»; «84
    attributes elided»}
  ```

- Type errors include the failing value

  In errors like `value is an integer while a list was expected`, the message now
  includes the failing value.

  Before:

  ```
  error: value is a set while a string was expected
  ```

  After:

  ```
  error: expected a string but found a set: { ghc810 = «thunk»;
    ghc8102Binary = «thunk»; ghc8107 = «thunk»; ghc8107Binary = «thunk»;
    ghc865Binary = «thunk»; ghc90 = «thunk»; ghc902 = «thunk»; ghc92 = «thunk»;
    ghc924Binary = «thunk»; ghc925 = «thunk»;  «17 attributes elided»}
  ```

- Source locations are printed more consistently in errors [#561](https://github.com/NixOS/nix/issues/561) [#9555](https://github.com/NixOS/nix/pull/9555)

  Source location information is now included in error messages more
  consistently. Given this code:

  ```nix
  let
    attr = {foo = "bar";};
    key = {};
  in
    attr.${key}
  ```

  Previously, Nix would show this unhelpful message when attempting to evaluate

Title: Nix Release 2.20.0 - Hash Conversion, Profile Changes, and Error Improvements
Summary
This section of the Nix 2.20.0 release notes covers several changes. It details the replacement of `nix hash to-*` commands with `nix hash convert`, the renaming of the `base32` hash format to `nix32`, and the updated `nix profile` command that now uses human-readable names. A warning is given regarding the updated `manifest.nix` file used for profiles, which is incompatible with older Nix versions after upgrading. It also includes the addition of a `--hash-algo` flag to `nix store add`. Finally, the release improves error messages by including the failing value in coercion and type errors and ensuring source locations are printed more consistently.