Home Explore Blog Models CI



nix

3rd chunk of `doc/manual/source/release-notes/rl-2.21.md`
0fc37e94bb3e784331e56431f8ae5ff92a747adc8c037fce000000010000099f
  This does not usually have a measurable impact, but side-effects (such as `builtins.trace`) would be duplicated and expensive expressions (such as derivations) could cause a measurable slowdown.

- Store paths are allowed to start with `.` [#912](https://github.com/NixOS/nix/issues/912) [#9091](https://github.com/NixOS/nix/pull/9091) [#9095](https://github.com/NixOS/nix/pull/9095) [#9120](https://github.com/NixOS/nix/pull/9120) [#9121](https://github.com/NixOS/nix/pull/9121) [#9122](https://github.com/NixOS/nix/pull/9122) [#9130](https://github.com/NixOS/nix/pull/9130) [#9219](https://github.com/NixOS/nix/pull/9219) [#9224](https://github.com/NixOS/nix/pull/9224) [#9867](https://github.com/NixOS/nix/pull/9867)

  Leading periods were allowed by accident in Nix 2.4. The Nix team has considered this to be a bug, but this behavior has since been relied on by users, leading to unnecessary difficulties.
  From now on, leading periods are supported. The names `.` and `..` are disallowed, as well as those starting with `.-` or `..-`.

  Nix versions that denied leading periods are documented [in the issue](https://github.com/NixOS/nix/issues/912#issuecomment-1919583286).

- `nix repl` pretty-prints values [#9931](https://github.com/NixOS/nix/pull/9931)

  `nix repl` will now pretty-print values:

  ```
  {
    attrs = {
      a = {
        b = {
          c = { };
        };
      };
    };
    list = [ 1 ];
    list' = [
      1
      2
      3
    ];
  }
  ```

- Introduction of `--regex` and `--all` in `nix profile remove` and `nix profile upgrade` [#10166](https://github.com/NixOS/nix/pull/10166)

  Previously the command-line arguments for `nix profile remove` and `nix profile upgrade` matched the package entries using regular expression.
  For instance:

  ```
  nix profile remove '.*vim.*'
  ```

  This would remove all packages that contain `vim` in their name.

  In most cases, only singular package names were used to remove and upgrade packages. Mixing this with regular expressions sometimes lead to unintended behavior. For instance, `python3.1` could match `python311`.

  To avoid unintended behavior, the arguments are now only matching exact names.

  Matching using regular expressions is still possible by using the new `--regex` flag:

  ```
  nix profile remove --regex '.*vim.*'
  ```

  One of the most useful cases for using regular expressions was to upgrade all packages. This was previously accomplished by:

Title: Nix Enhancements: Store Paths, REPL Output, and Profile Commands
Summary
This section of the Nix release notes continues by noting that optimizing `inherit (x) ...` to evaluate `x` only once primarily prevents duplicated side-effects or slowdowns from expensive expressions, though typically without measurable impact. It then highlights that store paths are now officially allowed to start with a period (`.`), a feature previously present by accident and now formally supported (excluding `.` `..`, `.-`, or `..-`). User experience is improved with `nix repl` now pretty-printing values for better readability. Finally, the behavior of `nix profile remove` and `nix profile upgrade` has changed: arguments now require exact matches by default, with new `--regex` and `--all` flags introduced for explicit regular expression matching and upgrading all packages, respectively, to prevent unintended behavior.