mirror of
https://github.com/nix-community/disko.git
synced 2026-12-01 21:43:29 +01:00
`example/luks-fido2.nix` has been pure example up to now — no
corresponding install-test. Add `tests/luks-fido2.nix` using the
existing `makeDiskoTest` shim, exercising the FIDO2-enrolled LUKS path:
- `enableCanokey = true` attaches a virtual Canokey to both the
formatter VM (where disko runs `systemd-cryptenroll
--fido2-device=auto` during the format phase) and the booted machine
(where the initrd auto-unlocks LUKS via FIDO2). Canokey emulates a
FIDO2 token at `/dev/hidraw*` and answers programmatically, so
neither phase needs a user tap.
- `extraTestScript` asserts the LUKS volume exists at the expected
device path and `/` is mounted — which is only true if the initrd's
FIDO2 unlock succeeded.
Added in the pre-refactor (legacy `makeDiskoTest` function-call) shape
so the subsequent tests/ modulification commit converts it alongside
the other tests in one sweep.
15 lines
338 B
Nix
15 lines
338 B
Nix
{
|
|
pkgs ? import <nixpkgs> { },
|
|
diskoLib ? pkgs.callPackage ../lib { },
|
|
}:
|
|
diskoLib.testLib.makeDiskoTest {
|
|
inherit pkgs;
|
|
name = "luks-fido2";
|
|
disko-config = ../example/luks-fido2.nix;
|
|
enableCanokey = true;
|
|
extraTestScript = ''
|
|
machine.succeed("cryptsetup isLuks /dev/vda2");
|
|
machine.succeed("mountpoint /");
|
|
'';
|
|
}
|