support unencrypted disk provisioning
This commit is contained in:
parent
2a5495f9bb
commit
2a2715d447
11 changed files with 69 additions and 39 deletions
|
@ -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;
|
||||
};
|
||||
}
|
||||
];
|
||||
]);
|
||||
};
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue