nix vm tests: refactor to make gnome vm node builder reusable

pull/8339/head
Jeffrey C. Ollie 2025-08-22 17:04:38 -05:00
parent c77bbe6d7e
commit debec946da
No known key found for this signature in database
GPG Key ID: 6F86035A6D97044E
1 changed files with 63 additions and 31 deletions

View File

@ -37,27 +37,11 @@
return "${pink_value}" in text
'';
mkTestGnome = {
name,
settings,
testScript,
ocr ? false,
}:
pkgs.testers.runNixOSTest {
name = name;
enableOCR = ocr;
extraBaseModules = {
imports = [
home-manager.nixosModules.home-manager
];
};
nodes = {
machine = {
mkNodeGnome = {
config,
pkgs,
settings,
sshPort ? null,
...
}: {
imports = [
@ -65,9 +49,29 @@
settings
];
virtualisation.vmVariant = {
virtualisation = {
forwardPorts = pkgs.lib.optionals (sshPort != null) [
{
from = "host";
host.port = sshPort;
guest.port = 22;
}
];
vmVariant = {
virtualisation.host.pkgs = pkgs;
};
};
services.openssh = {
enable = true;
settings = {
PermitRootLogin = "yes";
PermitEmptyPasswords = "yes";
};
};
security.pam.services.sshd.allowNullPassword = true;
users.groups.ghostty = {
gid = 1000;
@ -91,6 +95,34 @@
system.stateVersion = nixos-version;
};
mkTestGnome = {
name,
settings,
testScript,
ocr ? false,
}:
pkgs.testers.runNixOSTest {
name = name;
enableOCR = ocr;
extraBaseModules = {
imports = [
home-manager.nixosModules.home-manager
];
};
nodes = {
machine = {
config,
pkgs,
...
}:
mkNodeGnome {
inherit config pkgs settings;
sshPort = 2222;
};
};
testScript = testScript;