diff --git a/example/luks-btrfs-subvolumes.nix b/example/luks-btrfs-subvolumes.nix index 91915704..d4011d7f 100644 --- a/example/luks-btrfs-subvolumes.nix +++ b/example/luks-btrfs-subvolumes.nix @@ -25,7 +25,7 @@ type = "luks"; name = "crypted"; # disable settings.keyFile if you want to use interactive password entry - #passwordFile = "/tmp/secret.key"; # Interactive + # passwordFile = "/tmp/secret.key"; # Interactive settings = { allowDiscards = true; keyFile = "/tmp/secret.key"; diff --git a/example/luks-interactive-login.nix b/example/luks-interactive-login.nix index 2317b802..5ea60bf8 100644 --- a/example/luks-interactive-login.nix +++ b/example/luks-interactive-login.nix @@ -22,7 +22,6 @@ type = "luks"; name = "crypted"; settings.allowDiscards = true; - passwordFile = "/tmp/secret.key"; content = { type = "filesystem"; format = "ext4"; @@ -35,4 +34,11 @@ }; }; }; + + # If we don't set passwordFile above, we will be interactively prompted by the + # disko script to set the LUKS password. However, as passwordFile is necessary + # for installTest we set it here. + disko.tests.extraDiskoConfig = { + devices.disk.vdb.content.partitions.luks.content.passwordFile = "/tmp/secret.key"; + }; } diff --git a/tests/luks-interactive-login.nix b/tests/luks-interactive-login.nix index 6fae2e11..c780c268 100644 --- a/tests/luks-interactive-login.nix +++ b/tests/luks-interactive-login.nix @@ -1,10 +1,13 @@ { pkgs ? import { } , diskoLib ? pkgs.callPackage ../lib { } }: -diskoLib.testLib.makeDiskoTest { +diskoLib.testLib.makeDiskoTest (let + disko-config = import ../example/luks-interactive-login.nix; +in { inherit pkgs; name = "luks-interactive-login"; - disko-config = ../example/luks-interactive-login.nix; + inherit disko-config; + inherit (disko-config.disko.tests) extraDiskoConfig; extraTestScript = '' machine.succeed("cryptsetup isLuks /dev/vda2"); ''; @@ -12,4 +15,4 @@ diskoLib.testLib.makeDiskoTest { machine.wait_for_console_text("vda") machine.send_console("secretsecret\n") ''; -} +})