From eca65aa8609ce55486d5e81e4c46c452d25810f1 Mon Sep 17 00:00:00 2001 From: nyxerinys Date: Fri, 2 Oct 2026 18:39:59 -0500 Subject: [PATCH] cleanup boot files --- hosts/apollo/boot.nix | 97 ------------------------------- hosts/apollo/boot/bootloader.nix | 20 +++++++ hosts/apollo/boot/default.nix | 9 +++ hosts/apollo/boot/encryption.nix | 41 +++++++++++++ hosts/apollo/boot/filesystems.nix | 42 +++++++++++++ hosts/apollo/default.nix | 2 +- 6 files changed, 113 insertions(+), 98 deletions(-) delete mode 100644 hosts/apollo/boot.nix create mode 100644 hosts/apollo/boot/bootloader.nix create mode 100644 hosts/apollo/boot/default.nix create mode 100644 hosts/apollo/boot/encryption.nix create mode 100644 hosts/apollo/boot/filesystems.nix diff --git a/hosts/apollo/boot.nix b/hosts/apollo/boot.nix deleted file mode 100644 index bc02b3a..0000000 --- a/hosts/apollo/boot.nix +++ /dev/null @@ -1,97 +0,0 @@ -{ pkgs, lib, inputs, ... }: - -{ - imports = [ - inputs.lanzaboote.nixosModules.lanzaboote - ]; - - boot = { - - #Bootloader - environment.systemPackages = [ pkgs.sbctl ]; - lanzaboote = { - enable = true; - pkiBundle = "/var/lib/sbctl"; - autoGenerateKeys.enable = true; - autoEnrollKeys.enable = true; - }; - loader.efi.canTouchEfiVariables = true; - loader.systemd-boot.enable = lib.mkForce false; - - # Luks Decryption for ZFS - initrd = { - supportedFilesystems = [ "ext4" "zfs" ]; - availableKernelModules = [ "hid_apple" ]; - systemd = { - enable = true; - fido2.enable = true; - emergencyAccess = true; - mounts = [ - { - what = "/dev/mapper/zfs-keys"; - where = "/keys"; - type = "ext4"; - options = "ro"; - } - ]; - }; - luks.fido2Support = false; - - luks.devices."zfs-keys" = { - device = "/dev/disk/by-id/nvme-CT1000P2SSD8_2138E5D5DA5A-part2"; - crypttabExtraOpts = [ "fido2-device=auto" ]; - }; - - systemd.services."zfs-import-nix-root" = { - wants = [ "keys.mount" ]; - after = [ "keys.mount" ]; - }; - - }; - }; - - systemd.services."zfs-import-nix-main" = { - wants = [ "keys.mount" ]; - after = [ "keys.mount" ]; - }; - - boot.zfs.forceImportRoot = false; - fileSystems."/" = { - device = "nix-root/root"; - fsType = "zfs"; - }; - - fileSystems."/var/log" = { - device = "nix-root/syslog"; - fsType = "zfs"; - }; - - fileSystems."/nix" = { - device = "nix-root/nix"; - fsType = "zfs"; - }; - - fileSystems."/keys" = { - device = "/dev/mapper/zfs-keys"; - fsType = "ext4"; - }; - - fileSystems."/home/nyxerinys" = { - device = "nix-main/nyxerinys"; - fsType = "zfs"; - }; - - fileSystems."/boot" = { - device = "/dev/disk/by-uuid/A5CB-B201"; - fsType = "vfat"; - options = [ "fmask=0022" "dmask=0022" ]; - }; - - swapDevices = [ - { - device = "/dev/disk/by-id/nvme-CT1000P2SSD8_2138E5D5DA5A-part3"; - randomEncryption.enable = true; - } - ]; - -} \ No newline at end of file diff --git a/hosts/apollo/boot/bootloader.nix b/hosts/apollo/boot/bootloader.nix new file mode 100644 index 0000000..4673a3c --- /dev/null +++ b/hosts/apollo/boot/bootloader.nix @@ -0,0 +1,20 @@ +{ inputs, ... }: + +{ + imports = [ + inputs.lanzaboote.nixosModules.lanzaboote + ]; + + boot = { + lanzaboote = { + enable = true; + pkiBundle = "/var/lib/sbctl"; + autoGenerateKeys.enable = true; + autoEnrollKeys.enable = true; + }; + loader.efi.canTouchEfiVariables = true; + loader.systemd-boot.enable = lib.mkForce false; + }; + + environment.systemPackages = [ pkgs.sbctl ]; +} \ No newline at end of file diff --git a/hosts/apollo/boot/default.nix b/hosts/apollo/boot/default.nix new file mode 100644 index 0000000..e18cd27 --- /dev/null +++ b/hosts/apollo/boot/default.nix @@ -0,0 +1,9 @@ +{ ... }: + +{ + imports = [ + ./bootloader.nix + ./encryption.nix + ./filesystems.nix + ]; +} \ No newline at end of file diff --git a/hosts/apollo/boot/encryption.nix b/hosts/apollo/boot/encryption.nix new file mode 100644 index 0000000..2234bc9 --- /dev/null +++ b/hosts/apollo/boot/encryption.nix @@ -0,0 +1,41 @@ +{ pkgs, lib, inputs, ... }: + +{ + boot = { + # Luks Decryption for ZFS + initrd = { + supportedFilesystems = [ "ext4" "zfs" ]; + availableKernelModules = [ "hid_apple" ]; + systemd = { + enable = true; + fido2.enable = true; + emergencyAccess = true; + mounts = [ + { + what = "/dev/mapper/zfs-keys"; + where = "/keys"; + type = "ext4"; + options = "ro"; + } + ]; + }; + luks.fido2Support = false; + + luks.devices."zfs-keys" = { + device = "/dev/disk/by-id/nvme-CT1000P2SSD8_2138E5D5DA5A-part2"; + crypttabExtraOpts = [ "fido2-device=auto" ]; + }; + + systemd.services."zfs-import-nix-root" = { + wants = [ "keys.mount" ]; + after = [ "keys.mount" ]; + }; + + }; + }; + + systemd.services."zfs-import-nix-main" = { + wants = [ "keys.mount" ]; + after = [ "keys.mount" ]; + }; +} \ No newline at end of file diff --git a/hosts/apollo/boot/filesystems.nix b/hosts/apollo/boot/filesystems.nix new file mode 100644 index 0000000..5830c12 --- /dev/null +++ b/hosts/apollo/boot/filesystems.nix @@ -0,0 +1,42 @@ +{ ... }: + +{ + boot.zfs.forceImportRoot = false; + fileSystems."/" = { + device = "nix-root/root"; + fsType = "zfs"; + }; + + fileSystems."/var/log" = { + device = "nix-root/syslog"; + fsType = "zfs"; + }; + + fileSystems."/nix" = { + device = "nix-root/nix"; + fsType = "zfs"; + }; + + fileSystems."/keys" = { + device = "/dev/mapper/zfs-keys"; + fsType = "ext4"; + }; + + fileSystems."/home/nyxerinys" = { + device = "nix-main/nyxerinys"; + fsType = "zfs"; + }; + + fileSystems."/boot" = { + device = "/dev/disk/by-uuid/A5CB-B201"; + fsType = "vfat"; + options = [ "fmask=0022" "dmask=0022" ]; + }; + + swapDevices = [ + { + device = "/dev/disk/by-id/nvme-CT1000P2SSD8_2138E5D5DA5A-part3"; + randomEncryption.enable = true; + } + ]; +} \ No newline at end of file diff --git a/hosts/apollo/default.nix b/hosts/apollo/default.nix index f2a00dc..f055ccc 100644 --- a/hosts/apollo/default.nix +++ b/hosts/apollo/default.nix @@ -2,7 +2,7 @@ { imports = [ - ./boot.nix + ./boot ./hardware.nix ./autologin.nix ];