git.iko.soy/typeable/nixpkgs
on master help sign in
Merge pull request #8554 from dwe11er/luks-detached-header
07bdaa9lethalman
nixos/modules/system/boot/luksroot.nix+12−1
@@ -5,7 +5,7 @@ with lib;
5let
5let
6 luks = config.boot.initrd.luks;
6 luks = config.boot.initrd.luks;
7
7
8− openCommand = { name, device, keyFile, keyFileSize, allowDiscards, yubikey, ... }: ''
8+ openCommand = { name, device, header, keyFile, keyFileSize, allowDiscards, yubikey, ... }: ''
9 # Wait for luksRoot to appear, e.g. if on a usb drive.
9 # Wait for luksRoot to appear, e.g. if on a usb drive.
10 # XXX: copied and adapted from stage-1-init.sh - should be
10 # XXX: copied and adapted from stage-1-init.sh - should be
11 # available as a function.
11 # available as a function.
@@ -33,6 +33,7 @@ let
33
33
34 open_normally() {
34 open_normally() {
35 cryptsetup luksOpen ${device} ${name} ${optionalString allowDiscards "--allow-discards"} \
35 cryptsetup luksOpen ${device} ${name} ${optionalString allowDiscards "--allow-discards"} \
36+ ${optionalString (header != null) "--header=${header}"} \
36 ${optionalString (keyFile != null) "--key-file=${keyFile} ${optionalString (keyFileSize != null) "--keyfile-size=${toString keyFileSize}"}"}
37 ${optionalString (keyFile != null) "--key-file=${keyFile} ${optionalString (keyFileSize != null) "--keyfile-size=${toString keyFileSize}"}"}
37 }
38 }
38
39
@@ -251,6 +252,16 @@ in
251 description = "Path of the underlying block device.";
252 description = "Path of the underlying block device.";
252 };
253 };
253
254
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+
254 keyFile = mkOption {
265 keyFile = mkOption {
255 default = null;
266 default = null;
256 example = "/dev/sdb1";
267 example = "/dev/sdb1";