[disko] add legacy option
I don't know if the grub device is right
This commit is contained in:
@@ -20,6 +20,11 @@ in
|
|||||||
default = true;
|
default = true;
|
||||||
description = "Allows encryption to be disabled for testing";
|
description = "Allows encryption to be disabled for testing";
|
||||||
};
|
};
|
||||||
|
legacy = lib.mkOption {
|
||||||
|
type = lib.types.bool;
|
||||||
|
default = false;
|
||||||
|
description = "Enable legacy boot (bios)";
|
||||||
|
};
|
||||||
devNodes = lib.mkOption {
|
devNodes = lib.mkOption {
|
||||||
type = lib.types.str;
|
type = lib.types.str;
|
||||||
default = "/dev/disk/by-id/";
|
default = "/dev/disk/by-id/";
|
||||||
@@ -81,7 +86,25 @@ in
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
config = lib.mkIf cfg.enable {
|
config = lib.mkMerge [
|
||||||
|
(lib.mkIf (cfg.enable && !cfg.legacy) {
|
||||||
|
boot = {
|
||||||
|
loader.systemd-boot.enable = true;
|
||||||
|
loader.efi.canTouchEfiVariables = true;
|
||||||
|
supportedFilesystems = [ "vfat" "zfs" ];
|
||||||
|
};
|
||||||
|
fileSystems."/boot".neededForBoot = true;
|
||||||
|
})
|
||||||
|
(lib.mkIf (cfg.enable && cfg.legacy) {
|
||||||
|
boot.loader.grub = {
|
||||||
|
enable = true;
|
||||||
|
device = "/dev/${cfg.root.disk0}-part1";
|
||||||
|
efiSupport = false;
|
||||||
|
enableCryptodisk = cfg.encryption;
|
||||||
|
zfsSupport = true;
|
||||||
|
};
|
||||||
|
})
|
||||||
|
(lib.mkIf cfg.enable {
|
||||||
networking.hostId = cfg.hostId;
|
networking.hostId = cfg.hostId;
|
||||||
disko.devices = {
|
disko.devices = {
|
||||||
disk = lib.mkMerge [
|
disk = lib.mkMerge [
|
||||||
@@ -92,7 +115,7 @@ in
|
|||||||
content = {
|
content = {
|
||||||
type = "gpt";
|
type = "gpt";
|
||||||
partitions = {
|
partitions = {
|
||||||
ESP = {
|
ESP = lib.mkIf (!cfg.legacy) {
|
||||||
size = "1024M";
|
size = "1024M";
|
||||||
type = "EF00";
|
type = "EF00";
|
||||||
content = {
|
content = {
|
||||||
@@ -102,6 +125,10 @@ in
|
|||||||
mountOptions = [ "umask=0077" ];
|
mountOptions = [ "umask=0077" ];
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
boot = lib.mkIf cfg.legacy {
|
||||||
|
size = "1024M";
|
||||||
|
type = "EF02";
|
||||||
|
};
|
||||||
encryptedSwap = {
|
encryptedSwap = {
|
||||||
size = cfg.root.swap;
|
size = cfg.root.swap;
|
||||||
content = {
|
content = {
|
||||||
@@ -270,9 +297,9 @@ in
|
|||||||
|
|
||||||
fileSystems."/".neededForBoot = true;
|
fileSystems."/".neededForBoot = true;
|
||||||
fileSystems."/etc".neededForBoot = true;
|
fileSystems."/etc".neededForBoot = true;
|
||||||
fileSystems."/boot".neededForBoot = true;
|
|
||||||
fileSystems."/var".neededForBoot = true;
|
fileSystems."/var".neededForBoot = true;
|
||||||
fileSystems."/home".neededForBoot = true;
|
fileSystems."/home".neededForBoot = true;
|
||||||
fileSystems."/nix".neededForBoot = true;
|
fileSystems."/nix".neededForBoot = true;
|
||||||
};
|
})
|
||||||
|
];
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -26,13 +26,9 @@ in
|
|||||||
|
|
||||||
config = lib.mkIf (cfg.enable && config.malobeo.disks.encryption) {
|
config = lib.mkIf (cfg.enable && config.malobeo.disks.encryption) {
|
||||||
boot = {
|
boot = {
|
||||||
loader.systemd-boot.enable = true;
|
|
||||||
loader.efi.canTouchEfiVariables = true;
|
|
||||||
supportedFilesystems = [ "vfat" "zfs" ];
|
|
||||||
zfs = {
|
zfs = {
|
||||||
forceImportAll = true;
|
forceImportAll = true;
|
||||||
requestEncryptionCredentials = true;
|
requestEncryptionCredentials = true;
|
||||||
|
|
||||||
};
|
};
|
||||||
initrd = {
|
initrd = {
|
||||||
availableKernelModules = cfg.ethernetDrivers;
|
availableKernelModules = cfg.ethernetDrivers;
|
||||||
|
|||||||
Reference in New Issue
Block a user