rename channels.default -> channels.base

This commit is contained in:
do butterflies cry? 2026-03-07 17:54:10 +10:00
parent ba7763801f
commit 180889411f
Signed by: cry
GPG key ID: F68745A836CA0412

View file

@ -31,7 +31,7 @@ in {
default = {}; default = {};
description = "Declare package repositories"; description = "Declare package repositories";
example = { example = {
"pkgs" = { "npkgs" = {
source = "inputs.nixpkgs"; source = "inputs.nixpkgs";
system = "x86-64-linux"; system = "x86-64-linux";
config = { config = {
@ -53,7 +53,7 @@ in {
config = let config = let
repos = repos =
cfg cfg
|> (xs: removeAttrs xs ["default"]) |> (xs: removeAttrs xs ["base"])
|> mapAttrs ( |> mapAttrs (
name: args: name: args:
lib.mkForce ( lib.mkForce (
@ -65,30 +65,27 @@ in {
) )
); );
# XXX: TODO: would it work to use `base` instead of having default? basePkgs = cfg.base or {};
defaultPkgs =
cfg.default or (throw ''
Your `nixpkgs.nix` file does not declare a default package source.
Ensure you set `nixpkgs.channels.*.default = ...;`
'');
in { in {
# NOTE: _module.args is a special option that allows us to # NOTE: _module.args is a special option that allows us to
# NOTE: set extend specialArgs from inside the modules. # NOTE: set extend specialArgs from inside the modules.
# WARNING: pkgs is a reserved specialArg # WARNING: pkgs is a reserved specialArg
_module.args = removeAttrs repos ["pkgs" "default"]; _module.args = removeAttrs repos ["pkgs" "base"];
nixpkgs = nixpkgs = let
nixpkgConfig = {
config = lib.mkForce (basePkgs.config or {});
overlays = lib.mkForce (basePkgs.overlays or []);
};
in
if contextName == "hosts" if contextName == "hosts"
then { then
flake.source = lib.mkForce base; # DEBUG: temp while getting base to work nixpkgConfig
overlays = lib.mkForce (defaultPkgs.overlays or {}); // {
config = lib.mkForce (defaultPkgs.config or {}); flake.source = lib.mkForce base;
} }
else if contextName == "homes" else if contextName == "homes"
then { then nixpkgConfig
config = lib.mkForce (defaultPkgs.config or {});
overlays = lib.mkForce (defaultPkgs.overlays or []);
}
else {}; else {};
}; };
} }