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

View file

@ -25,15 +25,16 @@
pathExists
;
in {
config = {
home-manager = {
users =
config.users.users
|> attrNames
|> 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 = [
# user configuration
(import (root + "/nixpkgs.nix"))
@ -41,5 +42,4 @@ in {
(import ./nixpkgs.nix (args // {contextName = "homes";}))
];
};
};
}

View file

@ -52,6 +52,7 @@ in {
config = let
repos =
cfg
|> (xs: removeAttrs xs ["default"])
|> mapAttrs (
name: args:
lib.mkForce (
@ -59,28 +60,29 @@ in {
|| abort ''
`nixpkgs.channels.${name}` missing required attribute "source"
'';
((removeAttrs args ["source"])
// {inherit system;})
|> import args.source
import args.source ({inherit system;} // (removeAttrs 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?
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: set extend specialArgs from inside the modules.
_module.args = repos;
nixpkgs =
if contextName == "hosts"
then {
flake.source = lib.mkOverride 200 defaultPkgs.source;
config = lib.mkOverride 200 defaultPkgs.config;
then
# DEBUG: defaultPkgs
{
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"
then {