diff options
author | Martin Weinelt <hexa@darmstadt.ccc.de> | 2024-04-23 11:55:16 +0200 |
---|---|---|
committer | Martin Weinelt <hexa@darmstadt.ccc.de> | 2024-04-23 12:04:14 +0200 |
commit | 8541ec6d85c40dad2841642aa16ab8b3a2f97d53 (patch) | |
tree | 584e96bb7da42d8ba247adef32a37eb59ac9da3f /nixos/tests | |
parent | c6d4afecd024e0b4162d37970caa16bc5df52c47 (diff) |
nixos/incus: add support for software TPMs
Was previously broken due to a missing runtime dependency. > Error: Failed to start device "vtpm": Failed to validate environment: Required tool 'swtpm' is missing
Diffstat (limited to 'nixos/tests')
-rw-r--r-- | nixos/tests/incus/virtual-machine.nix | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/nixos/tests/incus/virtual-machine.nix b/nixos/tests/incus/virtual-machine.nix index 48178aaed32c4..eebbbd113ed16 100644 --- a/nixos/tests/incus/virtual-machine.nix +++ b/nixos/tests/incus/virtual-machine.nix @@ -30,6 +30,9 @@ in memorySize = 1024; diskSize = 4096; + # Provide a TPM to test vTPM support for guests + tpm.enable = true; + incus.enable = true; }; networking.nftables.enable = true; @@ -47,8 +50,14 @@ in with subtest("virtual-machine image can be imported"): machine.succeed("incus image import ${vm-image-metadata}/*/*.tar.xz ${vm-image-disk}/nixos.qcow2 --alias nixos") + with subtest("virtual-machine can be created"): + machine.succeed("incus create nixos ${instance-name} --vm --config limits.memory=512MB --config security.secureboot=false") + + with subtest("virtual tpm can be configured"): + machine.succeed("incus config device add ${instance-name} vtpm tpm path=/dev/tpm0") + with subtest("virtual-machine can be launched and become available"): - machine.succeed("incus launch nixos ${instance-name} --vm --config limits.memory=512MB --config security.secureboot=false") + machine.succeed("incus start ${instance-name}") with machine.nested("Waiting for instance to start and be usable"): retry(instance_is_up) |