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

View file

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

View file

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

View file

@ -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"))
];
] ++ (lib.optional config.useFlake "${modulesPath}/../lib/testing/nixos-test-base.nix");
_module.args = { inherit inputs sources; };
enableAcme = config.enableAcme;

View file

@ -41,7 +41,12 @@ in
inputs.nixops4-nixos.modules.nixops4Resource.nixos
../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; };
inherit nodeName pathToRoot pathFromRoot;
};

View file

@ -31,7 +31,12 @@ in
}:
{
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;
ssh = {
username = "root";

View file

@ -1,4 +1,5 @@
{
lib,
sources ? import ../../../../npins,
...
}:
@ -20,4 +21,50 @@
users.users.root.openssh.authorizedKeys.keys = [
"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 = {
nixos-configuration = mkNixosConfiguration environment required-resources;
nixos-configuration = {
imports = [
(mkNixosConfiguration environment required-resources)
"${sources.nixpkgs}/nixos/lib/testing/nixos-test-base.nix"
];
};
system = targetSystem;
ssh = {
username = "root";

View file

@ -1,4 +1,4 @@
{ lib, ... }:
{ ... }:
{
_class = "nixos";
@ -11,14 +11,6 @@
# ];
boot = {
loader = {
systemd-boot.enable = true;
efi = {
canTouchEfiVariables = true;
efiSysMountPoint = "/boot";
};
grub.enable = false;
};
initrd = {
availableKernelModules = [
"ata_piix"
@ -30,29 +22,19 @@
};
};
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 = {
# mbr = {
# priority = 0;
# size = "1M";
# type = "EF02";
# };
mbr = {
priority = 0;
size = "1M";
type = "EF02";
};
esp = {
priority = 1;