properly propagate modulesPath

Signed-off-by: Kiara Grouwstra <kiara@procolix.eu>
This commit is contained in:
Kiara Grouwstra 2025-10-23 23:04:32 +02:00
parent ccc7d24bf0
commit f5b8304475
Signed by: kiara
SSH key fingerprint: SHA256:COspvLoLJ5WC5rFb9ZDe5urVCkK4LJZOsjfF4duRJFU
30 changed files with 104 additions and 43 deletions

View file

@ -1,4 +1,5 @@
{ {
pkgs,
runNixOSTest, runNixOSTest,
inputs, inputs,
sources, sources,
@ -9,7 +10,10 @@ runNixOSTest {
../common/nixosTest.nix ../common/nixosTest.nix
./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) inherit (import ./constants.nix)
targetMachines targetMachines
pathToRoot pathToRoot

View file

@ -3,6 +3,7 @@
sources, sources,
lib, lib,
providers, providers,
modulesPath,
... ...
}: }:
@ -23,7 +24,7 @@ in
../common/targetResource.nix ../common/targetResource.nix
]; ];
_module.args = { inherit inputs sources; }; _module.args = { inherit inputs sources modulesPath; };
inherit nodeName pathToRoot pathFromRoot; inherit nodeName pathToRoot pathFromRoot;

View file

@ -7,7 +7,12 @@
outputs = outputs =
inputs: inputs:
import ./mkFlake.nix inputs ( import ./mkFlake.nix inputs (
{ inputs, sources, ... }: {
inputs,
sources,
modulesPath,
...
}:
{ {
imports = [ imports = [
inputs.nixops4.modules.flake.default inputs.nixops4.modules.flake.default
@ -15,7 +20,7 @@
nixops4Deployments.check-deployment-basic = { nixops4Deployments.check-deployment-basic = {
imports = [ ./deployment/check/basic/deployment.nix ]; imports = [ ./deployment/check/basic/deployment.nix ];
_module.args = { inherit inputs sources; }; _module.args = { inherit inputs sources modulesPath; };
}; };
} }
); );

View file

@ -1,4 +1,5 @@
{ {
pkgs,
runNixOSTest, runNixOSTest,
inputs, inputs,
sources, sources,
@ -9,7 +10,10 @@ runNixOSTest {
../common/nixosTest.nix ../common/nixosTest.nix
./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) inherit (import ./constants.nix)
targetMachines targetMachines
pathToRoot pathToRoot

View file

@ -2,6 +2,7 @@
inputs, inputs,
sources, sources,
lib, lib,
modulesPath,
}: }:
let let
@ -15,7 +16,7 @@ let
makeTargetResource = nodeName: { makeTargetResource = nodeName: {
imports = [ ../common/targetResource.nix ]; imports = [ ../common/targetResource.nix ];
_module.args = { inherit inputs sources; }; _module.args = { inherit inputs sources modulesPath; };
inherit inherit
nodeName nodeName
pathToRoot pathToRoot

View file

@ -11,6 +11,7 @@
inputs, inputs,
sources, sources,
lib, lib,
modulesPath,
... ...
}: }:
{ {
@ -19,7 +20,12 @@
]; ];
nixops4Deployments = import ./deployment/check/cli/deployments.nix { nixops4Deployments = import ./deployment/check/cli/deployments.nix {
inherit inputs sources lib; inherit
inputs
sources
lib
modulesPath
;
}; };
} }
); );

View file

@ -3,6 +3,7 @@
lib, lib,
pkgs, pkgs,
config, config,
modulesPath,
sources, sources,
... ...
}: }:
@ -75,7 +76,7 @@ in
machine = machine =
(pkgs.nixos [ (pkgs.nixos [
./targetNode.nix ./targetNode.nix
"${sources.nixpkgs}/nixos/lib/testing/nixos-test-base.nix" "${modulesPath}/../lib/testing/nixos-test-base.nix"
config.system.extraDependenciesFromModule config.system.extraDependenciesFromModule
{ {
nixpkgs.hostPlatform = "x86_64-linux"; nixpkgs.hostPlatform = "x86_64-linux";

View file

@ -4,6 +4,7 @@
config, config,
hostPkgs, hostPkgs,
sources, sources,
modulesPath,
... ...
}: }:
@ -114,7 +115,7 @@ in
(genAttrs config.targetMachines (_: { (genAttrs config.targetMachines (_: {
imports = [ imports = [
./targetNode.nix ./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; }; _module.args = { inherit inputs sources; };
enableAcme = config.enableAcme; enableAcme = config.enableAcme;
acmeNodeIP = if config.enableAcme then config.nodes.acme.networking.primaryIPAddress else null; acmeNodeIP = if config.enableAcme then config.nodes.acme.networking.primaryIPAddress else null;

View file

@ -3,6 +3,7 @@
lib, lib,
config, config,
sources, sources,
modulesPath,
... ...
}: }:
@ -39,7 +40,7 @@ in
imports = [ imports = [
./targetNode.nix ./targetNode.nix
(lib.modules.importJSON (config.pathToCwd + "/${config.nodeName}-network.json")) (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; }; _module.args = { inherit inputs sources; };

View file

@ -1,6 +1,6 @@
{ {
lib, lib,
sources ? import ../../../npins, modulesPath,
... ...
}: }:
{ {
@ -11,7 +11,7 @@
imports = [ imports = [
../common/sharedOptions.nix ../common/sharedOptions.nix
../common/targetNode.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 { users.users = environment.config.resources."operator-environment".login-shell.apply {

View file

@ -1,6 +1,7 @@
{ {
config, config,
system, system,
modulesPath,
inputs, inputs,
sources ? import ../../../npins, sources ? import ../../../npins,
... ...
@ -9,7 +10,7 @@ let
inherit (sources) nixpkgs; inherit (sources) nixpkgs;
pkgs = import nixpkgs { inherit system; }; pkgs = import nixpkgs { inherit system; };
inherit (pkgs) lib; inherit (pkgs) lib;
inherit (pkgs.callPackage ../common/utils.nix { }) mkNixosConfiguration; inherit (pkgs.callPackage ../common/utils.nix { inherit modulesPath; }) mkNixosConfiguration;
inherit (config) inherit (config)
nodeName nodeName
pathFromRoot pathFromRoot
@ -17,7 +18,7 @@ let
; ;
in in
(pkgs.callPackage ../../utils.nix { inherit inputs; }).evalModel ( (pkgs.callPackage ../../utils.nix { inherit inputs; }).evalModel (
{ config, ... }: { config, modulesPath, ... }:
{ {
imports = [ ../common/model.nix ]; imports = [ ../common/model.nix ];
config = { config = {
@ -44,10 +45,10 @@ in
nixos.module = { nixos.module = {
imports = [ imports = [
(mkNixosConfiguration environment required-resources) (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; }; _module.args = { inherit inputs sources modulesPath; };
inherit nodeName pathToRoot pathFromRoot; inherit nodeName pathToRoot pathFromRoot;
}; };
}; };

View file

@ -1,4 +1,5 @@
{ {
pkgs,
runNixOSTest, runNixOSTest,
inputs, inputs,
sources, sources,
@ -11,7 +12,10 @@ runNixOSTest {
../common/nixosTest.nix ../common/nixosTest.nix
./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) inherit (import ./constants.nix)
targetMachines targetMachines
pathToRoot pathToRoot

View file

@ -7,7 +7,7 @@
outputs = outputs =
inputs: inputs:
import ./mkFlake.nix inputs ( import ./mkFlake.nix inputs (
{ inputs, ... }: { inputs, modulesPath, ... }:
let let
system = "x86_64-linux"; system = "x86_64-linux";
in in
@ -18,7 +18,7 @@
nixops4Deployments.check-deployment-model = nixops4Deployments.check-deployment-model =
(import ./deployment/check/data-model-nixops4/data-model.nix { (import ./deployment/check/data-model-nixops4/data-model.nix {
inherit system inputs; inherit system inputs modulesPath;
config = { config = {
inherit (import ./deployment/check/data-model-nixops4/constants.nix) pathToRoot pathFromRoot; inherit (import ./deployment/check/data-model-nixops4/constants.nix) pathToRoot pathFromRoot;
nodeName = "nixops4"; nodeName = "nixops4";

View file

@ -1,6 +1,7 @@
{ {
config, config,
system, system,
modulesPath,
sources ? import ../../../npins, sources ? import ../../../npins,
... ...
}@args: }@args:
@ -8,7 +9,7 @@ let
inherit (sources) nixpkgs; inherit (sources) nixpkgs;
pkgs = import nixpkgs { inherit system; }; pkgs = import nixpkgs { inherit system; };
inherit (pkgs) lib; inherit (pkgs) lib;
inherit (pkgs.callPackage ../common/utils.nix { }) mkNixosConfiguration; inherit (pkgs.callPackage ../common/utils.nix { inherit modulesPath; }) mkNixosConfiguration;
inherit (config) inherit (config)
nodeName nodeName
pathToRoot pathToRoot
@ -17,7 +18,7 @@ let
; ;
in in
(pkgs.callPackage ../../utils.nix { }).evalModel ( (pkgs.callPackage ../../utils.nix { }).evalModel (
{ config, ... }: { config, modulesPath, ... }:
{ {
imports = [ ../common/model.nix ]; imports = [ ../common/model.nix ];
config = { config = {
@ -34,7 +35,7 @@ in
nixos-configuration = { nixos-configuration = {
imports = [ imports = [
(mkNixosConfiguration environment required-resources) (mkNixosConfiguration environment required-resources)
"${sources.nixpkgs}/nixos/lib/testing/nixos-test-base.nix" "${modulesPath}/../lib/testing/nixos-test-base.nix"
]; ];
}; };
system = targetSystem; system = targetSystem;

View file

@ -1,4 +1,5 @@
{ {
pkgs,
runNixOSTest, runNixOSTest,
inputs, inputs,
sources, sources,
@ -11,7 +12,10 @@ runNixOSTest {
../common/nixosTest.nix ../common/nixosTest.nix
./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) inherit (import ./constants.nix)
targetMachines targetMachines
pathToRoot pathToRoot

View file

@ -1,6 +1,7 @@
{ {
lib, lib,
pkgs, pkgs,
modulesPath,
... ...
}: }:
let let
@ -8,7 +9,7 @@ let
nodeName = "ssh"; nodeName = "ssh";
deploy = deploy =
(import ./data-model.nix { (import ./data-model.nix {
inherit system; inherit system modulesPath;
config = { config = {
inherit nodeName; inherit nodeName;
inherit (import ./constants.nix) pathToRoot; inherit (import ./constants.nix) pathToRoot;

View file

@ -42,7 +42,10 @@ pkgs.testers.runNixOSTest {
../common/nixosTest.nix ../common/nixosTest.nix
./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) inherit (import ./constants.nix)
targetMachines targetMachines
pathToRoot pathToRoot

View file

@ -1,6 +1,7 @@
{ {
lib, lib,
pkgs, pkgs,
modulesPath,
sources, 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 # 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 = template-deployment =
(import ./setups/template.nix { (import ./setups/template.nix {
inherit sources system; inherit sources system modulesPath;
config = { config = {
httpBackend = tfBackend "proxmox-test/upload"; httpBackend = tfBackend "proxmox-test/upload";
nodeName = "pve"; nodeName = "pve";
@ -28,7 +29,7 @@ let
}).default.tf-proxmox-template; }).default.tf-proxmox-template;
vm-deployment = vm-deployment =
(import ./setups/vm.nix { (import ./setups/vm.nix {
inherit sources system; inherit sources system modulesPath;
config = { config = {
httpBackend = tfBackend "proxmox-test/nixos"; httpBackend = tfBackend "proxmox-test/nixos";
inherit (import ./constants.nix) pathToRoot; inherit (import ./constants.nix) pathToRoot;

View file

@ -1,6 +1,7 @@
{ {
config, config,
system, system,
modulesPath,
sources ? import ../../../../npins, sources ? import ../../../../npins,
... ...
}: }:
@ -8,7 +9,7 @@ let
inherit (sources) nixpkgs; inherit (sources) nixpkgs;
pkgs = import nixpkgs { inherit system; }; pkgs = import nixpkgs { inherit system; };
inherit (pkgs) lib; inherit (pkgs) lib;
inherit (pkgs.callPackage ../../common/utils.nix { inherit sources; }) mkNixosConfiguration; inherit (pkgs.callPackage ../../common/utils.nix { inherit modulesPath; }) mkNixosConfiguration;
inherit (config) inherit (config)
nodeName nodeName
targetSystem targetSystem

View file

@ -1,6 +1,7 @@
{ {
config, config,
system, system,
modulesPath,
sources ? import ../../../../npins, sources ? import ../../../../npins,
... ...
}@args: }@args:
@ -8,7 +9,7 @@ let
inherit (sources) nixpkgs; inherit (sources) nixpkgs;
pkgs = import nixpkgs { inherit system; }; pkgs = import nixpkgs { inherit system; };
inherit (pkgs) lib; inherit (pkgs) lib;
inherit (pkgs.callPackage ../../common/utils.nix { inherit sources; }) mkNixosConfiguration; inherit (pkgs.callPackage ../../common/utils.nix { inherit modulesPath; }) mkNixosConfiguration;
inherit (config) inherit (config)
nodeName nodeName
pathToRoot pathToRoot

View file

@ -2,13 +2,14 @@
config, config,
system, system,
sources ? import ../../../npins, sources ? import ../../../npins,
modulesPath,
... ...
}@args: }@args:
let let
inherit (sources) nixpkgs; inherit (sources) nixpkgs;
pkgs = import nixpkgs { inherit system; }; pkgs = import nixpkgs { inherit system; };
inherit (pkgs) lib; inherit (pkgs) lib;
inherit (pkgs.callPackage ../common/utils.nix { }) mkNixosConfiguration; inherit (pkgs.callPackage ../common/utils.nix { inherit modulesPath; }) mkNixosConfiguration;
inherit (config) inherit (config)
nodeName nodeName
pathToRoot pathToRoot
@ -18,7 +19,7 @@ let
; ;
in in
(pkgs.callPackage ../../utils.nix { }).evalModel ( (pkgs.callPackage ../../utils.nix { }).evalModel (
{ config, ... }: { config, modulesPath, ... }:
{ {
imports = [ ../common/model.nix ]; imports = [ ../common/model.nix ];
config = { config = {
@ -34,7 +35,7 @@ in
nixos-configuration = { nixos-configuration = {
imports = [ imports = [
(mkNixosConfiguration environment required-resources) (mkNixosConfiguration environment required-resources)
"${sources.nixpkgs}/nixos/lib/testing/nixos-test-base.nix" "${modulesPath}/../lib/testing/nixos-test-base.nix"
]; ];
}; };
system = targetSystem; system = targetSystem;

View file

@ -43,7 +43,10 @@ pkgs.testers.runNixOSTest {
../common/nixosTest.nix ../common/nixosTest.nix
./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) inherit (import ./constants.nix)
targetMachines targetMachines
pathToRoot pathToRoot

View file

@ -2,6 +2,7 @@
lib, lib,
pkgs, pkgs,
sources, sources,
modulesPath,
... ...
}: }:
let let
@ -11,7 +12,7 @@ let
backendPort = builtins.toString 8080; backendPort = builtins.toString 8080;
deploy = deploy =
(import ./data-model.nix { (import ./data-model.nix {
inherit system; inherit system modulesPath;
config = { config = {
inherit nodeName pathToRoot; inherit nodeName pathToRoot;
targetSystem = system; targetSystem = system;

View file

@ -1,4 +1,5 @@
{ {
pkgs,
runNixOSTest, runNixOSTest,
inputs, inputs,
sources, sources,
@ -9,7 +10,10 @@ runNixOSTest {
../common/nixosTest.nix ../common/nixosTest.nix
./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) inherit (import ./constants.nix)
targetMachines targetMachines
pathToRoot pathToRoot

View file

@ -2,6 +2,7 @@
inputs, inputs,
sources, sources,
lib, lib,
modulesPath,
}: }:
let let
@ -15,7 +16,7 @@ let
makeTargetResource = nodeName: { makeTargetResource = nodeName: {
imports = [ ../common/targetResource.nix ]; imports = [ ../common/targetResource.nix ];
_module.args = { inherit inputs sources; }; _module.args = { inherit inputs sources modulesPath; };
inherit inherit
nodeName nodeName
pathToRoot pathToRoot

View file

@ -11,6 +11,7 @@
inputs, inputs,
sources, sources,
lib, lib,
modulesPath,
... ...
}: }:
{ {
@ -19,7 +20,12 @@
]; ];
nixops4Deployments.check-deployment-panel = import ./deployment/check/panel/deployment.nix { nixops4Deployments.check-deployment-panel = import ./deployment/check/panel/deployment.nix {
inherit inputs sources lib; inherit
inputs
sources
lib
modulesPath
;
}; };
} }
); );

View file

@ -30,6 +30,7 @@ runNixOSTest {
sources sources
pkgs pkgs
; ;
modulesPath = "${builtins.toString pkgs.path}/nixos/modules";
}; };
imports = [ imports = [
./proxmoxTest.nix ./proxmoxTest.nix

View file

@ -14,27 +14,27 @@
deployment-basic = import ./check/basic { deployment-basic = import ./check/basic {
inherit (pkgs.testers) runNixOSTest; inherit (pkgs.testers) runNixOSTest;
inherit inputs sources; inherit pkgs inputs sources;
}; };
deployment-cli = import ./check/cli { deployment-cli = import ./check/cli {
inherit (pkgs.testers) runNixOSTest; inherit (pkgs.testers) runNixOSTest;
inherit inputs sources; inherit pkgs inputs sources;
}; };
deployment-panel = import ./check/panel { deployment-panel = import ./check/panel {
inherit (pkgs.testers) runNixOSTest; inherit (pkgs.testers) runNixOSTest;
inherit inputs sources; inherit pkgs inputs sources;
}; };
deployment-model-ssh = import ./check/data-model-ssh { deployment-model-ssh = import ./check/data-model-ssh {
inherit (pkgs.testers) runNixOSTest; inherit (pkgs.testers) runNixOSTest;
inherit inputs sources; inherit pkgs inputs sources;
}; };
deployment-model-nixops4 = import ./check/data-model-nixops4 { deployment-model-nixops4 = import ./check/data-model-nixops4 {
inherit (pkgs.testers) runNixOSTest; inherit (pkgs.testers) runNixOSTest;
inherit inputs sources; inherit pkgs inputs sources;
}; };
deployment-model-tf = import ./check/data-model-tf { deployment-model-tf = import ./check/data-model-tf {

View file

@ -10,6 +10,7 @@
(lib.evalModules { (lib.evalModules {
specialArgs = { specialArgs = {
inherit pkgs inputs; inherit pkgs inputs;
modulesPath = "${builtins.toString pkgs.path}/nixos/modules";
}; };
modules = [ modules = [
./data-model.nix ./data-model.nix

View file

@ -26,7 +26,8 @@ let
inputs = inputs'; inputs = inputs';
}; };
flake-parts-lib = import "${sources.flake-parts}/lib.nix" { inherit (nixpkgs) lib; }; inherit (nixpkgs) lib outPath;
flake-parts-lib = import "${sources.flake-parts}/lib.nix" { inherit lib; };
in in
flakeModule: flakeModule:
@ -41,6 +42,7 @@ flake-parts-lib.mkFlake
self = self'; self = self';
specialArgs = { specialArgs = {
inherit sources; inherit sources;
modulesPath = "${builtins.toString outPath}/nixos/modules";
}; };
} }
{ {