diff --git a/hosts/gerg-desktop/disko.nix b/hosts/gerg-desktop/disko.nix index 631a54a..44f6912 100644 --- a/hosts/gerg-desktop/disko.nix +++ b/hosts/gerg-desktop/disko.nix @@ -1,70 +1,88 @@ -{disko, ...}: {lib, ...}: let - disks = [ - "nvme-SHPP41-500GM_SSB4N6719101A4N22" - "nvme-SHPP41-500GM_SSB4N6719101A4N0E" - ]; -in { +{disko, ...}: {...}: { imports = [disko.nixosModules.disko]; disko.devices = { - disk = lib.mkMerge (map (x: { - ${x} = { - type = "disk"; + disk = { + "0E" = { + type = "disk"; - device = "/dev/disk/by-id/${x}"; - content = { - type = "table"; - format = "gpt"; - partitions = [ - { - name = "boot"; - start = "0"; - end = "1M"; - part-type = "primary"; - flags = ["bios_grub"]; - } - { - name = "ESP"; - start = "1M"; - end = "1G"; - bootable = true; - content = { - type = "filesystem"; - format = "vfat"; - mountpoint = "/boot/efis/${x}"; - }; - } - { - name = "zfsboot"; - start = "1G"; - end = "5G"; - content = { - type = "zfs"; - pool = "bpool"; - }; - } - { - name = "swap"; - start = "5G"; - end = "21G"; - content = { - type = "swap"; - randomEncryption = true; - }; - } - { - name = "zfsroot"; - start = "21G"; - end = "100%"; - content = { - type = "zfs"; - pool = "rpool"; - }; - } - ]; - }; + device = "/dev/disk/by-id/nvme-SHPP41-500GM_SSB4N6719101A4N0E"; + content = { + type = "table"; + format = "gpt"; + partitions = [ + { + name = "BOOT"; + start = "0"; + end = "4G"; + bootable = true; + content = { + type = "filesystem"; + format = "vfat"; + mountpoint = "/efi0E"; + }; + } + { + name = "swap"; + start = "5G"; + end = "21G"; + content = { + type = "swap"; + randomEncryption = true; + }; + } + { + name = "zfsroot "; + start = "21G"; + end = "100%"; + content = { + type = "zfs"; + pool = "rpool"; + }; + } + ]; }; - }) - disks); + }; + "22" = { + 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 = { rpool = { 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; diff --git a/hosts/gerg-desktop/main.nix b/hosts/gerg-desktop/main.nix index 852cc1d..0cadf8e 100644 --- a/hosts/gerg-desktop/main.nix +++ b/hosts/gerg-desktop/main.nix @@ -149,6 +149,7 @@ boot = { kernelModules = ["amdgpu"]; initrd = { + systemd.enable = true; availableKernelModules = ["nvme" "xhci_pci" "ahci" "usbhid" "sd_mod"]; includeDefaultModules = false; }; diff --git a/hosts/gerg-desktop/zfs.nix b/hosts/gerg-desktop/zfs.nix index 5cb9ca6..17621dd 100644 --- a/hosts/gerg-desktop/zfs.nix +++ b/hosts/gerg-desktop/zfs.nix @@ -16,7 +16,11 @@ _: { }; #make sure the sopskey is found 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 = { zfs = { devNodes = "/dev/disk/by-id/"; @@ -41,25 +45,20 @@ _: { plymouth.enable = false; loader = { generationsDir.copyKernels = true; - - #override defaults + #override default systemd-boot.enable = false; - efi.canTouchEfiVariables = false; - grub = { enable = true; - efiInstallAsRemovable = true; copyKernels = true; efiSupport = true; - zfsSupport = true; mirroredBoots = [ { - path = "/boot/efis/nvme-SHPP41-500GM_SSB4N6719101A4N0E"; - devices = ["/dev/disk/by-id/nvme-SHPP41-500GM_SSB4N6719101A4N0E"]; + path = "/efi22"; + devices = ["nodev"]; } { - path = "/boot/efis/nvme-SHPP41-500GM_SSB4N6719101A4N22"; - devices = ["/dev/disk/by-id/nvme-SHPP41-500GM_SSB4N6719101A4N22"]; + path = "/efi0E"; + devices = ["nodev"]; } ]; splashImage = null;