Our team is using the attribute nixConfig.flake-registry
to point to a Nix registry stored in GitHub. This makes it easy to manage inputs in our flakes. For example, we have nixpkgs
pointing to nixos-24.05, and when 24.11 is released, we can update the registry and then run nix flake update
on our flakes to get them updated.
However, a change in NixOS 24.05 is causing problems. Now, by default, NixOS 24.05 points nixpkgs
to the version of the locally installed nixpkgs, which I think is reasonable.
nixConfig.flake-registry
.
From changelog:
On flake-based NixOS configurations using
nixpkgs.lib.nixosSystem
, NixOS will automatically setNIX_PATH
and the system-wide flake registry (/etc/nix/registry.json
) to point<nixpkgs>
and the unqualified flake pathnixpkgs
to the version of nixpkgs used to build the system.This makesnix run nixpkgs#hello
andnix-build '<nixpkgs>' -A hello
work out of the box with no added configuration, reusing dependencies already on the system.This may be undesirable if Nix commands are not going to be run on the built system since it adds nixpkgs to the system closure. For such closure-size-constrained non-interactive systems, this setting should be disabled.To disable it, set nixpkgs.flake.setNixPath and nixpkgs.flake.setFlakeRegistry to false.
The problem is that this local registry have precedence over nixConfig.flake-registry
in flakes. So, if you have nixpkgs
in the inputs and run nix flake update
, it chooses the local nixpkgs
instead of the one specified in the registry in the flake with nixConfig.flake-registry
. Which I think is not as expected.
We solve the problem for now with setting nixpkgs.flake.setFlakeRegistry
to false. But then it depends on the laptop and everyone have to set this config on their laptop.
What do people think? Is this the expected behavior?