This commit is contained in:
do butterflies cry? 2026-02-18 17:24:28 +10:00
parent 0c5387fd61
commit 870bbb1f37
3 changed files with 35 additions and 33 deletions

View file

@ -197,8 +197,8 @@ in {
inherit root base; inherit root base;
inherit (node) system; inherit (node) system;
_cerulean = { _cerulean = {
inherit inputs userArgs; inherit inputs userArgs ceruleanArgs;
args = ceruleanArgs; specialArgs = userArgs // ceruleanArgs;
}; };
}; };
specialArgs = assert (userArgs specialArgs = assert (userArgs
@ -209,7 +209,7 @@ in {
`specialArgs` are like super important to Cerulean my love... </3 `specialArgs` are like super important to Cerulean my love... </3
But `args.${argName}` is a reserved argument name :( But `args.${argName}` is a reserved argument name :(
'')); ''));
userArgs // ceruleanArgs; ceruleanArgs._cerulean.specialArgs;
in in
lib.nixosSystem { lib.nixosSystem {
inherit (node) system; inherit (node) system;

View file

@ -25,15 +25,16 @@
pathExists pathExists
; ;
in { in {
config = {
home-manager = { home-manager = {
users = users =
config.users.users config.users.users
|> attrNames |> attrNames
|> filter (x: pathExists (root + "/homes/${x}")) |> filter (x: pathExists (root + "/homes/${x}"))
|> (x: lib.genAttrs x (y: import (root + "/homes/${y}"))); |> (x:
lib.genAttrs x (y:
import (root + "/homes/${y}")));
extraSpecialArgs = _cerulean.args; extraSpecialArgs = _cerulean.specialArgs;
sharedModules = [ sharedModules = [
# user configuration # user configuration
(import (root + "/nixpkgs.nix")) (import (root + "/nixpkgs.nix"))
@ -41,5 +42,4 @@ in {
(import ./nixpkgs.nix (args // {contextName = "homes";})) (import ./nixpkgs.nix (args // {contextName = "homes";}))
]; ];
}; };
};
} }

View file

@ -52,6 +52,7 @@ in {
config = let config = let
repos = repos =
cfg cfg
|> (xs: removeAttrs xs ["default"])
|> mapAttrs ( |> mapAttrs (
name: args: name: args:
lib.mkForce ( lib.mkForce (
@ -59,28 +60,29 @@ in {
|| abort '' || abort ''
`nixpkgs.channels.${name}` missing required attribute "source" `nixpkgs.channels.${name}` missing required attribute "source"
''; '';
((removeAttrs args ["source"]) import args.source ({inherit system;} // (removeAttrs args ["source"]))
// {inherit system;})
|> import args.source
) )
); );
in {
# NOTE: _module.args is a special option that allows us to
# NOTE: set extend specialArgs from inside the modules.
_module.args = repos;
nixpkgs = let
# XXX: TODO: would it work to use `base` instead of having default? # XXX: TODO: would it work to use `base` instead of having default?
defaultPkgs = defaultPkgs =
cfg.default or (throw '' cfg.default or (throw ''
Your `nixpkgs.nix` file does not declare a default package source. Your `nixpkgs.nix` file does not declare a default package source.
Ensure you set `nixpkgs.channels.*.default = ...;` Ensure you set `nixpkgs.channels.*.default = ...;`
''); '');
in in {
# NOTE: _module.args is a special option that allows us to
# NOTE: set extend specialArgs from inside the modules.
_module.args = repos;
nixpkgs =
if contextName == "hosts" if contextName == "hosts"
then { then
flake.source = lib.mkOverride 200 defaultPkgs.source; # DEBUG: defaultPkgs
config = lib.mkOverride 200 defaultPkgs.config; {
flake.source = lib.mkOverride 200 (defaultPkgs.source or null);
overlays = lib.mkOverride 200 (defaultPkgs.overlays or {});
config = lib.mkOverride 200 (defaultPkgs.config or {});
} }
else if contextName == "homes" else if contextName == "homes"
then { then {