Compare commits

...

2 commits

Author SHA1 Message Date
fb25554c7b
mv out qemu settings
Signed-off-by: Kiara Grouwstra <kiara@procolix.eu>
2025-10-22 20:10:41 +02:00
e091b18675
mv nixos-test-base from common to non-proxmox tests
Signed-off-by: Kiara Grouwstra <kiara@procolix.eu>
2025-10-22 20:10:22 +02:00
9 changed files with 104 additions and 51 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

@ -1,4 +1,5 @@
{ {
lib,
sources ? import ../../../../npins, sources ? import ../../../../npins,
... ...
}: }:
@ -20,4 +21,50 @@
users.users.root.openssh.authorizedKeys.keys = [ users.users.root.openssh.authorizedKeys.keys = [
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIFZsldWMEsajYysjYsEpNvMOjO4D8L21pTrfQS1T+Hfy" "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIFZsldWMEsajYysjYsEpNvMOjO4D8L21pTrfQS1T+Hfy"
]; ];
boot.loader = {
systemd-boot.enable = true;
efi = {
canTouchEfiVariables = true;
efiSysMountPoint = "/boot";
};
grub.enable = false;
};
fileSystems."/boot" = {
fsType = "vfat";
device = lib.mkDefault "/dev/sda1";
options = [
"fmask=0022"
"dmask=0022"
];
};
disko.devices.disk.main = {
device = "/dev/sda";
type = "disk";
imageSize = "20G"; # needed for image generation
content = {
type = "gpt";
partitions = {
esp = {
priority = 1;
size = "500M";
type = "EF00";
label = "boot";
content = {
type = "filesystem";
format = "vfat";
mountpoint = "/boot";
};
};
root = {
priority = 2;
size = "100%";
content = {
type = "filesystem";
format = "ext4";
mountpoint = "/";
};
};
};
};
};
} }

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";

View file

@ -1,4 +1,4 @@
{ lib, ... }: { ... }:
{ {
_class = "nixos"; _class = "nixos";
@ -11,14 +11,6 @@
# ]; # ];
boot = { boot = {
loader = {
systemd-boot.enable = true;
efi = {
canTouchEfiVariables = true;
efiSysMountPoint = "/boot";
};
grub.enable = false;
};
initrd = { initrd = {
availableKernelModules = [ availableKernelModules = [
"ata_piix" "ata_piix"
@ -30,29 +22,19 @@
}; };
}; };
fileSystems."/boot" = {
fsType = "vfat";
device = lib.mkDefault "/dev/sda1";
options = [
"fmask=0022"
"dmask=0022"
];
};
disko.devices.disk.main = { disko.devices.disk.main = {
device = "/dev/sda"; device = "/dev/sda";
type = "disk"; type = "disk";
imageSize = "20G"; # needed for image generation
content = { content = {
type = "gpt"; type = "gpt";
partitions = { partitions = {
# mbr = { mbr = {
# priority = 0; priority = 0;
# size = "1M"; size = "1M";
# type = "EF02"; type = "EF02";
# }; };
esp = { esp = {
priority = 1; priority = 1;