slightly saner multi-efi setup

This commit is contained in:
Gerg-L 2023-07-31 21:26:13 -04:00
parent ed20ccf64d
commit 46ac5bc156
3 changed files with 92 additions and 101 deletions

View file

@ -1,45 +1,24 @@
{disko, ...}: {lib, ...}: let {disko, ...}: {...}: {
disks = [
"nvme-SHPP41-500GM_SSB4N6719101A4N22"
"nvme-SHPP41-500GM_SSB4N6719101A4N0E"
];
in {
imports = [disko.nixosModules.disko]; imports = [disko.nixosModules.disko];
disko.devices = { disko.devices = {
disk = lib.mkMerge (map (x: { disk = {
${x} = { "0E" = {
type = "disk"; type = "disk";
device = "/dev/disk/by-id/${x}"; device = "/dev/disk/by-id/nvme-SHPP41-500GM_SSB4N6719101A4N0E";
content = { content = {
type = "table"; type = "table";
format = "gpt"; format = "gpt";
partitions = [ partitions = [
{ {
name = "boot"; name = "BOOT";
start = "0"; start = "0";
end = "1M"; end = "4G";
part-type = "primary";
flags = ["bios_grub"];
}
{
name = "ESP";
start = "1M";
end = "1G";
bootable = true; bootable = true;
content = { content = {
type = "filesystem"; type = "filesystem";
format = "vfat"; format = "vfat";
mountpoint = "/boot/efis/${x}"; mountpoint = "/efi0E";
};
}
{
name = "zfsboot";
start = "1G";
end = "5G";
content = {
type = "zfs";
pool = "bpool";
}; };
} }
{ {
@ -52,7 +31,7 @@ in {
}; };
} }
{ {
name = "zfsroot"; name = "zfsroot ";
start = "21G"; start = "21G";
end = "100%"; end = "100%";
content = { content = {
@ -63,8 +42,47 @@ in {
]; ];
}; };
}; };
}) "22" = {
disks); type = "disk";
device = "/dev/disk/by-id/nvme-SHPP41-500GM_SSB4N6719101A4N22";
content = {
type = "table";
format = "gpt";
partitions = [
{
name = "BOOT";
start = "0";
end = "4G";
bootable = true;
content = {
type = "filesystem";
format = "vfat";
mountpoint = "/efi22";
};
}
{
name = "swap";
start = "5G";
end = "21G";
content = {
type = "swap";
randomEncryption = true;
};
}
{
name = "zfsroot ";
start = "21G";
end = "100%";
content = {
type = "zfs";
pool = "rpool";
};
}
];
};
};
};
zpool = { zpool = {
rpool = { rpool = {
type = "zpool"; type = "zpool";
@ -118,33 +136,6 @@ in {
}; };
}; };
}; };
bpool = {
type = "zpool";
mode = "mirror";
rootFsOptions = {
acltype = "posixacl";
compression = "lz4";
devices = "off";
normalization = "formD";
relatime = "on";
xattr = "sa";
canmount = "off";
};
options = {
compatibility = "grub2";
ashift = "12";
autotrim = "on";
};
datasets = {
"boot" = {
type = "zfs_fs";
options.mountpoint = "legacy";
mountpoint = "/boot";
postCreateHook = "zfs snapshot bpool/boot@empty";
};
};
};
}; };
}; };
_file = ./disko.nix; _file = ./disko.nix;

View file

@ -149,6 +149,7 @@
boot = { boot = {
kernelModules = ["amdgpu"]; kernelModules = ["amdgpu"];
initrd = { initrd = {
systemd.enable = true;
availableKernelModules = ["nvme" "xhci_pci" "ahci" "usbhid" "sd_mod"]; availableKernelModules = ["nvme" "xhci_pci" "ahci" "usbhid" "sd_mod"];
includeDefaultModules = false; includeDefaultModules = false;
}; };

View file

@ -16,7 +16,11 @@ _: {
}; };
#make sure the sopskey is found #make sure the sopskey is found
sops.age.sshKeyPaths = lib.mkForce ["/persist/ssh/ssh_host_ed25519_key"]; sops.age.sshKeyPaths = lib.mkForce ["/persist/ssh/ssh_host_ed25519_key"];
fileSystems."/persist".neededForBoot = true; fileSystems = {
"/persist".neededForBoot = true;
"/efi22".options = ["nofail"];
"/efi0E".options = ["nofail"];
};
boot = { boot = {
zfs = { zfs = {
devNodes = "/dev/disk/by-id/"; devNodes = "/dev/disk/by-id/";
@ -41,25 +45,20 @@ _: {
plymouth.enable = false; plymouth.enable = false;
loader = { loader = {
generationsDir.copyKernels = true; generationsDir.copyKernels = true;
#override default
#override defaults
systemd-boot.enable = false; systemd-boot.enable = false;
efi.canTouchEfiVariables = false;
grub = { grub = {
enable = true; enable = true;
efiInstallAsRemovable = true;
copyKernels = true; copyKernels = true;
efiSupport = true; efiSupport = true;
zfsSupport = true;
mirroredBoots = [ mirroredBoots = [
{ {
path = "/boot/efis/nvme-SHPP41-500GM_SSB4N6719101A4N0E"; path = "/efi22";
devices = ["/dev/disk/by-id/nvme-SHPP41-500GM_SSB4N6719101A4N0E"]; devices = ["nodev"];
} }
{ {
path = "/boot/efis/nvme-SHPP41-500GM_SSB4N6719101A4N22"; path = "/efi0E";
devices = ["/dev/disk/by-id/nvme-SHPP41-500GM_SSB4N6719101A4N22"]; devices = ["nodev"];
} }
]; ];
splashImage = null; splashImage = null;