diff --git a/hosts/plover/default.nix b/hosts/plover/default.nix index 66b27864..e72690db 100644 --- a/hosts/plover/default.nix +++ b/hosts/plover/default.nix @@ -42,6 +42,11 @@ in ./modules/services/wireguard.nix ]; + # Automatic format and partitioning. + disko.devices = import ./disko.nix { + disks = [ "/dev/sda" ]; + }; + networking = { nftables.enable = true; domain = "foodogsquared.one"; diff --git a/hosts/plover/disko.nix b/hosts/plover/disko.nix new file mode 100644 index 00000000..3b6748e1 --- /dev/null +++ b/hosts/plover/disko.nix @@ -0,0 +1,47 @@ +{ disks ? [ "/dev/sda" ], ... }: + +{ + disk.sda = { + device = builtins.elemAt disks 0; + type = "disk"; + content = { + format = "gpt"; + type = "table"; + partitions = [ + { + name = "boot"; + start = "0"; + end = "1MiB"; + part-type = "primary"; + flags = [ "bios_grub" ]; + } + + { + name = "ESP"; + start = "1MiB"; + end = "256MiB"; + bootable = true; + content = { + type = "filesystem"; + format = "vfat"; + mountpoint = "/boot"; + }; + flags = [ "esp" ]; + } + + { + name = "root"; + start = "256MiB"; + end = "100%"; + part-type = "primary"; + bootable = true; + content = { + type = "filesystem"; + format = "ext4"; + mountpoint = "/"; + }; + } + ]; + }; + }; +} diff --git a/hosts/plover/modules/hardware/hetzner-cloud-cx21.nix b/hosts/plover/modules/hardware/hetzner-cloud-cx21.nix index a94ef303..21ee3fe9 100644 --- a/hosts/plover/modules/hardware/hetzner-cloud-cx21.nix +++ b/hosts/plover/modules/hardware/hetzner-cloud-cx21.nix @@ -18,22 +18,16 @@ in # Hetzner can only support non-UEFI bootloader (or at least it doesn't with # systemd-boot). - boot.loader.grub.enable = lib.mkForce true; - boot.loader.grub.device = "/dev/sda"; + boot.loader.grub = { + enable = lib.mkForce true; + device = "/dev/sda"; + efiSupport = true; + efiInstallAsRemovable = true; + }; + boot.initrd.availableKernelModules = [ "ata_piix" "virtio_pci" "virtio_scsi" "xhci_pci" "sd_mod" "sr_mod" ]; boot.initrd.kernelModules = [ "nvme" ]; - fileSystems."/" = { - label = "nixos"; - fsType = "ext4"; - options = [ "defaults" ]; - }; - - fileSystems."/boot" = { - label = "boot"; - fsType = "vfat"; - }; - zramSwap.enable = true; nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";