mv nixos-test-base from common to non-proxmox tests

Signed-off-by: Kiara Grouwstra <kiara@procolix.eu>
This commit is contained in:
Kiara Grouwstra 2025-10-22 20:10:22 +02:00
parent 03a9c9b305
commit e091b18675
Signed by: kiara
SSH key fingerprint: SHA256:COspvLoLJ5WC5rFb9ZDe5urVCkK4LJZOsjfF4duRJFU
7 changed files with 51 additions and 27 deletions

View file

@ -4,6 +4,7 @@
pkgs, pkgs,
config, config,
sources, sources,
modulesPath,
... ...
}: }:
@ -73,17 +74,20 @@ in
## configuration and the store paths needed to build it and ## configuration and the store paths needed to build it and
## dump them in `system.extraDependencies`. ## dump them in `system.extraDependencies`.
machine = machine =
(pkgs.nixos [ (pkgs.nixos (
./targetNode.nix [
../../../infra/common/nixos/repart.nix ./targetNode.nix
config.system.extraDependenciesFromModule ../../../infra/common/nixos/repart.nix
{ config.system.extraDependenciesFromModule
nixpkgs.hostPlatform = "x86_64-linux"; {
_module.args = { inherit inputs sources; }; nixpkgs.hostPlatform = "x86_64-linux";
enableAcme = config.enableAcme; _module.args = { inherit inputs sources; };
acmeNodeIP = config.acmeNodeIP; enableAcme = config.enableAcme;
} acmeNodeIP = config.acmeNodeIP;
]).config; }
]
++ (lib.optional config.useFlake "${modulesPath}/../lib/testing/nixos-test-base.nix")
)).config;
in in
[ [

View file

@ -4,6 +4,7 @@
config, config,
hostPkgs, hostPkgs,
sources, sources,
modulesPath,
... ...
}: }:
@ -67,16 +68,19 @@ in
}; };
config = { config = {
sourceFileset = fileset.unions [ sourceFileset = fileset.unions (
# NOTE: not the flake itself; it will be overridden. [
../../../mkFlake.nix # NOTE: not the flake itself; it will be overridden.
../../../flake.lock ../../../mkFlake.nix
../../../npins ../../../flake.lock
../../../npins
./sharedOptions.nix ./sharedOptions.nix
./targetNode.nix ./targetNode.nix
./targetResource.nix ./targetResource.nix
]; ]
++ (lib.optional config.useFlake "${modulesPath}/../lib/testing/nixos-test-base.nix")
);
acmeNodeIP = config.nodes.acme.networking.primaryIPAddress; acmeNodeIP = config.nodes.acme.networking.primaryIPAddress;
@ -112,7 +116,9 @@ in
}; };
}) })
(genAttrs config.targetMachines (_: { (genAttrs config.targetMachines (_: {
imports = [ ./targetNode.nix ]; imports = [
./targetNode.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

@ -16,8 +16,6 @@ in
imports = [ imports = [
(modulesPath + "/profiles/qemu-guest.nix") (modulesPath + "/profiles/qemu-guest.nix")
# FIXME needed for non-proxmox tests
# (modulesPath + "/../lib/testing/nixos-test-base.nix")
./sharedOptions.nix ./sharedOptions.nix
]; ];

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"))
]; ] ++ (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;

View file

@ -41,7 +41,12 @@ in
inputs.nixops4-nixos.modules.nixops4Resource.nixos inputs.nixops4-nixos.modules.nixops4Resource.nixos
../common/targetResource.nix ../common/targetResource.nix
]; ];
nixos.module = mkNixosConfiguration environment required-resources; nixos.module = {
imports = [
(mkNixosConfiguration environment required-resources)
"${sources.nixpkgs}/nixos/lib/testing/nixos-test-base.nix"
];
};
_module.args = { inherit inputs sources; }; _module.args = { inherit inputs sources; };
inherit nodeName pathToRoot pathFromRoot; inherit nodeName pathToRoot pathFromRoot;
}; };

View file

@ -31,7 +31,12 @@ in
}: }:
{ {
ssh-host = { ssh-host = {
nixos-configuration = mkNixosConfiguration environment required-resources; nixos-configuration = {
imports = [
(mkNixosConfiguration environment required-resources)
"${sources.nixpkgs}/nixos/lib/testing/nixos-test-base.nix"
];
};
system = targetSystem; system = targetSystem;
ssh = { ssh = {
username = "root"; username = "root";

View file

@ -31,7 +31,12 @@ in
}: }:
{ {
tf-host = { tf-host = {
nixos-configuration = mkNixosConfiguration environment required-resources; nixos-configuration = {
imports = [
(mkNixosConfiguration environment required-resources)
"${sources.nixpkgs}/nixos/lib/testing/nixos-test-base.nix"
];
};
system = targetSystem; system = targetSystem;
ssh = { ssh = {
username = "root"; username = "root";