about summary refs log tree commit diff
path: root/nixos/tests
diff options
context:
space:
mode:
authorAdam C. Stephens <2071575+adamcstephens@users.noreply.github.com>2024-04-23 09:24:21 -0400
committerGitHub <noreply@github.com>2024-04-23 09:24:21 -0400
commitd27469607149144e364195c0a4d7b75e7652fb5c (patch)
tree3e8ee7ae70b1df903cb77acdfcac71bec05783fd /nixos/tests
parenta8cbb7b35083df06c6b0d8ffbe7d921da60df06f (diff)
parent8541ec6d85c40dad2841642aa16ab8b3a2f97d53 (diff)
Merge pull request #306239 from mweinelt/incus-vtpm
nixos/incus: add support for software TPMs
Diffstat (limited to 'nixos/tests')
-rw-r--r--nixos/tests/incus/virtual-machine.nix11
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)