From 40458f49ebada72ccd8c62ac16d1a9b5c4345b80 Mon Sep 17 00:00:00 2001 From: Soispha Date: Sat, 8 Jul 2023 11:16:40 +0200 Subject: Fix(system/disks): Change partitioning scheme to support gpt/bios boot --- system/disks/default.nix | 62 ++++++++++++++++++++++++++++++++---------------- 1 file changed, 41 insertions(+), 21 deletions(-) (limited to 'system/disks/default.nix') 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 = { -- cgit 1.4.1