diff --git a/deployment/check/data-model-tf-proxmox/setups/vm.nix b/deployment/check/data-model-tf-proxmox/data-model.nix similarity index 89% rename from deployment/check/data-model-tf-proxmox/setups/vm.nix rename to deployment/check/data-model-tf-proxmox/data-model.nix index 167eb8e3..86e23159 100644 --- a/deployment/check/data-model-tf-proxmox/setups/vm.nix +++ b/deployment/check/data-model-tf-proxmox/data-model.nix @@ -2,14 +2,14 @@ config, system, modulesPath, - sources ? import ../../../../npins, + sources ? import ../../../npins, ... }@args: let inherit (sources) nixpkgs; pkgs = import nixpkgs { inherit system; }; inherit (pkgs) lib; - inherit (pkgs.callPackage ../../common/utils.nix { inherit modulesPath; }) mkNixosConfiguration; + inherit (pkgs.callPackage ../common/utils.nix { inherit modulesPath; }) mkNixosConfiguration; inherit (config) nodeName pathToRoot @@ -30,10 +30,10 @@ let ipv6Address ; in -(pkgs.callPackage ../../../utils.nix { }).evalModel ( +(pkgs.callPackage ../../utils.nix { }).evalModel ( { config, ... }: { - imports = [ ../../common/model.nix ]; + imports = [ ../common/model.nix ]; config = { environments.default = environment: { resources."operator-environment".login-shell = { diff --git a/deployment/check/data-model-tf-proxmox/nixosTest.nix b/deployment/check/data-model-tf-proxmox/nixosTest.nix index 79a4cece..09389b3d 100644 --- a/deployment/check/data-model-tf-proxmox/nixosTest.nix +++ b/deployment/check/data-model-tf-proxmox/nixosTest.nix @@ -7,23 +7,61 @@ }: let inherit (pkgs) system; + inherit (pkgs.callPackage ../../utils.nix { }) evalModel; + inherit (pkgs.callPackage ../common/utils.nix { inherit modulesPath; }) mkNixosConfiguration; backendPort = builtins.toString 8080; tfBackend = fragment: { address = "http://localhost:${backendPort}/state/${fragment}"; }; template-deployment = - (import ./setups/template.nix { - inherit sources system modulesPath; - config = { - httpBackend = tfBackend "proxmox-test/upload"; - nodeName = "pve"; - targetSystem = system; - node-name = "pve"; - imageDatastoreId = "local"; - }; - }).default.tf-proxmox-template; + (evalModel ( + { config, ... }: + { + imports = [ ../common/model.nix ]; + config = { + environments.default = environment: { + resources."operator-environment".login-shell = { + wheel = true; + username = "operator"; + }; + implementation = + { + required-resources, + ... + }: + { + tf-proxmox-template = { + nixos-configuration = { + imports = [ + (mkNixosConfiguration environment required-resources) + ./shared.nix + ]; + }; + inherit system; + ssh.host = "pve"; + httpBackend = tfBackend "proxmox-test/upload"; + node-name = "pve"; + imageDatastoreId = "local"; + }; + }; + }; + }; + options.default = + let + env = config.environments.default; + in + lib.mkOption { + type = env.resource-mapping.output-type; + default = env.deployment { + deployment-name = "default"; + # normally our template is distinct, but our test cannot download build deps due to sandboxing + configuration = config."example-configuration"; + }; + }; + } + )).default.tf-proxmox-template; vm-deployment = - (import ./setups/vm.nix { + (import ./data-model.nix { inherit sources system modulesPath; config = { httpBackend = tfBackend "proxmox-test/nixos"; diff --git a/deployment/check/data-model-tf-proxmox/setups/template.nix b/deployment/check/data-model-tf-proxmox/setups/template.nix deleted file mode 100644 index 983ef8c9..00000000 --- a/deployment/check/data-model-tf-proxmox/setups/template.nix +++ /dev/null @@ -1,70 +0,0 @@ -{ - config, - system, - modulesPath, - sources ? import ../../../../npins, - ... -}: -let - inherit (sources) nixpkgs; - pkgs = import nixpkgs { inherit system; }; - inherit (pkgs) lib; - inherit (pkgs.callPackage ../../common/utils.nix { inherit modulesPath; }) mkNixosConfiguration; - inherit (config) - nodeName - targetSystem - httpBackend - node-name - imageDatastoreId - ; -in -(pkgs.callPackage ../../../utils.nix { }).evalModel ( - { config, ... }: - { - imports = [ ../../common/model.nix ]; - config = { - environments.default = environment: { - resources."operator-environment".login-shell = { - wheel = true; - username = "operator"; - }; - implementation = - { - required-resources, - ... - }: - { - tf-proxmox-template = { - nixos-configuration = { - imports = [ - (mkNixosConfiguration environment required-resources) - ./shared.nix - ]; - }; - system = targetSystem; - ssh = { - host = nodeName; - }; - inherit - node-name - httpBackend - imageDatastoreId - ; - }; - }; - }; - }; - options.default = - let - env = config.environments.default; - in - lib.mkOption { - type = env.resource-mapping.output-type; - default = env.deployment { - deployment-name = "default"; - # normally our template is distinct, but our test cannot download build deps due to sandboxing - configuration = config."example-configuration"; - }; - }; - } -) diff --git a/deployment/check/data-model-tf-proxmox/setups/shared.nix b/deployment/check/data-model-tf-proxmox/shared.nix similarity index 94% rename from deployment/check/data-model-tf-proxmox/setups/shared.nix rename to deployment/check/data-model-tf-proxmox/shared.nix index 3ea6b94e..69f803a0 100644 --- a/deployment/check/data-model-tf-proxmox/setups/shared.nix +++ b/deployment/check/data-model-tf-proxmox/shared.nix @@ -1,12 +1,12 @@ { lib, - sources ? import ../../../../npins, + sources ? import ../../../npins, ... }: { imports = [ "${sources.disko}/module.nix" - ../../../../infra/common/proxmox-qemu-vm.nix + ../../../infra/common/proxmox-qemu-vm.nix ]; networking.useDHCP = false; services.qemuGuest.enable = true;