`flake:` urls and system registry

I have this in my nixos config. (thisFlake is just flake’s self).

nix = {
    channel.enable = false;

    registry = mapAttrs (_: flake: {
        inherit flake;
    }) (thisFlake.inputs // { myNixConfig = thisFlake; });
};

The point is to make my flake’s inputs and my flake itself accessible anywhere in my system.
nix registry list prints this:

system flake:disko path:/nix/store/hn0yisb1xpf0cf89i1av3qk7i59fkxk2-source?lastModified=1746728054&narHash=sha256-eDoSOhxGEm2PykZFa/x9QG5eTH0MJdiJ9aR00VAofXE%3D&rev=ff442f5d1425feb86344c028298548024f21256d
system flake:firefoxAddons path:/nix/store/sml87v22hv06nkyj02lslks0wi155i0g-source/pkgs/firefox-addons?lastModified=1748491405&narHash=sha256-kjHOCsU66vlEv0NIyrMYmg9DvUiLsEGkhxtPiYIdx5g%3D&rev=42b96163341bdb7934cf880307f166f0238038ab
system flake:homeManager path:/nix/store/yrafmcs3m766gfdivnlbhkzymqf18y0j-source?lastModified=1748487945&narHash=sha256-e9zc/rHdoH9i%2BsFFhhQiKoF6IuD%2BT2rB/nUyPaO7CCg%3D&rev=0d13ea58d565d3c1c1468ddae1f623316dc395d9
system flake:myNixConfig path:/nix/store/26xx9p8wdh92pspy2mcvbm9b84xi6zlx-source?lastModified=1748686050&narHash=sha256-J1SKCJSOunjEoTD/5WuD%2BajipCD6tPnZwtfkCu29FjA%3D&rev=23c6701430ba0744434387343f7bcb65745ab215
system flake:nixPackages path:/nix/store/2d4cws3k4ypb9kvln8qh8ikpd5j5r89l-source?lastModified=1748302896&narHash=sha256-ixMT0a8mM091vSswlTORZj93WQAJsRNmEvqLL%2BqwTFM%3D&rev=7848cd8c982f7740edf76ddb3b43d234cb80fc4d
system flake:nixPackagesOpenWebui path:/nix/store/pgg4vm83q0kr4hxzcwhdgdiv2yfnh3dw-source?lastModified=1738142207&narHash=sha256-NGqpVVxNAHwIicXpgaVqJEJWeyqzoQJ9oc8lnK9%2BWC4%3D&rev=9d3ae807ebd2981d593cddd0080856873139aa40
system flake:nixPackagesPyppeteerHack path:/nix/store/sbnwhhx7zjp45n53bkmnj4whg79aw8pq-source?lastModified=1737299813&narHash=sha256-Qw2PwmkXDK8sPQ5YQ/y/icbQ%2BTYgbxfjhgnkNJyT1X8%3D&rev=107d5ef05c0b1119749e381451389eded30fb0d5
system flake:nixPackagesUnstable path:/nix/store/7z0c39jdpwfp86vbibi8q2l0pa22y77s-source?lastModified=1748370509&narHash=sha256-QlL8slIgc16W5UaI3w7xHQEP%2BQmv/6vSNTpoZrrSlbk%3D&rev=4faa5f5321320e49a78ae7848582f684d64783e9
system flake:nixVim path:/nix/store/p0v7qvkykxxpqndjmhpxx5j7wlbx7jsl-source?lastModified=1748197635&narHash=sha256-1bGQAkqnGyov/tfiJw1HTK3vTHrgEo977J6RfjqrH0s%3D&rev=cfea16cdbe4f13b5d39dfe3df747092448252c9d
system flake:nixosHardware path:/nix/store/q9c3kd05v9c335jhiyh1x4m3i15l5wh9-source?lastModified=1747900541&narHash=sha256-dn64Pg9xLETjblwZs9Euu/SsjW80pd6lr5qSiyLY1pg%3D&rev=11f2d9ea49c3e964315215d6baa73a8d42672f06
...
global flake:agda github:agda/agda
global flake:arion github:hercules-ci/arion
global flake:blender-bin github:edolstra/nix-warez?dir=blender
global flake:bundlers github:NixOS/bundlers
global flake:cachix github:cachix/cachix
global flake:composable github:ComposableFi/composable
global flake:disko github:nix-community/disko
...

Looks good.
nix shell nixPackagesUnstable#{package-1,package-2} works on both 24.11 and 25.05.

I also have something like this:

# myOtherFlake/flake.nix
inputs = {
    nixPackagesUnstable.url = "flake:nixPackagesUnstable";
};

nix develop ./myOtherFlake used to work on 24.11, but now on 25.05 (if the flake: input is not locked yet) it says:

error: cannot find flake 'flake:nixPackagesUnstable' in the flake registries

But it’s there! nix shell ... found it!

Help pls

1 Like

Non global registry entries are not considered anymore when used as flake inputs, as that caused a variety of weird issues. Especially when they were pointing at store paths, rather then repositories.

In my opinion any registry access should be forbidden as flake inputs.

The are a nice shorthand on the cli, but confusing as inputs.

1 Like

Oh, so it was an intentional change. I looked in release notes for nixos/nixpkgs, nix and didn’t find any mention of that. Well, good to know it’s not a bug or me being dumb. Thank you!

https://nix.dev/manual/nix/2.29/release-notes/rl-2.26.html#:~:text=Flake%20lock%20file%20generation%20now%20ignores%20local%20registries%20%2312019

1 Like

I want to reference my local system flake’s input in my home-manager flake:


inputs = {
    # Specify the source of Home Manager and Nixpkgs.
    nixpkgs.url = "flake:nixpkgs"; # system-wide nixpkgs (defined in system flake)

    nixpkgs-unstable.url = "github:NixOS/nixpkgs/nixos-unstable";

    home-manager = {
      url = "github:nix-community/home-manager/release-25.05";
      inputs.nixpkgs.follows = "nixpkgs";
    };

  };

In NixOs 25.05 it suddenly got broken. How to keep this working?

This ideally shouldn’t work because it makes your flake unusable for others.

You can use --override-flake for one-off commands or use lix which currently supports it (they may eventually remove support too, idk the future plans). The other workaround would be to use flake-registry to set the global registry but that just gets you back to the old problems I mentioned.

Then put both in the same flake.

Unless you changed your nix.package, it should still work, as the nix version in 25.05 is 2.28.3. Only 2.29 changed the behaviour.

For my use-case I just want to use the system revision of nixpkgs within nix shell or nix run.

Ok, i renamed it to local like this:

    nixPath = ["local=${flake-inputs.nixpkgs}"];
    registry.local = {
     flake = flake-inputs.nixpkgs;
    };

nix registry list shows it as first entry:

system flake:local path:/nix/store/01635adignbizr4nyz5lpawkrxn4n4g8-source?lastModified=1748437600&narHash=sha256-hYKMs3ilp09anGO7xzfGs3JqEgUqFMnZ8GMAqI6/k04%3D&rev=7282cb574e0607e65224d33be8241eae7cfe0979

nix run local#hello works.

but I for ~/.config/home-manager/flake.nix:

  inputs = {
    # Specify the source of Home Manager and Nixpkgs.
    nixpkgs.url = "flake:local"; # system-wide nixpkgs (defined in system flake)

    nixpkgs-unstable.url = "github:NixOS/nixpkgs/nixos-unstable";

    home-manager = {
      url = "github:nix-community/home-manager/release-25.05";
      inputs.nixpkgs.follows = "nixpkgs";
    };

  };

I have:

❯ nix flake update 
error:
       … while updating the lock file of flake 'git+file:///home/danny/.config/home-manager'

       … while updating the flake input 'nixpkgs'

       error: cannot find flake 'flake:local' in the flake registries

❯ nix --version   
nix (Nix) 2.28.3

I don’t know, but for me that config got broken when I upgraded to NixOS 25.05…

That should just work, and is unrelated to the input in your HM flake.

it changed in 2.26 as per the link you posted above, that’s why it stopped working in NixOS 25.05 (see the original topic caster’s post)… As for me it’s a weird decision that local flakes can’t be used as flake inputs…

nixpkgs.flake.setFlakeRegistry and nixpkgs.flake.setNixPath are enabled by default if nixpkgs.flake.source is set.

That would entirely miss the point of having locked inputs :slight_smile:

1 Like