restruct args into specialArgs._cerulean
This commit is contained in:
parent
59d1028e19
commit
d85a6b963f
5 changed files with 46 additions and 32 deletions
4
TODO.md
4
TODO.md
|
|
@ -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`
|
||||||
|
|
|
||||||
|
|
@ -20,6 +20,7 @@
|
||||||
}: let
|
}: let
|
||||||
inherit
|
inherit
|
||||||
(builtins)
|
(builtins)
|
||||||
|
all
|
||||||
attrNames
|
attrNames
|
||||||
concatLists
|
concatLists
|
||||||
concatStringsSep
|
concatStringsSep
|
||||||
|
|
@ -184,33 +185,47 @@ 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 (node) system;
|
||||||
// {
|
_cerulean = {
|
||||||
inherit root specialArgs;
|
inherit inputs userArgs;
|
||||||
inherit (node) system;
|
args = ceruleanArgs;
|
||||||
_deploy-rs = inputs.deploy-rs;
|
|
||||||
};
|
};
|
||||||
modules =
|
};
|
||||||
[
|
specialArgs = assert (userArgs
|
||||||
self.nixosModules.default
|
|> attrNames
|
||||||
(findImport (root + "/hosts/${nodeName}"))
|
|> all (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 =
|
||||||
|
[
|
||||||
|
self.nixosModules.default
|
||||||
|
(findImport (root + "/hosts/${nodeName}"))
|
||||||
|
|
||||||
inputs.home-manager.nixosModules.default
|
inputs.home-manager.nixosModules.default
|
||||||
# inputs.microvm.nixosModules.microvm
|
# inputs.microvm.nixosModules.microvm
|
||||||
]
|
]
|
||||||
++ (getGroupModules root nodeName node)
|
++ (getGroupModules root nodeName node)
|
||||||
++ node.modules
|
++ node.modules
|
||||||
++ nexus.modules;
|
++ nexus.modules;
|
||||||
};
|
};
|
||||||
in
|
in
|
||||||
nixosDecl
|
nixosDecl
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -93,7 +93,7 @@ in rec {
|
||||||
'';
|
'';
|
||||||
in
|
in
|
||||||
f {
|
f {
|
||||||
inherit nodeName node;
|
inherit nodeName node base;
|
||||||
lib = base.lib;
|
inherit (base) lib;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -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
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -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;
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue