summary refs log tree commit diff stats
path: root/system/disks/default.nix
diff options
context:
space:
mode:
authorSoispha <soispha@vhack.eu>2023-07-08 11:16:40 +0200
committerSoispha <soispha@vhack.eu>2023-07-08 11:16:40 +0200
commit40458f49ebada72ccd8c62ac16d1a9b5c4345b80 (patch)
tree9637b90f4ccea3fe4327db6220f836f13c5a9845 /system/disks/default.nix
parentMerge branch 'disko' (diff)
downloadnixos-server-40458f49ebada72ccd8c62ac16d1a9b5c4345b80.tar.gz
nixos-server-40458f49ebada72ccd8c62ac16d1a9b5c4345b80.zip
Fix(system/disks): Change partitioning scheme to support gpt/bios boot
Diffstat (limited to '')
-rw-r--r--system/disks/default.nix62
1 files changed, 41 insertions, 21 deletions
diff --git a/system/disks/default.nix b/system/disks/default.nix
index 24898fe..5453426 100644
--- a/system/disks/default.nix
+++ b/system/disks/default.nix
@@ -7,7 +7,6 @@ with lib; let
   cfg = config.system.disks;
   defaultMountOptions = ["compress-force=zstd:15"];
 in {
-
   options.system.disks = {
     disk = mkOption {
       type = lib.types.path;
@@ -21,26 +20,47 @@ in {
       disk.main = {
         device = cfg.disk;
         content = {
-          type = "btrfs";
-          extraArgs = ["-f" "--label nixos"]; # f: Override existing partitions
-          subvolumes = {
-            "nix" = {
-              mountpoint = "/nix";
-              mountOptions = defaultMountOptions;
-            };
-            "persistent-storage" = {
-              mountpoint = "/srv";
-              mountOptions = defaultMountOptions;
-            };
-            "persistent-storage@snapshots" = {
-              mountpoint = "/srv/.snapshots";
-              mountOptions = defaultMountOptions;
-            };
-            "boot" = {
-              mountpoint = "/boot";
-              mountOptions = defaultMountOptions;
-            };
-          };
+          type = "table";
+          format = "gpt";
+          partitions = [
+            {
+              name = "boot";
+              start = "0";
+              end = "1M";
+              part-type = "primary";
+              flags = ["bios_grub"];
+            }
+            {
+              name = "root";
+              # leave space for the grub aka BIOS boot
+              start = "1M";
+              end = "100%";
+              part-type = "primary";
+              bootable = true;
+              content = {
+                type = "btrfs";
+                extraArgs = ["-f" "--label nixos"]; # f: Override existing partitions
+                subvolumes = {
+                  "nix" = {
+                    mountpoint = "/nix";
+                    mountOptions = defaultMountOptions;
+                  };
+                  "persistent-storage" = {
+                    mountpoint = "/srv";
+                    mountOptions = defaultMountOptions;
+                  };
+                  "persistent-storage@snapshots" = {
+                    mountpoint = "/srv/.snapshots";
+                    mountOptions = defaultMountOptions;
+                  };
+                  "boot" = {
+                    mountpoint = "/boot";
+                    mountOptions = defaultMountOptions;
+                  };
+                };
+              };
+            }
+          ];
         };
       };
       nodev = {