From 2f5e4c57d8b5273dc62daa66f617082ea71aab5c Mon Sep 17 00:00:00 2001 From: "Casper V. Kristensen" Date: Sat, 11 Nov 2023 00:49:55 +0100 Subject: [PATCH] align nix flake registry with flake.lock --- modules/base/system.nix | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/modules/base/system.nix b/modules/base/system.nix index b499dc3..9dca3cf 100644 --- a/modules/base/system.nix +++ b/modules/base/system.nix @@ -1,4 +1,4 @@ -{ config, nix-index-database, lib, pkgs, ... }: { +{ config, nix-index-database, nixpkgs-unstable, nixpkgs, lib, pkgs, ... }: { imports = [ nix-index-database.nixosModules.nix-index ]; @@ -14,6 +14,18 @@ auto-optimise-store = true; experimental-features = [ "nix-command" "flakes" ]; }; + + # The nix registry is used to refer to flakes using symbolic identifiers + # when running commands such as `nix run nixpkgs#hello`. By default, + # the global registry from [1] is used, which aliases `nixpkgs` to the + # nixpkgs-unstable branch. We overwrite the default global `nixpkgs` + # registry with one which refers to the same nixpkgs as the rest of + # the system, aligning it with flake.lock. + # [1] https://github.com/NixOS/flake-registry/blob/master/flake-registry.json + registry = { + nixpkgs.flake = nixpkgs; + nixpkgs-unstable.flake = nixpkgs-unstable; + }; }; nixpkgs.config.allowUnfree = true;