main
 1{ lib, ... }:
 2{
 3  # Disko declarative partitioning for Hetzner Cloud
 4  # Verify disk device with `lsblk` on the temporary Ubuntu before running nixos-anywhere
 5  # Hetzner Cloud typically uses /dev/sda, but confirm first
 6  disko.devices = {
 7    disk = {
 8      main = {
 9        device = "/dev/sda";
10        type = "disk";
11        content = {
12          type = "gpt";
13          partitions = {
14            boot = {
15              size = "1M";
16              type = "EF02"; # BIOS boot partition for GRUB
17            };
18            root = {
19              size = "100%";
20              content = {
21                type = "filesystem";
22                format = "ext4";
23                mountpoint = "/";
24                mountOptions = [
25                  "defaults"
26                  "noatime"
27                ];
28              };
29            };
30          };
31        };
32      };
33    };
34  };
35
36  swapDevices = [
37    {
38      device = "/swapfile";
39      size = 1024;
40    }
41  ];
42
43  # Hetzner Cloud networking is DHCP-based (simpler than DigitalOcean's static config)
44  networking = {
45    useDHCP = true;
46    usePredictableInterfaceNames = lib.mkForce true;
47  };
48}