mirror of
https://github.com/nix-community/disko.git
synced 2026-12-03 14:33:28 +01:00
Merge pull request #290 from nix-community/luks-keyFiles
types luks: pass keyFile to nixos config
This commit is contained in:
9 files changed
+13
-30
No files matched your search
@@ -28,7 +28,6 @@ queue_rules:
|
|||||||
- check-success=package default [x86_64-linux]
|
- check-success=package default [x86_64-linux]
|
||||||
- check-success=package disko [x86_64-linux]
|
- check-success=package disko [x86_64-linux]
|
||||||
- check-success=package disko-doc [x86_64-linux]
|
- check-success=package disko-doc [x86_64-linux]
|
||||||
- check-success=package linux-bcachefs [x86_64-linux]
|
|
||||||
defaults:
|
defaults:
|
||||||
actions:
|
actions:
|
||||||
queue:
|
queue:
|
||||||
|
|||||||
+4
-3
@@ -95,9 +95,10 @@
|
|||||||
keyformat = "passphrase";
|
keyformat = "passphrase";
|
||||||
keylocation = "file:///tmp/secret.key";
|
keylocation = "file:///tmp/secret.key";
|
||||||
};
|
};
|
||||||
postCreateHook = ''
|
# use this to read the key during boot
|
||||||
zfs set keylocation="prompt" "zroot/$name";
|
# postCreateHook = ''
|
||||||
'';
|
# zfs set keylocation="prompt" "zroot/$name";
|
||||||
|
# '';
|
||||||
};
|
};
|
||||||
"encrypted/test" = {
|
"encrypted/test" = {
|
||||||
type = "zfs_fs";
|
type = "zfs_fs";
|
||||||
|
|||||||
+5
-1
@@ -81,7 +81,11 @@
|
|||||||
readOnly = true;
|
readOnly = true;
|
||||||
default = [ ]
|
default = [ ]
|
||||||
# If initrdUnlock is true, then add a device entry to the initrd.luks.devices config.
|
# If initrdUnlock is true, then add a device entry to the initrd.luks.devices config.
|
||||||
++ (lib.optional config.initrdUnlock [{ boot.initrd.luks.devices.${config.name}.device = config.device; }])
|
++ (lib.optional config.initrdUnlock [{
|
||||||
|
boot.initrd.luks.devices.${config.name} = {
|
||||||
|
inherit (config) device keyFile;
|
||||||
|
};
|
||||||
|
}])
|
||||||
++ (lib.optional (config.content != null) config.content._config);
|
++ (lib.optional (config.content != null) config.content._config);
|
||||||
description = "NixOS configuration";
|
description = "NixOS configuration";
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -18,10 +18,6 @@ makeDiskoTest {
|
|||||||
machine.succeed("mountpoint /ext4onzfs");
|
machine.succeed("mountpoint /ext4onzfs");
|
||||||
machine.succeed("mountpoint /ext4_on_lvm");
|
machine.succeed("mountpoint /ext4_on_lvm");
|
||||||
'';
|
'';
|
||||||
bootCommands = ''
|
|
||||||
machine.wait_for_console_text("vda")
|
|
||||||
machine.send_console("secretsecret\n")
|
|
||||||
'';
|
|
||||||
extraConfig = {
|
extraConfig = {
|
||||||
boot.kernelModules = [ "dm-raid" "dm-mirror" ];
|
boot.kernelModules = [ "dm-raid" "dm-mirror" ];
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -17,10 +17,6 @@ makeDiskoTest {
|
|||||||
machine.succeed("mountpoint /ext4onzfs");
|
machine.succeed("mountpoint /ext4onzfs");
|
||||||
machine.succeed("mountpoint /ext4_on_lvm");
|
machine.succeed("mountpoint /ext4_on_lvm");
|
||||||
'';
|
'';
|
||||||
bootCommands = ''
|
|
||||||
machine.wait_for_console_text("vda")
|
|
||||||
machine.send_console("secretsecret\n")
|
|
||||||
'';
|
|
||||||
extraConfig = {
|
extraConfig = {
|
||||||
boot.kernelModules = [ "dm-raid" "dm-mirror" ];
|
boot.kernelModules = [ "dm-raid" "dm-mirror" ];
|
||||||
};
|
};
|
||||||
|
|||||||
+3
-3
@@ -12,7 +12,6 @@
|
|||||||
, extraConfig ? { }
|
, extraConfig ? { }
|
||||||
, grub-devices ? [ "nodev" ]
|
, grub-devices ? [ "nodev" ]
|
||||||
, efi ? true
|
, efi ? true
|
||||||
, enableOCR ? false
|
|
||||||
, postDisko ? ""
|
, postDisko ? ""
|
||||||
, testMode ? "module" # can be one of direct module cli
|
, testMode ? "module" # can be one of direct module cli
|
||||||
, testBoot ? true # if we actually want to test booting or just create/mount
|
, testBoot ? true # if we actually want to test booting or just create/mount
|
||||||
@@ -55,8 +54,10 @@
|
|||||||
documentation.enable = false;
|
documentation.enable = false;
|
||||||
hardware.enableAllFirmware = lib.mkForce false;
|
hardware.enableAllFirmware = lib.mkForce false;
|
||||||
networking.hostId = "8425e349"; # from profiles/base.nix, needed for zfs
|
networking.hostId = "8425e349"; # from profiles/base.nix, needed for zfs
|
||||||
boot.kernelParams = lib.mkIf enableOCR [ "console=tty0" ]; # needed for OCR
|
|
||||||
boot.zfs.devNodes = "/dev/disk/by-uuid"; # needed because /dev/disk/by-id is empty in qemu-vms
|
boot.zfs.devNodes = "/dev/disk/by-uuid"; # needed because /dev/disk/by-id is empty in qemu-vms
|
||||||
|
boot.initrd.preDeviceCommands = ''
|
||||||
|
echo -n 'secretsecret' > /tmp/secret.key
|
||||||
|
'';
|
||||||
|
|
||||||
boot.consoleLogLevel = lib.mkForce 100;
|
boot.consoleLogLevel = lib.mkForce 100;
|
||||||
boot.loader.grub = {
|
boot.loader.grub = {
|
||||||
@@ -75,7 +76,6 @@
|
|||||||
makeTest' {
|
makeTest' {
|
||||||
name = "disko-${name}";
|
name = "disko-${name}";
|
||||||
|
|
||||||
inherit enableOCR;
|
|
||||||
nodes.machine = { pkgs, modulesPath, ... }: {
|
nodes.machine = { pkgs, modulesPath, ... }: {
|
||||||
imports = [
|
imports = [
|
||||||
(lib.optionalAttrs (testMode == "module") {
|
(lib.optionalAttrs (testMode == "module") {
|
||||||
|
|||||||
+1
-4
@@ -4,12 +4,9 @@
|
|||||||
makeDiskoTest {
|
makeDiskoTest {
|
||||||
name = "luks-lvm";
|
name = "luks-lvm";
|
||||||
disko-config = ../example/luks-lvm.nix;
|
disko-config = ../example/luks-lvm.nix;
|
||||||
|
extraConfig.boot.initrd.luks.devices.crypted.preLVM = false;
|
||||||
extraTestScript = ''
|
extraTestScript = ''
|
||||||
machine.succeed("cryptsetup isLuks /dev/vda2");
|
machine.succeed("cryptsetup isLuks /dev/vda2");
|
||||||
machine.succeed("mountpoint /home");
|
machine.succeed("mountpoint /home");
|
||||||
'';
|
'';
|
||||||
bootCommands = ''
|
|
||||||
machine.wait_for_console_text("vda")
|
|
||||||
machine.send_console("secretsecret\n")
|
|
||||||
'';
|
|
||||||
}
|
}
|
||||||
@@ -18,10 +18,6 @@ makeDiskoTest {
|
|||||||
machine.succeed("mountpoint /ext4onzfs");
|
machine.succeed("mountpoint /ext4onzfs");
|
||||||
machine.succeed("mountpoint /ext4_on_lvm");
|
machine.succeed("mountpoint /ext4_on_lvm");
|
||||||
'';
|
'';
|
||||||
bootCommands = ''
|
|
||||||
machine.wait_for_console_text("vda")
|
|
||||||
machine.send_console("secretsecret\n")
|
|
||||||
'';
|
|
||||||
extraConfig = {
|
extraConfig = {
|
||||||
boot.kernelModules = [ "dm-raid" "dm-mirror" ];
|
boot.kernelModules = [ "dm-raid" "dm-mirror" ];
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -8,11 +8,6 @@ makeDiskoTest {
|
|||||||
fileSystems."/zfs_legacy_fs".options = [ "nofail" ]; # TODO find out why we need this!
|
fileSystems."/zfs_legacy_fs".options = [ "nofail" ]; # TODO find out why we need this!
|
||||||
boot.zfs.requestEncryptionCredentials = true;
|
boot.zfs.requestEncryptionCredentials = true;
|
||||||
};
|
};
|
||||||
enableOCR = true;
|
|
||||||
bootCommands = ''
|
|
||||||
machine.wait_for_text("passphrase for")
|
|
||||||
machine.send_chars("secretsecret\n")
|
|
||||||
'';
|
|
||||||
extraTestScript = ''
|
extraTestScript = ''
|
||||||
machine.succeed("test -b /dev/zvol/zroot/zfs_testvolume");
|
machine.succeed("test -b /dev/zvol/zroot/zfs_testvolume");
|
||||||
|
|
||||||
@@ -29,7 +24,6 @@ makeDiskoTest {
|
|||||||
assert_property("zroot/zfs_testvolume", "volsize", "10M")
|
assert_property("zroot/zfs_testvolume", "volsize", "10M")
|
||||||
assert_property("zroot/zfs_unmounted_fs", "mountpoint", "none")
|
assert_property("zroot/zfs_unmounted_fs", "mountpoint", "none")
|
||||||
|
|
||||||
assert_property("zroot/encrypted", "keylocation", "prompt")
|
|
||||||
machine.succeed("zfs get name zroot@blank")
|
machine.succeed("zfs get name zroot@blank")
|
||||||
|
|
||||||
machine.succeed("mountpoint /zfs_fs");
|
machine.succeed("mountpoint /zfs_fs");
|
||||||
|
|||||||
Reference in new issue
Block a user