From 151264c66fc56af5b74fb3a42d9a36b84f71d0ca Mon Sep 17 00:00:00 2001
From: Luke Else <mail@luke-else.co.uk>
Date: Fri, 21 Mar 2025 10:51:45 +0000
Subject: [PATCH] Changed boot parameters after install

---
 modules/common.nix | 36 ++++++++++++++++++++++++------------
 1 file changed, 24 insertions(+), 12 deletions(-)

diff --git a/modules/common.nix b/modules/common.nix
index 4509915..bff7df8 100644
--- a/modules/common.nix
+++ b/modules/common.nix
@@ -1,27 +1,39 @@
 { config, pkgs, ... }:
 
 {
-  # Bootloader
+  # Bootloader: systemd-boot with EFI support
   boot = {
     loader = {
-      systemd-boot = {
-        enable = true;
+      systemd-boot.enable = true;
+      efi.canTouchEfiVariables = true;
+    };
+
+    # Enable support for LUKS
+    initrd = {
+      luks.devices = {
+        "root" = {
+          device = "/dev/sda1"; # Change to your actual encrypted partition
+          preLVM = true;
+          allowDiscards = true; # Enable if using an SSD with TRIM support
+        };
       };
     };
-    efi = {
-      enable = true;
-      canTouchEfiVariables = true;
-      espDevice = "/dev/sda2";
-    };
-    initrd.luks.devices.cryptroot.device = "/dev/sda1";
-  }
+  };
 
+  # File systems
   fileSystems."/" = {
-    device = "/dev/mapper/root";
+    device = "/dev/mapper/root"; # LUKS unlocked device
     fsType = "ext4";
   };
 
-  swapDevices = [{ device = "/swapfile"; size = 8192; }];
+  # EFI partition mount (usually /boot or /boot/efi)
+  fileSystems."/boot" = {
+    device = "/dev/sda2"; # Change to your actual EFI partition
+    fsType = "vfat";
+    options = [ "nofail" "defaults" ];
+  };
+
+  swapDevices = [{ device = "/swapfile"; size = 4096; }];
 
   # Locales and timezone
   time.timeZone = "Europe/London";