Nix 2.9.0 released


I’m pleased to announce the availability of Nix 2.9.0. It will be available from NixOS - Getting Nix / NixOS.

Here are the release notes:

  • Running Nix with the new --debugger flag will cause it to start a repl session if an exception is thrown during evaluation, or if builtins.break is called. From there you can inspect the values of variables and evaluate Nix expressions. In debug mode, the following new repl commands are available:

    :env          Show env stack
    :bt           Show trace stack
    :st           Show current trace
    :st <idx>     Change to another trace in the stack
    :c            Go until end of program, exception, or builtins.break().
    :s            Go one step

    Read more about the debugger here.

  • Nix now provides better integration with zsh’s run-help feature. It is now included in the Nix installation in the form of an autoloadable shell function, run-help-nix. It picks up Nix subcommands from the currently typed in command and directs the user to the associated man pages.

  • nix repl has a new build-and-link (:bl) command that builds a derivation while creating GC root symlinks.

  • The path produced by builtins.toFile is now allowed to be imported or read even with restricted evaluation. Note that this will not work with a read-only store.

  • nix build has a new --print-out-paths flag to print the resulting output paths. This matches the default behaviour of nix-build.

  • You can now specify which outputs of a derivation nix should operate on using the syntax installable^outputs, e.g. nixpkgs#glibc^dev,static or nixpkgs#glibc^*. By default, nix will use the outputs specified by the derivation’s meta.outputsToInstall attribute if it exists, or all outputs otherwise.

  • builtins.fetchTree (and flake inputs) can now be used to fetch plain files over the http(s) and file protocols in addition to directory tarballs.


For those that are trying out the debugger: it will show an exception every time it is run, and this is normal. See debugger issue in nixpkgs · Issue #6594 · NixOS/nix · GitHub.

Does nix upgrade-nix get updated automatically or does someone need to manually fix this:

$ sudo -i nix upgrade-nix
replacing old 'nix-2.8.1'
installing 'nix-2.8.1'

(I expect this to update to 2.9.0, but it’s still on 2.8.1.)

nix upgrade-nix gets the latest version of Nix from Nixpkgs, so Nixpkgs needs to be updated.

  • builtins.fetchTree (and flake inputs) can now be used to fetch plain files over the http(s) and file protocols in addition to directory tarballs.

Oh I was waiting for this to land (in #6548), thank you! This was a big pain point for me that has gone away.

(Now there’s just sparse checkout #5811 on my wishlist)

1 Like

This appears to have potential impact on the flake output practices (e.g. by grouping versions of a package under the package instead of generating sibling outputs).

Do you have a normative direction of thinking / suggestion how this shoud be done or thought of?

So far I have never seen this practice.

Also I think those would be awkward to manage as multi output derivations…

If though they are a package set rather than a multi output derivation, you had to use dot-notation, while at the same time you’d be in violation of the flake output spec, which does not allow for sets under packages but only a flat set of derivations.

1 Like

wouldn’t it be better if nix upgrade-nix targeted github:nixos/nix/2.*-maitainenance branches?

Hosted by Flying Circus.