docs(nixos): clarify host module options

This commit was merged in pull request #139.
This commit is contained in:
2026-10-07 18:20:53 -04:00
parent b3c4903c82
commit 65c84f5b39
2 changed files with 8 additions and 13 deletions

View File

@@ -5,7 +5,7 @@
... ...
}: }:
{ {
options.modules.host.cachyos.enable = lib.mkEnableOption "CachyOS kernel"; options.modules.host.cachyos.enable = lib.mkEnableOption "the CachyOS kernel";
config = lib.mkIf config.modules.host.cachyos.enable { config = lib.mkIf config.modules.host.cachyos.enable {
boot.kernelPackages = pkgs.linuxPackages_cachyos; boot.kernelPackages = pkgs.linuxPackages_cachyos;

View File

@@ -3,13 +3,13 @@
lib, lib,
... ...
}: }:
# The host-level ZFS pool import: durable service state a host mounts, never rebuilds. # Imports existing ZFS pools that hold durable service state.
let let
cfg = config.modules.host.zfs; # NOLINT(let_order) cfg = config.modules.host.zfs; # NOLINT(let_order)
in in
{ {
options.modules.host.zfs = { options.modules.host.zfs = {
enable = lib.mkEnableOption "importing durable ZFS pools that hold service state"; enable = lib.mkEnableOption "ZFS pool imports for durable service state";
pools = lib.mkOption { pools = lib.mkOption {
type = lib.types.attrsOf (lib.types.attrsOf lib.types.path); type = lib.types.attrsOf (lib.types.attrsOf lib.types.path);
@@ -23,29 +23,24 @@ in
} }
''; '';
description = '' description = ''
The ZFS pools to import at boot, keyed by pool name, each pool mapping a Lists pools that NixOS imports at boot.
dataset path relative to it to that dataset's mountpoint. A pool is Maps each dataset name to its mount point.
durable state imported as it stands, never created or destroyed by a NixOS does not create or destroy these pools during rebuilds.
rebuild, so a service's data survives any rebuild or reimage. A pool An empty map imports the pool without declaring file systems.
with an empty map is still imported, leaving each dataset to its own ZFS
`mountpoint` property.
''; '';
}; };
}; };
config = lib.mkIf cfg.enable { config = lib.mkIf cfg.enable {
# The ZFS stack in the kernel and boot, needed even where the root filesystem is another kind.
boot.supportedFilesystems = [ "zfs" ]; boot.supportedFilesystems = [ "zfs" ];
# Derive a stable 32-bit host ID from the configured hostname. # This module derives a stable host ID from the configured hostname.
networking.hostId = builtins.substring 0 8 ( networking.hostId = builtins.substring 0 8 (
builtins.hashString "sha256" config.networking.hostName builtins.hashString "sha256" config.networking.hostName
); );
# The declared pools are imported at boot, distinct from any pool backing the root filesystem.
boot.zfs.extraPools = lib.attrNames cfg.pools; boot.zfs.extraPools = lib.attrNames cfg.pools;
# Each declared dataset is mounted at its host path as a native ZFS filesystem.
fileSystems = lib.mkMerge ( fileSystems = lib.mkMerge (
lib.mapAttrsToList ( lib.mapAttrsToList (
pool: mounts: pool: mounts: