feat(zfs): manage jeeves datasets declaratively from nix #47

Open
Richie wants to merge 2 commits from feature/manage-jeeves-datasets-declaratively-from-nix into main
Owner

Add a zfs_manager module that reconciles the live datasets on jeeves
against a nix declaration, and generate the snapshot retention config
from that same declaration so the two can no longer drift apart.

systems/jeeves/datasets.nix declares every dataset on the media, storage
and scratch pools, nested the way zfs nests them and flattened into
pool/parent/child names. Values were transcribed from the live pools
rather than from scripts/zfs.sh, which had gone stale: acltype reads back
as posix, and media/secure/important, scratch/kestra and storage/nomad
were never recorded. root_pool datasets are declared for retention only,
their properties stay unmanaged for now.

python.tools.zfs_manager creates missing datasets and corrects drifted
properties, and never destroys anything. Undeclared properties are judged
by the zfs source field, so inherited and default values stay quiet while
locally set ones warn. Size values are normalised to bytes so that 16K and
16384 do not re-issue zfs set on every run.

vars.nix now derives its paths from the declared mountpoints instead of
repeating them, dropping three zfs_* keys that nothing referenced.

Replaces systems/jeeves/snapshot_config.toml, which listed a dataset that
does not exist and omitted thirteen that do.

Add a zfs_manager module that reconciles the live datasets on jeeves against a nix declaration, and generate the snapshot retention config from that same declaration so the two can no longer drift apart. systems/jeeves/datasets.nix declares every dataset on the media, storage and scratch pools, nested the way zfs nests them and flattened into pool/parent/child names. Values were transcribed from the live pools rather than from scripts/zfs.sh, which had gone stale: acltype reads back as posix, and media/secure/important, scratch/kestra and storage/nomad were never recorded. root_pool datasets are declared for retention only, their properties stay unmanaged for now. python.tools.zfs_manager creates missing datasets and corrects drifted properties, and never destroys anything. Undeclared properties are judged by the zfs source field, so inherited and default values stay quiet while locally set ones warn. Size values are normalised to bytes so that 16K and 16384 do not re-issue zfs set on every run. vars.nix now derives its paths from the declared mountpoints instead of repeating them, dropping three zfs_* keys that nothing referenced. Replaces systems/jeeves/snapshot_config.toml, which listed a dataset that does not exist and omitted thirteen that do.
Richie force-pushed feature/manage-jeeves-datasets-declaratively-from-nix from ae18feb0fd to aa552ecca1 2026-08-19 20:14:24 -04:00 Compare
Richie force-pushed feature/manage-jeeves-datasets-declaratively-from-nix from aa552ecca1 to 45479c7d33 2026-08-19 22:11:38 -04:00 Compare
Richie added 2 commits 2026-08-19 22:17:38 -04:00
- Introduced a new `datasets.nix` file to define ZFS datasets and their properties, allowing for centralized management of dataset configurations.
- Updated `default.nix` to import and enable the `zfs_manager` service, integrating it into the system configuration.
- Refactored `zfs.sh` to remove dataset creation commands, delegating dataset management to the `zfs_manager` service.
- Removed the legacy `snapshot_config.toml` file, as snapshot configurations are now handled within `datasets.nix`.
- Modified `vars.nix` to derive mountpoint paths from `datasets.nix`, ensuring consistency across the configuration.
- Created a new `zfs.nix` file to define the `zfs_manager` service and its dependencies.
- Added comprehensive tests for the `zfs_manager` functionality, covering dataset creation, property management, and error handling.
feat(zfs): add declarative management for ZFS datasets and integration tests
treefmt / nix fmt (pull_request) Successful in 5s
pytest / pytest (pull_request) Successful in 31s
test ebook search / test-ebook-search (pull_request) Successful in 36s
build_systems / build-bob (pull_request) Successful in 49s
build_systems / build-rhapsody-in-green (pull_request) Successful in 1m2s
build_systems / build-brain (pull_request) Successful in 49s
build_systems / build-jeeves (pull_request) Successful in 2m18s
zfs integration / zfs-integration (pull_request) Successful in 1m9s
ef4ebc6cdf
Richie force-pushed feature/manage-jeeves-datasets-declaratively-from-nix from 45479c7d33 to ef4ebc6cdf 2026-08-19 22:17:38 -04:00 Compare
All checks were successful
treefmt / nix fmt (pull_request) Successful in 5s
pytest / pytest (pull_request) Successful in 31s
test ebook search / test-ebook-search (pull_request) Successful in 36s
build_systems / build-brain (pull_request) Successful in 49s
build_systems / build-bob (pull_request) Successful in 49s
build_systems / build-rhapsody-in-green (pull_request) Successful in 1m2s
zfs integration / zfs-integration (pull_request) Successful in 1m9s
build_systems / build-jeeves (pull_request) Successful in 2m18s
Checking for merge conflicts…
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin feature/manage-jeeves-datasets-declaratively-from-nix:feature/manage-jeeves-datasets-declaratively-from-nix
git checkout feature/manage-jeeves-datasets-declaratively-from-nix
Sign in to join this conversation.