{ self }: { name = "zfs-integration"; nodes.machine = { pkgs, ... }: let testPython = pkgs.python314.withPackages (pythonPackages: [ pythonPackages.apprise pythonPackages.typer ]); in { imports = [ ../common/global/snapshot_manager.nix ../common/optional/zfs_manager.nix ]; boot.supportedFilesystems = [ "zfs" ]; networking.hostId = "deadbeef"; virtualisation = { emptyDiskImages = [ 2048 ]; memorySize = 2048; }; environment.systemPackages = [ testPython pkgs.zfs ]; services = { snapshot_manager = { enable = true; package = testPython; PYTHONPATH = "${self}/"; }; zfs_manager = { enable = true; package = testPython; PYTHONPATH = "${self}/"; defaultSnapshots = { "15_min" = 2; hourly = 2; daily = 2; monthly = 2; }; datasets = { testpool = { properties = { atime = "off"; compression = "lz4"; mountpoint = "/testpool"; }; }; "testpool/parent" = { properties = { compression = "zstd"; mountpoint = "/testpool/parent"; }; }; "testpool/parent/child" = { properties = { recordsize = "16K"; sync = "disabled"; }; snapshots = { "15_min" = 1; hourly = 1; daily = 1; monthly = 1; }; }; "testpool/secure" = { createIfMissing = false; properties = { encryption = "aes-256-gcm"; keyformat = "hex"; keylocation = "file:///root/zfs.key"; }; snapshots = { "15_min" = 0; hourly = 0; daily = 0; monthly = 0; }; }; "testpool/secure/child" = { properties.compression = "zstd-9"; }; }; }; }; systemd.services = { prepare-zfs-integration = { description = "Prepare the ZFS integration-test pool"; requiredBy = [ "zfs_manager.service" ]; before = [ "zfs_manager.service" ]; path = [ pkgs.zfs ]; serviceConfig = { Type = "oneshot"; RemainAfterExit = true; }; script = '' printf '%064d\n' 0 > /root/zfs.key chmod 0400 /root/zfs.key zpool create -f -m /testpool testpool /dev/vdb zfs create \ -o encryption=aes-256-gcm \ -o keyformat=hex \ -o keylocation=file:///root/zfs.key \ testpool/secure ''; }; zfs_manager = { requires = [ "prepare-zfs-integration.service" ]; after = [ "prepare-zfs-integration.service" ]; }; }; }; testScript = { nodes, ... }: builtins.replaceStrings [ "@snapshot_config@" ] [ (toString nodes.machine.services.snapshot_manager.path) ] (builtins.readFile ./zfs_integration.py); }