▲ 11 r/NixOS
If this is wrong, I don't want to be right
I added this module to my nixos configuration:
{ nixpkgs, pkgs, lib, ...}:
let upstreamRegistry = pkgs.fetchurl {
url = "https://raw.githubusercontent.com/NixOS/flake-registry/refs/heads/master/flake-registry.json";
hash = "sha256-e56aGI09taupUuZbn3ocfEe4EyOWjWwr/sl8oByiBIw=";
};
upstreamRegistryNix = builtins.fromJSON (builtins.readFile upstreamRegistry); in
{
nix.settings.flake-registry = pkgs.writeText "registry.json" ( builtins.toJSON {
version = upstreamRegistryNix.version;
flakes = upstreamRegistryNix.flakes ++ [
{ exact = true;
from.id = "local-nixpkgs";
from.type = "indirect";
to = {
type = "path";
path = nixpkgs.outPath;
} // lib.filterAttrs (n: _: n == "lastModified" || n == "rev" || n == "narHash") nixpkgs;
}
]; });
}
Now I can use:
inputs.nixpkgs.url = "flake:nixpkgs-local"
for building my profile and have my profile use the same version of nixpkgs as my system. Someday someone will make a convincing argument to me why having flakes stop accepting the system registry entries was a Good Thing (surely lockfiles are sufficient?), but until then, I will work around it.
u/Aidenn0 — 3 days ago