diff --git a/infra/flake-part.nix b/infra/flake-part.nix index cf26e87c..81dba2ac 100644 --- a/infra/flake-part.nix +++ b/infra/flake-part.nix @@ -56,23 +56,40 @@ let }; }; + makeResourceConfig = + vmName: + (evalModules { + modules = [ + nixops4ResourceNixosMockOptions + (makeResourceModule vmName) + ]; + }).config; + makeConfigurations = concatMapAttrs ( _: vmNames: genAttrs vmNames ( vmName: inputs.nixpkgs.lib.nixosSystem { modules = [ - (evalModules { - modules = [ - nixops4ResourceNixosMockOptions - (makeResourceModule vmName) - ]; - }).config.nixos.module + (makeResourceConfig vmName).nixos.module ]; } ) ); + makeVmOptions = concatMapAttrs ( + _: vmNames: + genAttrs vmNames (vmName: { + inherit ((makeResourceConfig vmName).fediversityVm) + proxmox + vmId + sockets + cores + memory + ; + }) + ); + machines = { git = [ "vm02116" @@ -94,6 +111,10 @@ in { flake.lib.makeInstallerIso = import ./makeInstallerIso.nix; + ## REVIEW: It would probably make more sense to have the VM names as parent of + ## the corresponding resource, NixOS configuration, and VM options, rather + ## than the contrary. nixops4Deployments = makeDeployments (addDefaultDeployment machines); flake.nixosConfigurations = makeConfigurations machines; + flake.vmOptions = makeVmOptions machines; }