Extract resource module from makeDeployments

This commit is contained in:
Nicolas Jeannerod 2025-02-21 12:28:06 +01:00
parent 398dc05ad5
commit df78965bf4
Signed by untrusted user: Niols
GPG key ID: 35DB9EC8886E1CB8

View file

@ -11,20 +11,26 @@ let
addDefaultDeployment =
deployments: deployments // { default = concatLists (attrValues deployments); };
makeResourceModule = vmName: {
_module.args = { inherit inputs; };
imports = [
./common/resource.nix
(./. + "/${vmName}")
];
procolixVm.name = vmName;
};
makeDeployments = mapAttrs (
_: vmNames:
{ providers, ... }:
{
providers.local = inputs.nixops4.modules.nixops4Provider.local;
resources = genAttrs vmNames (vmName: {
_module.args = { inherit inputs; };
type = providers.local.exec;
imports = [
inputs.nixops4-nixos.modules.nixops4Resource.nixos
./common/resource.nix
(./. + "/${vmName}")
(makeResourceModule vmName)
];
procolixVm.name = vmName;
});
}
);