machines/gw-cnx-1: disko update

This commit is contained in:
2026-07-31 09:38:07 +07:00
parent 292a699a2b
commit 0c11aca91f
+52 -33
View File
@@ -1,44 +1,50 @@
# Single-disk ZFS layout for the Topton's 256GB mSATA SSD: vfat ESP for boot, { ... }:
# the rest a zpool (zstd compression, no atime). Single disk = no redundancy; let
# ZFS buys us compression, snapshots, and checksumming. Requires hashDisk = disk: "os-${builtins.substring 0 5 (builtins.hashString "sha256" disk)}";
# networking.hostId (set in configuration.nix). The device is a placeholder: os = "/dev/disk/by-id/ata-TS256GMSA230S_J927900030";
# boot the installer, read the real id from `ls -l /dev/disk/by-id/`, and fill in
# it in before `clan machines install`. Changing the layout later requires
# wiping and reinstalling.
{ {
boot.loader.grub.efiSupport = true; boot.loader = {
boot.loader.grub.efiInstallAsRemovable = true; systemd-boot = {
boot.loader.grub.enable = true; enable = true;
};
efi = {
canTouchEfiVariables = true;
};
};
boot.zfs.forceImportRoot = true;
disko.devices = { disko.devices = {
disk = { disk = {
main = { "os-${hashDisk os}" = {
name = "main-gw-cnx-1";
device = "/dev/disk/by-id/CHANGE-ME-msata-ssd";
type = "disk"; type = "disk";
device = os;
content = { content = {
type = "gpt"; type = "gpt";
partitions = { partitions = {
"boot" = {
size = "1M";
type = "EF02"; # for grub MBR
priority = 1;
};
ESP = { ESP = {
size = "1G";
type = "EF00"; type = "EF00";
size = "500M";
content = { content = {
type = "filesystem"; type = "filesystem";
format = "vfat"; format = "vfat";
mountpoint = "/boot"; mountpoint = "/boot";
mountOptions = [ "umask=0077" ]; mountOptions = [ "nofail" ];
}; };
}; };
zfs = { system = {
size = "100%"; size = "100%";
content = { content = {
type = "zfs"; type = "zfs";
pool = "rpool"; pool = "zroot";
};
};
swap = {
size = "16G";
content = {
type = "swap";
}; };
}; };
}; };
@@ -46,29 +52,42 @@
}; };
}; };
zpool = { zpool = {
rpool = { zroot = {
type = "zpool"; type = "zpool";
options.ashift = "12";
rootFsOptions = { rootFsOptions = {
compression = "zstd"; mountpoint = "none";
compression = "lz4";
acltype = "posixacl"; acltype = "posixacl";
xattr = "sa"; xattr = "sa";
atime = "off"; "com.sun:auto-snapshot" = "true";
mountpoint = "none";
}; };
options.ashift = "12";
datasets = { datasets = {
root = { "root" = {
type = "zfs_fs"; type = "zfs_fs";
options.mountpoint = "none";
};
"root/nixos" = {
type = "zfs_fs";
options.mountpoint = "/";
mountpoint = "/"; mountpoint = "/";
}; };
nix = { "root/home" = {
type = "zfs_fs"; type = "zfs_fs";
mountpoint = "/nix"; options.mountpoint = "/home";
mountpoint = "/home";
}; };
# Service state (Omada, Kea leases, CrowdSec db, journald) — its own "root/tmp" = {
# dataset so it can be snapshotted/sent independently of the OS.
var = {
type = "zfs_fs"; type = "zfs_fs";
mountpoint = "/tmp";
options = {
mountpoint = "/tmp";
sync = "disabled";
};
};
"root/var" = {
type = "zfs_fs";
options.mountpoint = "/var";
mountpoint = "/var"; mountpoint = "/var";
}; };
}; };