Files
homelab/hosts/terra/disk-config.nix
T
darmanandClaude Sonnet 5 6f24ab69ad docs: condense comments across the repo
Comments had drifted into multi-paragraph narrative (git commit
lineage, debugging stories, restated code) in several hot spots
(scripts/deploy, hermes-agent.nix, flake.nix, gitea.nix, headscale.nix).
Trim every comment to its load-bearing "why" — gotchas, safety
warnings, and non-obvious rationale survive verbatim in substance,
just tightened to 1-2 sentences; historical narrative and anything
already covered in CLAUDE.md is cut. No code/logic changed.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01UJqEmY1y3AYX3JoX4Y6b21
2026-09-18 21:36:30 +02:00

56 lines
2.1 KiB
Nix

{ ... }:
# Declarative OS-disk layout (disko). UEFI: GPT with an ESP + btrfs root.
# disko both PARTITIONS/FORMATS this disk and generates the NixOS
# `fileSystems.*` entries, so hardware-configuration.nix must NOT define
# fileSystems for "/" or "/boot".
#
# ⚠️ disko's `mkfs` step skips formatting if `blkid` still detects a
# filesystem signature on the partition. Repartitioning doesn't erase
# signatures at the new offsets, so this disk's old CachyOS btrfs
# superblock survived, causing mkfs (and the ESP's mkfs.vfat) to be
# skipped and the later mount to fail on the stale superblock.
# Fix: `preCreateHook = wipefs --all --force "$device"` on each
# partition — it runs after sgdisk re-cuts the partition but before the
# `blkid` guard, so the guard sees no signature and `mkfs` actually runs.
#
# ⚠️ This disk is WIPED on install. This is the Kingston SA400 SSD that
# currently holds CachyOS (btrfs root+subvols on sdb2, ESP on sdb1).
# The dev-data disks (sdc ext4 /mnt/hdd_01, LVM vg_ssd /mnt/ssd_01) and the
# leftover ntfs disks (sda, sdf, nvme0n1) are NOT listed here — they are
# mounted as plain fileSystems in configuration.nix (or, for the ntfs
# disks, ignored entirely) so they are never touched.
{
disko.devices.disk.os = {
type = "disk";
device = "/dev/disk/by-id/ata-KINGSTON_SA400S37480G_50026B738072F6C6";
content = {
type = "gpt";
partitions = {
ESP = {
size = "512M";
type = "EF00";
content = {
type = "filesystem";
format = "vfat";
mountpoint = "/boot";
mountOptions = [ "umask=0077" ];
# erase any stale signature before disko's blkid format-guard (above)
preCreateHook = ''wipefs --all --force "$device"'';
};
};
root = {
size = "100%";
content = {
type = "btrfs";
extraArgs = [ "-f" ];
mountpoint = "/";
# same wipefs fix as the ESP above (see header comment)
preCreateHook = ''wipefs --all --force "$device"'';
};
};
};
};
};
}