Skip to content

Commit 29f54e9

Browse files
Add option to configure passwordFile
1 parent 4b145d9 commit 29f54e9

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

modules/default.nix

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,12 @@ in
4040
description = "The path to the directory where the boot directory is mounted. This can be used for `boot.loader.grub.mirroredBoots`.";
4141
};
4242

43+
passwordFile = lib.mkOption {
44+
type = with lib.types; nullOr str;
45+
default = null;
46+
description = "Path to a password file which contains the password for this partition. If set to null, the user is interactively asked for it.";
47+
};
48+
4349
withBootPlacebo = lib.mkOption {
4450
type = lib.types.bool;
4551
default = false;
@@ -169,12 +175,15 @@ in
169175
start = if withBoot then bootPartitionSize else "1MiB";
170176
end = "100%";
171177
part-type = "primary";
172-
content = lib.optionalAttrs disk.withLuks {
178+
content = lib.optionalAttrs disk.withLuks ({
173179
type = "luks";
174180
name = luksName;
175-
askPassword = true;
176181
inherit (zfs) content;
177-
} // lib.optionalAttrs (!disk.withLuks) zfs.content;
182+
} // (if disk.passwordFile == null then {
183+
askPassword = true;
184+
} else {
185+
inherit (disk) passwordFile;
186+
})) // lib.optionalAttrs (!disk.withLuks) zfs.content;
178187
}
179188
];
180189
};

0 commit comments

Comments
 (0)