From be809d3e9930c5069672ab74d5f5c0778fcbc0b6 Mon Sep 17 00:00:00 2001 From: Kiara Grouwstra Date: Thu, 23 Oct 2025 23:04:32 +0200 Subject: [PATCH] properly propagate modulesPath Signed-off-by: Kiara Grouwstra --- deployment/check/basic/default.nix | 6 +++++- deployment/check/basic/deployment.nix | 3 ++- deployment/check/basic/flake-under-test.nix | 9 +++++++-- deployment/check/cli/default.nix | 6 +++++- deployment/check/cli/deployments.nix | 3 ++- deployment/check/cli/flake-under-test.nix | 8 +++++++- deployment/check/common/deployerNode.nix | 3 ++- deployment/check/common/nixosTest.nix | 3 ++- deployment/check/common/targetResource.nix | 3 ++- deployment/check/common/utils.nix | 4 ++-- deployment/check/data-model-nixops4/data-model.nix | 7 ++++--- deployment/check/data-model-nixops4/default.nix | 6 +++++- .../check/data-model-nixops4/flake-under-test.nix | 4 ++-- deployment/check/data-model-ssh/data-model.nix | 7 ++++--- deployment/check/data-model-ssh/default.nix | 6 +++++- deployment/check/data-model-ssh/nixosTest.nix | 3 ++- deployment/check/data-model-tf-proxmox/default.nix | 5 ++++- deployment/check/data-model-tf-proxmox/nixosTest.nix | 5 +++-- .../check/data-model-tf-proxmox/setups/template.nix | 3 ++- deployment/check/data-model-tf-proxmox/setups/vm.nix | 3 ++- deployment/check/data-model-tf/data-model.nix | 7 ++++--- deployment/check/data-model-tf/default.nix | 5 ++++- deployment/check/data-model-tf/nixosTest.nix | 3 ++- deployment/check/panel/default.nix | 6 +++++- deployment/check/panel/deployment.nix | 3 ++- deployment/check/panel/flake-under-test.nix | 8 +++++++- deployment/check/proxmox/default.nix | 1 + deployment/flake-part.nix | 10 +++++----- deployment/utils.nix | 1 + 29 files changed, 100 insertions(+), 41 deletions(-) diff --git a/deployment/check/basic/default.nix b/deployment/check/basic/default.nix index 176defce..fe53cf4f 100644 --- a/deployment/check/basic/default.nix +++ b/deployment/check/basic/default.nix @@ -1,4 +1,5 @@ { + pkgs, runNixOSTest, inputs, sources, @@ -9,7 +10,10 @@ runNixOSTest { ../common/nixosTest.nix ./nixosTest.nix ]; - _module.args = { inherit inputs sources; }; + _module.args = { + inherit inputs sources; + modulesPath = "${builtins.toString pkgs.path}/nixos/modules"; + }; inherit (import ./constants.nix) targetMachines pathToRoot diff --git a/deployment/check/basic/deployment.nix b/deployment/check/basic/deployment.nix index 14a35ac6..214219f5 100644 --- a/deployment/check/basic/deployment.nix +++ b/deployment/check/basic/deployment.nix @@ -3,6 +3,7 @@ sources, lib, providers, + modulesPath, ... }: @@ -23,7 +24,7 @@ in ../common/targetResource.nix ]; - _module.args = { inherit inputs sources; }; + _module.args = { inherit inputs sources modulesPath; }; inherit nodeName pathToRoot pathFromRoot; diff --git a/deployment/check/basic/flake-under-test.nix b/deployment/check/basic/flake-under-test.nix index b9e3fb4b..bc4b8079 100644 --- a/deployment/check/basic/flake-under-test.nix +++ b/deployment/check/basic/flake-under-test.nix @@ -7,7 +7,12 @@ outputs = inputs: import ./mkFlake.nix inputs ( - { inputs, sources, ... }: + { + inputs, + sources, + modulePath, + ... + }: { imports = [ inputs.nixops4.modules.flake.default @@ -15,7 +20,7 @@ nixops4Deployments.check-deployment-basic = { imports = [ ./deployment/check/basic/deployment.nix ]; - _module.args = { inherit inputs sources; }; + _module.args = { inherit inputs sources modulePath; }; }; } ); diff --git a/deployment/check/cli/default.nix b/deployment/check/cli/default.nix index 64448280..aed1f301 100644 --- a/deployment/check/cli/default.nix +++ b/deployment/check/cli/default.nix @@ -1,4 +1,5 @@ { + pkgs, runNixOSTest, inputs, sources, @@ -9,7 +10,10 @@ runNixOSTest { ../common/nixosTest.nix ./nixosTest.nix ]; - _module.args = { inherit inputs sources; }; + _module.args = { + inherit inputs sources; + modulesPath = "${builtins.toString pkgs.path}/nixos/modules"; + }; inherit (import ./constants.nix) targetMachines pathToRoot diff --git a/deployment/check/cli/deployments.nix b/deployment/check/cli/deployments.nix index f4e72eaf..b303e291 100644 --- a/deployment/check/cli/deployments.nix +++ b/deployment/check/cli/deployments.nix @@ -2,6 +2,7 @@ inputs, sources, lib, + modulesPath, }: let @@ -15,7 +16,7 @@ let makeTargetResource = nodeName: { imports = [ ../common/targetResource.nix ]; - _module.args = { inherit inputs sources; }; + _module.args = { inherit inputs sources modulesPath; }; inherit nodeName pathToRoot diff --git a/deployment/check/cli/flake-under-test.nix b/deployment/check/cli/flake-under-test.nix index fa172890..27f8be20 100644 --- a/deployment/check/cli/flake-under-test.nix +++ b/deployment/check/cli/flake-under-test.nix @@ -11,6 +11,7 @@ inputs, sources, lib, + modulePath, ... }: { @@ -19,7 +20,12 @@ ]; nixops4Deployments = import ./deployment/check/cli/deployments.nix { - inherit inputs sources lib; + inherit + inputs + sources + lib + modulePath + ; }; } ); diff --git a/deployment/check/common/deployerNode.nix b/deployment/check/common/deployerNode.nix index 4fc673ea..1948e388 100644 --- a/deployment/check/common/deployerNode.nix +++ b/deployment/check/common/deployerNode.nix @@ -3,6 +3,7 @@ lib, pkgs, config, + modulesPath, sources, ... }: @@ -75,7 +76,7 @@ in machine = (pkgs.nixos [ ./targetNode.nix - "${sources.nixpkgs}/nixos/lib/testing/nixos-test-base.nix" + "${modulesPath}/../lib/testing/nixos-test-base.nix" config.system.extraDependenciesFromModule { nixpkgs.hostPlatform = "x86_64-linux"; diff --git a/deployment/check/common/nixosTest.nix b/deployment/check/common/nixosTest.nix index d12bca3f..ac2c6b4d 100644 --- a/deployment/check/common/nixosTest.nix +++ b/deployment/check/common/nixosTest.nix @@ -4,6 +4,7 @@ config, hostPkgs, sources, + modulesPath, ... }: @@ -114,7 +115,7 @@ in (genAttrs config.targetMachines (_: { imports = [ ./targetNode.nix - ] ++ (lib.optional config.useFlake "${sources.nixpkgs}/nixos/lib/testing/nixos-test-base.nix"); + ] ++ (lib.optional config.useFlake "${modulesPath}/../lib/testing/nixos-test-base.nix"); _module.args = { inherit inputs sources; }; enableAcme = config.enableAcme; acmeNodeIP = if config.enableAcme then config.nodes.acme.networking.primaryIPAddress else null; diff --git a/deployment/check/common/targetResource.nix b/deployment/check/common/targetResource.nix index 32215dc3..3e7eb2e1 100644 --- a/deployment/check/common/targetResource.nix +++ b/deployment/check/common/targetResource.nix @@ -3,6 +3,7 @@ lib, config, sources, + modulesPath, ... }: @@ -39,7 +40,7 @@ in imports = [ ./targetNode.nix (lib.modules.importJSON (config.pathToCwd + "/${config.nodeName}-network.json")) - "${sources.nixpkgs}/nixos/lib/testing/nixos-test-base.nix" + "${modulesPath}/../lib/testing/nixos-test-base.nix" ]; _module.args = { inherit inputs sources; }; diff --git a/deployment/check/common/utils.nix b/deployment/check/common/utils.nix index ba27c050..14001cda 100644 --- a/deployment/check/common/utils.nix +++ b/deployment/check/common/utils.nix @@ -1,6 +1,6 @@ { lib, - sources ? import ../../../npins, + modulesPath, ... }: { @@ -11,7 +11,7 @@ imports = [ ../common/sharedOptions.nix ../common/targetNode.nix - "${sources.nixpkgs}/nixos/modules/profiles/qemu-guest.nix" + "${modulesPath}/profiles/qemu-guest.nix" ]; users.users = environment.config.resources."operator-environment".login-shell.apply { diff --git a/deployment/check/data-model-nixops4/data-model.nix b/deployment/check/data-model-nixops4/data-model.nix index d531cae7..dd34c378 100644 --- a/deployment/check/data-model-nixops4/data-model.nix +++ b/deployment/check/data-model-nixops4/data-model.nix @@ -1,6 +1,7 @@ { config, system, + modulesPath, inputs, sources ? import ../../../npins, ... @@ -9,7 +10,7 @@ let inherit (sources) nixpkgs; pkgs = import nixpkgs { inherit system; }; inherit (pkgs) lib; - inherit (pkgs.callPackage ../common/utils.nix { }) mkNixosConfiguration; + inherit (pkgs.callPackage ../common/utils.nix { inherit modulesPath; }) mkNixosConfiguration; inherit (config) nodeName pathFromRoot @@ -17,7 +18,7 @@ let ; in (pkgs.callPackage ../../utils.nix { inherit inputs; }).evalModel ( - { config, ... }: + { config, modulesPath, ... }: { imports = [ ../common/model.nix ]; config = { @@ -44,7 +45,7 @@ in nixos.module = { imports = [ (mkNixosConfiguration environment required-resources) - "${sources.nixpkgs}/nixos/lib/testing/nixos-test-base.nix" + "${modulesPath}/../lib/testing/nixos-test-base.nix" ]; }; _module.args = { inherit inputs sources; }; diff --git a/deployment/check/data-model-nixops4/default.nix b/deployment/check/data-model-nixops4/default.nix index a08d4cd4..4041c0a0 100644 --- a/deployment/check/data-model-nixops4/default.nix +++ b/deployment/check/data-model-nixops4/default.nix @@ -1,4 +1,5 @@ { + pkgs, runNixOSTest, inputs, sources, @@ -11,7 +12,10 @@ runNixOSTest { ../common/nixosTest.nix ./nixosTest.nix ]; - _module.args = { inherit inputs sources; }; + _module.args = { + inherit inputs sources; + modulesPath = "${builtins.toString pkgs.path}/nixos/modules"; + }; inherit (import ./constants.nix) targetMachines pathToRoot diff --git a/deployment/check/data-model-nixops4/flake-under-test.nix b/deployment/check/data-model-nixops4/flake-under-test.nix index e9dbc484..38bbd0a9 100644 --- a/deployment/check/data-model-nixops4/flake-under-test.nix +++ b/deployment/check/data-model-nixops4/flake-under-test.nix @@ -7,7 +7,7 @@ outputs = inputs: import ./mkFlake.nix inputs ( - { inputs, ... }: + { inputs, modulesPath, ... }: let system = "x86_64-linux"; in @@ -18,7 +18,7 @@ nixops4Deployments.check-deployment-model = (import ./deployment/check/data-model-nixops4/data-model.nix { - inherit system inputs; + inherit system inputs modulesPath; config = { inherit (import ./deployment/check/data-model-nixops4/constants.nix) pathToRoot pathFromRoot; nodeName = "nixops4"; diff --git a/deployment/check/data-model-ssh/data-model.nix b/deployment/check/data-model-ssh/data-model.nix index 3477ac7a..91aa69b1 100644 --- a/deployment/check/data-model-ssh/data-model.nix +++ b/deployment/check/data-model-ssh/data-model.nix @@ -1,6 +1,7 @@ { config, system, + modulesPath, sources ? import ../../../npins, ... }@args: @@ -8,7 +9,7 @@ let inherit (sources) nixpkgs; pkgs = import nixpkgs { inherit system; }; inherit (pkgs) lib; - inherit (pkgs.callPackage ../common/utils.nix { }) mkNixosConfiguration; + inherit (pkgs.callPackage ../common/utils.nix { inherit modulesPath; }) mkNixosConfiguration; inherit (config) nodeName pathToRoot @@ -17,7 +18,7 @@ let ; in (pkgs.callPackage ../../utils.nix { }).evalModel ( - { config, ... }: + { config, modulesPath, ... }: { imports = [ ../common/model.nix ]; config = { @@ -34,7 +35,7 @@ in nixos-configuration = { imports = [ (mkNixosConfiguration environment required-resources) - "${sources.nixpkgs}/nixos/lib/testing/nixos-test-base.nix" + "${modulesPath}/../lib/testing/nixos-test-base.nix" ]; }; system = targetSystem; diff --git a/deployment/check/data-model-ssh/default.nix b/deployment/check/data-model-ssh/default.nix index 86ddafb9..5adb5c89 100644 --- a/deployment/check/data-model-ssh/default.nix +++ b/deployment/check/data-model-ssh/default.nix @@ -1,4 +1,5 @@ { + pkgs, runNixOSTest, inputs, sources, @@ -11,7 +12,10 @@ runNixOSTest { ../common/nixosTest.nix ./nixosTest.nix ]; - _module.args = { inherit inputs sources; }; + _module.args = { + inherit inputs sources; + modulesPath = "${builtins.toString pkgs.path}/nixos/modules"; + }; inherit (import ./constants.nix) targetMachines pathToRoot diff --git a/deployment/check/data-model-ssh/nixosTest.nix b/deployment/check/data-model-ssh/nixosTest.nix index 5efdadc8..f97ccaa1 100644 --- a/deployment/check/data-model-ssh/nixosTest.nix +++ b/deployment/check/data-model-ssh/nixosTest.nix @@ -1,6 +1,7 @@ { lib, pkgs, + modulesPath, ... }: let @@ -8,7 +9,7 @@ let nodeName = "ssh"; deploy = (import ./data-model.nix { - inherit system; + inherit system modulesPath; config = { inherit nodeName; inherit (import ./constants.nix) pathToRoot; diff --git a/deployment/check/data-model-tf-proxmox/default.nix b/deployment/check/data-model-tf-proxmox/default.nix index c8629c20..16fedf49 100644 --- a/deployment/check/data-model-tf-proxmox/default.nix +++ b/deployment/check/data-model-tf-proxmox/default.nix @@ -42,7 +42,10 @@ pkgs.testers.runNixOSTest { ../common/nixosTest.nix ./nixosTest.nix ]; - _module.args = { inherit inputs sources; }; + _module.args = { + inherit inputs sources; + modulesPath = "${builtins.toString pkgs.path}/nixos/modules"; + }; inherit (import ./constants.nix) targetMachines pathToRoot diff --git a/deployment/check/data-model-tf-proxmox/nixosTest.nix b/deployment/check/data-model-tf-proxmox/nixosTest.nix index 2effe440..66c1d141 100644 --- a/deployment/check/data-model-tf-proxmox/nixosTest.nix +++ b/deployment/check/data-model-tf-proxmox/nixosTest.nix @@ -1,6 +1,7 @@ { lib, pkgs, + modulesPath, sources, ... }: @@ -17,7 +18,7 @@ let # FIXME generate the image `nixos-generate` was to make, but now do it for a desired `-c configuration.nix` rather than whatever generic thing now template-deployment = (import ./setups/template.nix { - inherit sources system; + inherit sources system modulesPath; config = { httpBackend = tfBackend "proxmox-test/upload"; nodeName = "pve"; @@ -28,7 +29,7 @@ let }).default.tf-proxmox-template; vm-deployment = (import ./setups/vm.nix { - inherit sources system; + inherit sources system modulesPath; config = { httpBackend = tfBackend "proxmox-test/nixos"; inherit (import ./constants.nix) pathToRoot; diff --git a/deployment/check/data-model-tf-proxmox/setups/template.nix b/deployment/check/data-model-tf-proxmox/setups/template.nix index d19d3a97..2e4c4665 100644 --- a/deployment/check/data-model-tf-proxmox/setups/template.nix +++ b/deployment/check/data-model-tf-proxmox/setups/template.nix @@ -1,6 +1,7 @@ { config, system, + modulesPath, sources ? import ../../../../npins, ... }: @@ -8,7 +9,7 @@ let inherit (sources) nixpkgs; pkgs = import nixpkgs { inherit system; }; inherit (pkgs) lib; - inherit (pkgs.callPackage ../../common/utils.nix { inherit sources; }) mkNixosConfiguration; + inherit (pkgs.callPackage ../../common/utils.nix { inherit modulesPath; }) mkNixosConfiguration; inherit (config) nodeName targetSystem diff --git a/deployment/check/data-model-tf-proxmox/setups/vm.nix b/deployment/check/data-model-tf-proxmox/setups/vm.nix index df91b06d..167eb8e3 100644 --- a/deployment/check/data-model-tf-proxmox/setups/vm.nix +++ b/deployment/check/data-model-tf-proxmox/setups/vm.nix @@ -1,6 +1,7 @@ { config, system, + modulesPath, sources ? import ../../../../npins, ... }@args: @@ -8,7 +9,7 @@ let inherit (sources) nixpkgs; pkgs = import nixpkgs { inherit system; }; inherit (pkgs) lib; - inherit (pkgs.callPackage ../../common/utils.nix { inherit sources; }) mkNixosConfiguration; + inherit (pkgs.callPackage ../../common/utils.nix { inherit modulesPath; }) mkNixosConfiguration; inherit (config) nodeName pathToRoot diff --git a/deployment/check/data-model-tf/data-model.nix b/deployment/check/data-model-tf/data-model.nix index 5dab2094..e204475f 100644 --- a/deployment/check/data-model-tf/data-model.nix +++ b/deployment/check/data-model-tf/data-model.nix @@ -2,13 +2,14 @@ config, system, sources ? import ../../../npins, + modulesPath, ... }@args: let inherit (sources) nixpkgs; pkgs = import nixpkgs { inherit system; }; inherit (pkgs) lib; - inherit (pkgs.callPackage ../common/utils.nix { }) mkNixosConfiguration; + inherit (pkgs.callPackage ../common/utils.nix { inherit modulesPath; }) mkNixosConfiguration; inherit (config) nodeName pathToRoot @@ -18,7 +19,7 @@ let ; in (pkgs.callPackage ../../utils.nix { }).evalModel ( - { config, ... }: + { config, modulesPath, ... }: { imports = [ ../common/model.nix ]; config = { @@ -34,7 +35,7 @@ in nixos-configuration = { imports = [ (mkNixosConfiguration environment required-resources) - "${sources.nixpkgs}/nixos/lib/testing/nixos-test-base.nix" + "${modulesPath}/../lib/testing/nixos-test-base.nix" ]; }; system = targetSystem; diff --git a/deployment/check/data-model-tf/default.nix b/deployment/check/data-model-tf/default.nix index 8361293e..9fb576a6 100644 --- a/deployment/check/data-model-tf/default.nix +++ b/deployment/check/data-model-tf/default.nix @@ -43,7 +43,10 @@ pkgs.testers.runNixOSTest { ../common/nixosTest.nix ./nixosTest.nix ]; - _module.args = { inherit inputs sources; }; + _module.args = { + inherit inputs sources; + modulesPath = "${builtins.toString pkgs.path}/nixos/modules"; + }; inherit (import ./constants.nix) targetMachines pathToRoot diff --git a/deployment/check/data-model-tf/nixosTest.nix b/deployment/check/data-model-tf/nixosTest.nix index 4bbca5f1..46ea4d35 100644 --- a/deployment/check/data-model-tf/nixosTest.nix +++ b/deployment/check/data-model-tf/nixosTest.nix @@ -2,6 +2,7 @@ lib, pkgs, sources, + modulesPath, ... }: let @@ -11,7 +12,7 @@ let backendPort = builtins.toString 8080; deploy = (import ./data-model.nix { - inherit system; + inherit system modulesPath; config = { inherit nodeName pathToRoot; targetSystem = system; diff --git a/deployment/check/panel/default.nix b/deployment/check/panel/default.nix index 64448280..aed1f301 100644 --- a/deployment/check/panel/default.nix +++ b/deployment/check/panel/default.nix @@ -1,4 +1,5 @@ { + pkgs, runNixOSTest, inputs, sources, @@ -9,7 +10,10 @@ runNixOSTest { ../common/nixosTest.nix ./nixosTest.nix ]; - _module.args = { inherit inputs sources; }; + _module.args = { + inherit inputs sources; + modulesPath = "${builtins.toString pkgs.path}/nixos/modules"; + }; inherit (import ./constants.nix) targetMachines pathToRoot diff --git a/deployment/check/panel/deployment.nix b/deployment/check/panel/deployment.nix index cb3618dd..82374134 100644 --- a/deployment/check/panel/deployment.nix +++ b/deployment/check/panel/deployment.nix @@ -2,6 +2,7 @@ inputs, sources, lib, + modulesPath, }: let @@ -15,7 +16,7 @@ let makeTargetResource = nodeName: { imports = [ ../common/targetResource.nix ]; - _module.args = { inherit inputs sources; }; + _module.args = { inherit inputs sources modulesPath; }; inherit nodeName pathToRoot diff --git a/deployment/check/panel/flake-under-test.nix b/deployment/check/panel/flake-under-test.nix index 23ecec02..584add1a 100644 --- a/deployment/check/panel/flake-under-test.nix +++ b/deployment/check/panel/flake-under-test.nix @@ -11,6 +11,7 @@ inputs, sources, lib, + modulePath, ... }: { @@ -19,7 +20,12 @@ ]; nixops4Deployments.check-deployment-panel = import ./deployment/check/panel/deployment.nix { - inherit inputs sources lib; + inherit + inputs + sources + lib + modulePath + ; }; } ); diff --git a/deployment/check/proxmox/default.nix b/deployment/check/proxmox/default.nix index 78aa4046..84f35fbd 100644 --- a/deployment/check/proxmox/default.nix +++ b/deployment/check/proxmox/default.nix @@ -30,6 +30,7 @@ runNixOSTest { sources pkgs ; + modulesPath = "${builtins.toString pkgs.path}/nixos/modules"; }; imports = [ ./proxmoxTest.nix diff --git a/deployment/flake-part.nix b/deployment/flake-part.nix index 6ca47b4c..002e71c8 100644 --- a/deployment/flake-part.nix +++ b/deployment/flake-part.nix @@ -14,27 +14,27 @@ deployment-basic = import ./check/basic { inherit (pkgs.testers) runNixOSTest; - inherit inputs sources; + inherit pkgs inputs sources; }; deployment-cli = import ./check/cli { inherit (pkgs.testers) runNixOSTest; - inherit inputs sources; + inherit pkgs inputs sources; }; deployment-panel = import ./check/panel { inherit (pkgs.testers) runNixOSTest; - inherit inputs sources; + inherit pkgs inputs sources; }; deployment-model-ssh = import ./check/data-model-ssh { inherit (pkgs.testers) runNixOSTest; - inherit inputs sources; + inherit pkgs inputs sources; }; deployment-model-nixops4 = import ./check/data-model-nixops4 { inherit (pkgs.testers) runNixOSTest; - inherit inputs sources; + inherit pkgs inputs sources; }; deployment-model-tf = import ./check/data-model-tf { diff --git a/deployment/utils.nix b/deployment/utils.nix index 1229bf37..69345931 100644 --- a/deployment/utils.nix +++ b/deployment/utils.nix @@ -10,6 +10,7 @@ (lib.evalModules { specialArgs = { inherit pkgs inputs; + modulesPath = "${builtins.toString pkgs.path}/nixos/modules"; }; modules = [ ./data-model.nix