63 lines
1.3 KiB
Nix
63 lines
1.3 KiB
Nix
{ lib, config, ... }:
|
|
with lib;
|
|
let
|
|
luksDevicesModule = types.submodule {
|
|
options.name = mkOption {
|
|
type = types.str;
|
|
description = ''
|
|
The partition name.
|
|
'';
|
|
};
|
|
|
|
options.deviceUUID = mkOption {
|
|
type = types.str;
|
|
description = ''
|
|
The partition device UUID.
|
|
'';
|
|
};
|
|
|
|
options.isPreLVM = mkOption {
|
|
type = types.bool;
|
|
default = false;
|
|
example = true;
|
|
description = ''
|
|
Whether the decrypted partition will be a LVM device.
|
|
'';
|
|
};
|
|
};
|
|
in
|
|
{
|
|
options.enableDefaultSystemdBoot = mkOption {
|
|
type = types.bool;
|
|
default = true;
|
|
example = false;
|
|
description = ''
|
|
Whether or not enable the default SystemD boot system.
|
|
Can be useful for devices using u-boot.
|
|
'';
|
|
};
|
|
|
|
options.luksDevices = mkOption {
|
|
type = types.listOf luksDevicesModule;
|
|
default = [ ];
|
|
description = ''
|
|
List of LUKS devices.
|
|
'';
|
|
};
|
|
|
|
config = {
|
|
boot.initrd.luks.devices = builtins.listToAttrs (
|
|
map (fs: {
|
|
name = fs.name;
|
|
value = {
|
|
device = "/dev/disk/by-uuid/${fs.deviceUUID}";
|
|
preLVM = fs.isPreLVM;
|
|
};
|
|
}) config.luksDevices
|
|
);
|
|
|
|
boot.loader.systemd-boot.enable = config.enableDefaultSystemdBoot;
|
|
boot.loader.efi.canTouchEfiVariables = true;
|
|
};
|
|
}
|