Home Explore Blog CI



nix

3rd chunk of `doc/manual/source/release-notes/rl-2.21.md`
c5c2673968b9df0ecd5fe18cd6260dc8b7633e687a9448f0000000010000099f
  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 2.21.0: Store Path Enhancements, Pretty-Printing in `nix repl`, and `nix profile` Command Updates
Summary
This section covers the allowance of store paths starting with `.` in Nix 2.21.0, with restrictions on names like `.` and `..`. It also highlights the new pretty-printing feature in `nix repl` for improved readability. Additionally, it introduces the `--regex` and `--all` flags in `nix profile remove` and `nix profile upgrade` for more precise package management.