restruct args into specialArgs._cerulean

This commit is contained in:
do butterflies cry? 2026-02-17 17:00:09 +10:00
parent 59d1028e19
commit 0b0157be1d
5 changed files with 45 additions and 32 deletions

View file

@ -1,3 +1,7 @@
- [ ] base should automatically be set as the default (dont do anything with the default)
- [ ] try to remove common foot guns, ie abort if the user provides the home-manager or microvm nixosModules
since cerulean ALREADY provides these
- [ ] deploy port should default to the first port given to `services.openssh` - [ ] deploy port should default to the first port given to `services.openssh`
- [ ] use the Nix module system instead of projectOnto for `cerulean.mkNexus` - [ ] use the Nix module system instead of projectOnto for `cerulean.mkNexus`

View file

@ -184,21 +184,35 @@ in {
outputs = rec { outputs = rec {
nixosConfigurations = mapNodes nexus ( nixosConfigurations = mapNodes nexus (
{ {
base,
lib, lib,
nodeName, nodeName,
node, node,
... ...
}: let }: let
nixosDecl = lib.nixosSystem rec { nixosDecl = let
system = node.system; userArgs = nexus.args // node.args;
specialArgs = ceruleanArgs = {
nexus.args inherit root base;
// node.args
// {
inherit root specialArgs;
inherit (node) system; inherit (node) system;
_deploy-rs = inputs.deploy-rs; _ceru = {
inherit inputs userArgs;
args = ceruleanArgs;
}; };
};
specialArgs = assert (userArgs
|> attrNames
|> map (argName:
ceruleanArgs ? argName
|| abort ''
`specialArgs` are like super important to Cerulean my love... </3
But `args.${argName}` is a reserved argument name :(
''));
userArgs // ceruleanArgs;
in
lib.nixosSystem {
inherit (node) system;
inherit specialArgs;
modules = modules =
[ [
self.nixosModules.default self.nixosModules.default

View file

@ -93,7 +93,7 @@ in rec {
''; '';
in in
f { f {
inherit nodeName node; inherit nodeName node base;
lib = base.lib; inherit (base) lib;
}); });
} }

View file

@ -14,7 +14,7 @@
{ {
root, root,
system, system,
_deploy-rs, _cerulean,
... ...
} @ args: { } @ args: {
imports = [ imports = [
@ -26,7 +26,7 @@
./home-manager.nix ./home-manager.nix
]; ];
environment.systemPackages = [ environment.systemPackages = with _cerulean.inputs; [
_deploy-rs.packages.${system}.default deploy-rs.packages.${system}.default
]; ];
} }

View file

@ -13,10 +13,9 @@
# limitations under the License. # limitations under the License.
{ {
root, root,
system,
config, config,
lib, lib,
specialArgs, _cerulean,
... ...
} @ args: let } @ args: let
inherit inherit
@ -34,17 +33,13 @@ in {
|> 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 = {inherit root system;} // (specialArgs.inputs or {}); extraSpecialArgs = _cerulean.args;
sharedModules = [ sharedModules = [
# user configuration # user configuration
(import (root + "/nixpkgs.nix")) (import (root + "/nixpkgs.nix"))
# options declarations # options declarations
(import ./nixpkgs.nix (args // {contextName = "homes";})) (import ./nixpkgs.nix (args // {contextName = "homes";}))
]; ];
# disable home-manager trying anything fancy
# we control the pkgs now!!
# useGlobalPkgs = true;
}; };
}; };
} }