support unencrypted disk provisioning

This commit is contained in:
steveej 2020-12-31 02:12:29 +01:00
parent 2a5495f9bb
commit 2a2715d447
11 changed files with 69 additions and 39 deletions

View file

@ -4,14 +4,18 @@
with lib;
let
cfg = config.hardware.encryptedDisk;
cfg = config.hardware.opinionatedDisk;
ownLib = import ../lib/default.nix { };
in {
options.hardware.encryptedDisk = {
enable = mkEnableOption "Enable encrypted filesystem layout";
options.hardware.opinionatedDisk = {
enable = mkEnableOption "Enable opinionated filesystem layout";
diskId = mkOption {
type = types.str;
};
encrypted = mkOption {
default = true;
type = types.bool;
};
};
config = lib.mkIf cfg.enable {
@ -36,10 +40,10 @@ in {
boot.loader.grub = {
device = (ownLib.disk.bootGrubDevice cfg.diskId);
enableCryptodisk = true;
enableCryptodisk = cfg.encrypted;
};
boot.initrd.luks.devices = builtins.listToAttrs [
boot.initrd.luks.devices = lib.optionalAttrs cfg.encrypted (builtins.listToAttrs [
{
name =
let
@ -53,6 +57,6 @@ in {
allowDiscards = true;
};
}
];
]);
};
}