git.iko.soy/typeable/nixpkgs
on master help sign in
nixos/modules/system/boot/luksroot.nix: allow for LUKS devices with detached header
commitc1becad3eb8b5cef1f0db046295edcab35a5b080 authorMarcin Falkiewicz <avalatron@gmail.com> dateMon 29 Jun 2015, 10:56 (11 years ago) parentd942857
1 file changed+12−1
nixos/modules/system/boot/luksroot.nix+12−1
nixos/modules/system/boot/luksroot.nix+12−1
@@ -5,7 +5,7 @@ with lib;
55let
66 luks = config.boot.initrd.luks;
77
8− openCommand = { name, device, keyFile, keyFileSize, allowDiscards, yubikey, ... }: ''
8+ openCommand = { name, device, header, keyFile, keyFileSize, allowDiscards, yubikey, ... }: ''
99 # Wait for luksRoot to appear, e.g. if on a usb drive.
1010 # XXX: copied and adapted from stage-1-init.sh - should be
1111 # available as a function.
@@ -33,6 +33,7 @@ let
3333
3434 open_normally() {
3535 cryptsetup luksOpen ${device} ${name} ${optionalString allowDiscards "--allow-discards"} \
36+ ${optionalString (header != null) "--header=${header}"} \
3637 ${optionalString (keyFile != null) "--key-file=${keyFile} ${optionalString (keyFileSize != null) "--keyfile-size=${toString keyFileSize}"}"}
3738 }
3839
@@ -251,6 +252,16 @@ in
251252 description = "Path of the underlying block device.";
252253 };
253254
255+ header = mkOption {
256+ default = null;
257+ example = "/root/header.img";
258+ type = types.nullOr types.string;
259+ description = ''
260+ The name of the file or block device that
261+ should be used as header for the encrypted device.
262+ '';
263+ };
264+
254265 keyFile = mkOption {
255266 default = null;
256267 example = "/dev/sdb1";