From 104804dbf693bdc52615bba1db724292d8153f7d Mon Sep 17 00:00:00 2001 From: beatzaplenty Date: Tue, 21 Jul 2026 23:54:00 +0000 Subject: [PATCH] Stage a ZFS RAID0 disko layout for the bare-metal gui host Adds modules/disko/baremetal.nix: two disks, each its own top-level zpool vdev with no mirror/raidz between them (disko's zpool `mode` defaults to "" for a plain stripe), ESP + systemd-boot on disk1. Device paths are placeholders in variables.nix (guiRootDisk1/guiRootDisk2) until the real hardware profile arrives. Verified structurally by building a throwaway nixosSystem with the actual disko.nixosModules.disko and reading the generated system.build.formatScript: it emits `zpool create rpool ... disk1 disk2` with no mirror/raidz keyword, confirming a genuine stripe. Not yet wired into any flake target -- that happens once the hardware config lands and a new bare-metal platform module is added, per the agreed sequencing. --- modules/disko/baremetal.nix | 87 +++++++++++++++++++++++++++++++++++++ variables.nix | 6 +++ 2 files changed, 93 insertions(+) create mode 100644 modules/disko/baremetal.nix diff --git a/modules/disko/baremetal.nix b/modules/disko/baremetal.nix new file mode 100644 index 0000000..c24dcbf --- /dev/null +++ b/modules/disko/baremetal.nix @@ -0,0 +1,87 @@ +{ vars, ... }: + +{ + # ZFS RAID0 (striped, no redundancy) root pool for the bare-metal gui + # host — two disks, each contributing its own top-level vdev. disko's + # zpool `mode` defaults to "" (plain stripe) when left unset, which is + # what gives RAID0 semantics here rather than mirror/raidz. + # + # Device paths are placeholders until the real hardware profile lands — + # fill in vars.guiRootDisk1/guiRootDisk2 (stable /dev/disk/by-id/... + # paths, not /dev/sdX) before running disko against real hardware. Swap + # is deliberately left out for now — sizing that sensibly needs the + # box's actual RAM size, which comes with the hardware profile too. + # + # Not yet imported anywhere: this awaits the new bare-metal platform + # module (alongside modules/boot/efi.nix for systemd-boot, matching + # modules/platforms/proxmox.nix's pattern) once the hardware config is + # in hand. + disko.devices = { + disk = { + disk1 = { + type = "disk"; + device = vars.guiRootDisk1; + + content = { + type = "gpt"; + + partitions = { + esp = { + priority = 1; + name = "ESP"; + size = "512M"; + type = "EF00"; + + content = { + type = "filesystem"; + format = "vfat"; + mountpoint = "/boot"; + mountOptions = [ "umask=0077" ]; + }; + }; + + zfs = { + size = "100%"; + + content = { + type = "zfs"; + pool = "rpool"; + }; + }; + }; + }; + }; + + disk2 = { + type = "disk"; + device = vars.guiRootDisk2; + + content = { + type = "gpt"; + + partitions = { + zfs = { + size = "100%"; + + content = { + type = "zfs"; + pool = "rpool"; + }; + }; + }; + }; + }; + }; + + zpool.rpool = { + type = "zpool"; + + rootFsOptions = { + compression = "zstd"; + "com.sun:auto-snapshot" = "false"; + }; + mountpoint = "/"; + options.ashift = "12"; + }; + }; +} diff --git a/variables.nix b/variables.nix index 36fd232..db37d20 100644 --- a/variables.nix +++ b/variables.nix @@ -52,6 +52,12 @@ wifiSsid = ""; wifiPassword = ""; + # Bare-metal gui host's two disks for a ZFS RAID0 (striped) root pool + # (modules/disko/baremetal.nix). Use stable /dev/disk/by-id/... paths, + # not /dev/sdX -- fill in once the hardware profile is available. + guiRootDisk1 = ""; + guiRootDisk2 = ""; + # System timeZone = "Australia/Brisbane";