Home Explore Blog CI



nix

4th chunk of `doc/manual/source/release-notes/rl-2.24.md`
530859a5963ef310551237a3415b094155e5937e5b7d56140000000100000faa
  This change was alluded to in [RFC 134](https://github.com/nixos/rfcs/blob/master/rfcs/0134-nix-store-layer.md) and is a step towards a more modular and maintainable codebase.

  Author: [**John Ericson (@Ericson2314)**](https://github.com/Ericson2314)

- CLI options `--arg-from-file` and `--arg-from-stdin` [#9913](https://github.com/NixOS/nix/pull/9913)

- The `--debugger` now prints source location information, instead of the
  pointers of source location information. Before:

  ```
  nix-repl> :bt
  0: while evaluating the attribute 'python311.pythonForBuild.pkgs'
  0x600001522598
  ```

  After:

  ```
  0: while evaluating the attribute 'python311.pythonForBuild.pkgs'
  /nix/store/hg65h51xnp74ikahns9hyf3py5mlbbqq-source/overrides/default.nix:132:27

     131|
     132|       bootstrappingBase = pkgs.${self.python.pythonAttr}.pythonForBuild.pkgs;
        |                           ^
     133|     in
  ```

- Stop vendoring `toml11`

  We don't apply any patches to it, and vendoring it locks users into
  bugs (it hasn't been updated since its introduction in late 2021).

  Author: [**Winter (@winterqt)**](https://github.com/winterqt)

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

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

  **Deprecation**: Use `nix32` instead of `base32` as `toHashFormat`

  For the builtin `convertHash`, the `toHashFormat` parameter now accepts the same hash formats as the `--to`/`--from`
  parameters of the `nix hash convert` command: `"base16"`, `"nix32"`, `"base64"`, and `"sri"`. The former `"base32"` value
  remains as a deprecated alias for `"nix32"`. Please convert your code from:

  ```nix
  builtins.convertHash { inherit hash hashAlgo; toHashFormat = "base32";}
  ```

  to

  ```nix
  builtins.convertHash { inherit hash hashAlgo; toHashFormat = "nix32";}
  ```

- Add `pipe-operators` experimental feature [#11131](https://github.com/NixOS/nix/pull/11131)

  This is a draft implementation of [RFC 0148](https://github.com/NixOS/rfcs/pull/148).

  The `pipe-operators` experimental feature adds [`<|` and `|>` operators][pipe operators] to the Nix language.
  *a* `|>` *b* is equivalent to the function application *b* *a*, and
  *a* `<|` *b* is equivalent to the function application *a* *b*.

  For example:

  ```
  nix-repl> 1 |> builtins.add 2 |> builtins.mul 3
  9

  nix-repl> builtins.add 1 <| builtins.mul 2 <| 3
  7
  ```

  `<|` and `|>` are right and left associative, respectively, and have lower precedence than any other operator.
  These properties may change in future releases.

  See [the RFC](https://github.com/NixOS/rfcs/pull/148) for more examples and rationale.


- `nix-shell` shebang uses relative path [#4232](https://github.com/NixOS/nix/issues/4232) [#5088](https://github.com/NixOS/nix/pull/5088) [#11058](https://github.com/NixOS/nix/pull/11058)

  <!-- unfortunately no link target for the specific syntax -->
  Relative [path](@docroot@/language/types.md#type-path) literals in `nix-shell` shebang scripts' options are now resolved relative to the [script's location](@docroot@/glossary.md?highlight=base%20directory#gloss-base-directory).
  Previously they were resolved relative to the current working directory.

  For example, consider the following script in `~/myproject/say-hi`:

  ```shell
  #!/usr/bin/env nix-shell
  #!nix-shell --expr 'import ./shell.nix'
  #!nix-shell --arg toolset './greeting-tools.nix'
  #!nix-shell -i bash
  hello
  ```

  Older versions of `nix-shell` would resolve `shell.nix` relative to the current working directory, such as the user's home directory in this example:

  ```console
  [hostname:~]$ ./myproject/say-hi
  error:
         … while calling the 'import' builtin
           at «string»:1:2:
              1| (import ./shell.nix)
               |  ^

         error: path '/home/user/shell.nix' does not exist

Title: Nix Release 2.24.0: CLI Improvements, Hash Format Renaming, Experimental Pipe Operators, and Nix-Shell Enhancements
Summary
This section covers additional changes in Nix release 2.24.0, including the addition of CLI options `--arg-from-file` and `--arg-from-stdin`, improved debugger source location information, stopping the vendoring of `toml11`, renaming the hash format `base32` to `nix32`, introducing experimental pipe operators (`<|` and `|>`), and resolving relative paths in `nix-shell` shebang scripts relative to the script's location.