Expose a NixOS configuration for each VM in infra
This commit is contained in:
parent
df78965bf4
commit
722afdc5ea
1 changed files with 48 additions and 7 deletions
|
@ -5,8 +5,14 @@
|
||||||
}:
|
}:
|
||||||
|
|
||||||
let
|
let
|
||||||
inherit (lib) attrValues concatLists mapAttrs;
|
inherit (lib)
|
||||||
inherit (lib.attrsets) genAttrs;
|
attrValues
|
||||||
|
concatLists
|
||||||
|
mapAttrs
|
||||||
|
mkOption
|
||||||
|
evalModules
|
||||||
|
;
|
||||||
|
inherit (lib.attrsets) concatMapAttrs genAttrs;
|
||||||
|
|
||||||
addDefaultDeployment =
|
addDefaultDeployment =
|
||||||
deployments: deployments // { default = concatLists (attrValues deployments); };
|
deployments: deployments // { default = concatLists (attrValues deployments); };
|
||||||
|
@ -35,11 +41,39 @@ let
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
in
|
nixops4ResourceNixosMockOptions = {
|
||||||
{
|
## NOTE: We allow the use of a few options from
|
||||||
flake.lib.makeInstallerIso = import ./makeInstallerIso.nix;
|
## `inputs.nixops4-nixos.modules.nixops4Resource.nixos` such that we can
|
||||||
|
## reuse modules that make use of them.
|
||||||
|
##
|
||||||
|
## REVIEW: We can probably do much better and cleaner. On the other hand,
|
||||||
|
## this is only needed to expose NixOS configurations for provisioning
|
||||||
|
## purposes, and eventually all of this should be handled by NixOps4.
|
||||||
|
options = {
|
||||||
|
nixos.module = mkOption { }; # NOTE: not just `nixos` otherwise merging will go wrong
|
||||||
|
nixpkgs = mkOption { };
|
||||||
|
ssh = mkOption { };
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
nixops4Deployments = makeDeployments (addDefaultDeployment {
|
makeConfigurations = concatMapAttrs (
|
||||||
|
_: vmNames:
|
||||||
|
genAttrs vmNames (
|
||||||
|
vmName:
|
||||||
|
inputs.nixpkgs.lib.nixosSystem {
|
||||||
|
modules = [
|
||||||
|
(evalModules {
|
||||||
|
modules = [
|
||||||
|
nixops4ResourceNixosMockOptions
|
||||||
|
(makeResourceModule vmName)
|
||||||
|
];
|
||||||
|
}).config.nixos.module
|
||||||
|
];
|
||||||
|
}
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
machines = {
|
||||||
git = [
|
git = [
|
||||||
"vm02116"
|
"vm02116"
|
||||||
"fedi300"
|
"fedi300"
|
||||||
|
@ -49,5 +83,12 @@ in
|
||||||
"vm02179"
|
"vm02179"
|
||||||
"vm02186"
|
"vm02186"
|
||||||
];
|
];
|
||||||
});
|
};
|
||||||
|
|
||||||
|
in
|
||||||
|
{
|
||||||
|
flake.lib.makeInstallerIso = import ./makeInstallerIso.nix;
|
||||||
|
|
||||||
|
nixops4Deployments = makeDeployments (addDefaultDeployment machines);
|
||||||
|
flake.nixosConfigurations = makeConfigurations machines;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue