|
1 |
| -{ pkgs, nixos-anywhere, kexec-installer, nix-vm-test, system-to-install, ... }: |
| 1 | +{ pkgs, nixos-anywhere, kexec-installer, nix-vm-test, system-to-install, distribution, version, ... }: |
2 | 2 |
|
3 |
| -(nix-vm-test.lib.${pkgs.system}.ubuntu."24_04" { |
| 3 | +(nix-vm-test.lib.${pkgs.system}.${distribution}.${version} { |
4 | 4 | sharedDirs = { };
|
5 | 5 |
|
6 | 6 | # Configure VM with 2GB memory
|
7 | 7 | machineConfigModule = { ... }: {
|
8 |
| - nodes.vm.virtualisation.memorySize = 2048; |
| 8 | + nodes.vm.virtualisation.memorySize = 1500; |
9 | 9 | };
|
10 | 10 |
|
11 | 11 | # The test script
|
|
19 | 19 | # Wait for the system to be fully booted
|
20 | 20 | vm.wait_for_unit("multi-user.target")
|
21 | 21 |
|
| 22 | + # Detect SSH service name (ssh on Ubuntu/Debian, sshd on Fedora/RHEL) |
| 23 | + ssh_service = "sshd" if "${distribution}" in ["fedora", "centos", "rhel"] else "ssh" |
| 24 | +
|
22 | 25 | # Unmask SSH service (which is masked by default in the test VM)
|
23 |
| - vm.succeed("systemctl unmask ssh.service ssh.socket") |
| 26 | + vm.succeed(f"systemctl unmask {ssh_service}.service || true") |
| 27 | + vm.succeed(f"systemctl unmask {ssh_service}.socket || true") |
24 | 28 |
|
25 | 29 | # Generate SSH host keys (required for SSH to start)
|
26 | 30 | vm.succeed("ssh-keygen -A")
|
|
38 | 42 | )
|
39 | 43 |
|
40 | 44 | # Start SSH service
|
41 |
| - vm.succeed("systemctl start ssh") |
42 |
| -
|
43 |
| - # Wait for SSH to be available |
44 |
| - vm.wait_for_open_port(22) |
| 45 | + vm.succeed(f"systemctl start {ssh_service}") |
45 | 46 |
|
46 | 47 | # Forward SSH port using vm.forward_port method
|
47 | 48 | ssh_port = 2222
|
|
0 commit comments