2023-03-25 17:16:14 +00:00
|
|
|
{
|
|
|
|
options,
|
|
|
|
config,
|
|
|
|
pkgs,
|
|
|
|
lib,
|
|
|
|
...
|
|
|
|
}:
|
|
|
|
with lib; let
|
|
|
|
cfg = config.aa.system.zfs;
|
|
|
|
in {
|
|
|
|
options.aa.system.zfs = with types; {
|
|
|
|
enable = mkEnableOption "zfs";
|
|
|
|
# TODO: Introduce a zfsOnRoot option
|
|
|
|
};
|
|
|
|
|
|
|
|
config = mkIf cfg.enable {
|
2023-08-25 00:28:33 +00:00
|
|
|
environment.systemPackages = [pkgs.zfs-prune-snapshots];
|
|
|
|
|
2023-03-25 17:16:14 +00:00
|
|
|
services.zfs = {
|
|
|
|
autoScrub.enable = true;
|
2023-08-04 00:21:58 +00:00
|
|
|
# Still need to set `com.sun:auto-snapshot` to `true` on datasets
|
|
|
|
# zfs set com.sun:auto-snapshot=true pool/dataset
|
|
|
|
autoSnapshot = {
|
|
|
|
enable = true;
|
|
|
|
flags = "-k -p --utc";
|
|
|
|
};
|
2023-03-25 17:16:14 +00:00
|
|
|
};
|
|
|
|
};
|
|
|
|
}
|