diff --git a/systems/base/configuration.nix b/systems/base/configuration.nix index 5054362..0ca9d9b 100644 --- a/systems/base/configuration.nix +++ b/systems/base/configuration.nix @@ -21,7 +21,7 @@ services.qemuGuest.enable = lib.mkDefault true; boot.loader.systemd-boot.enable = true; - boot.growPartition = lib.mkDefault true; + boot.loader.efi.canTouchEfiVariables = true; # Allow remote updates with flakes and non-root users nix.settings.trusted-users = [ @@ -98,6 +98,42 @@ }; }; + # Resize partition on boot + systemd.repart.partitions = { + "00-esp" = { + Type = "esp"; + SizeMinBytes = "550M"; + SizeMaxBytes = "550M"; + Format = "vfat"; + }; + "10-root" = { + Type = "linux-generic"; + Format = "btrfs"; + }; + }; + boot.initrd = { + # Custom systemd units in the initrd + systemd = { + enable = true; + services = { + resize-gpt = { + description = "Resize GPT to use full disk size"; + path = [ pkgs.gptfdisk ]; + wants = [ "systemd-repart.service" ]; + before = [ "systemd-repart.service" ]; + serviceConfig = { + Type = "oneshot"; + ExecStart = "/run/current-system/sw/bin/sgdisk --move-second-header /dev/sdX"; + }; + }; + }; + repart = { + enable = true; + device = "/dev/sda"; + }; + }; + }; + system.stateVersion = lib.mkDefault "24.05"; }; }