Skip to content

Instantly share code, notes, and snippets.

@tfc
Created May 22, 2026 07:59
Show Gist options
  • Select an option

  • Save tfc/0273c98c80c04add26f440ac04699345 to your computer and use it in GitHub Desktop.

Select an option

Save tfc/0273c98c80c04add26f440ac04699345 to your computer and use it in GitHub Desktop.
# Partitions:
# 1. BIOS boot (1M) -> grub compat
# 2. ESP (500M) -> /boot
# 3. persist (rest) -> /persist (ext4), includes /persist/nix
#
# Usage: disko.devices = import ../disk-layout.nix "/dev/sda";
diskDevice: {
disk.${diskDevice} = {
device = diskDevice;
type = "disk";
content = {
type = "gpt";
partitions = {
boot = {
priority = 0;
size = "1M";
type = "EF02";
};
ESP = {
priority = 1;
size = "500M";
type = "EF00";
content = {
type = "filesystem";
format = "vfat";
mountpoint = "/boot";
};
};
persist = {
priority = 3;
size = "100%";
content = {
type = "filesystem";
format = "ext4";
mountpoint = "/";
};
};
};
};
};
}
{
config,
lib,
modulesPath,
pkgs,
...
}:
{
imports = [
"${modulesPath}/profiles/qemu-guest.nix"
];
disko.devices = import ../disk-layout.nix "/dev/sda";
boot.loader.systemd-boot.enable = true;
boot.loader.systemd-boot.configurationLimit = 2;
networking.firewall.logRefusedConnections = false;
networking.useDHCP = false;
systemd.network.enable = true;
systemd.network.networks."10-wan" = {
matchConfig.Name = "enp1s0";
networkConfig.DHCP = "ipv4";
address = [ "<HETZNER IPV6>" ];
routes = [ { Gateway = "fe80::1"; } ];
};
nixpkgs.hostPlatform = "aarch64-linux";
services.openssh.enable = true;
services.fail2ban.enable = true;
system.stateVersion = "26.05";
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment