34 lines
778 B
Nix
34 lines
778 B
Nix
{ config, lib, pkgs, ... }:
|
|
let cfg = config.this.systems.zfs;
|
|
in with lib; {
|
|
options.this.systems.zfs = {
|
|
enable = mkOption {
|
|
default = false;
|
|
type = with types; bool;
|
|
description = "enable zfs";
|
|
};
|
|
};
|
|
|
|
config = mkIf cfg.enable {
|
|
boot = {
|
|
supportedFilesystems = [ "zfs" ];
|
|
zfs = {
|
|
forceImportRoot = false;
|
|
forceImportAll = false;
|
|
};
|
|
# this was required for the initial setup of the zpool.
|
|
# see https://nixos.org/nixos/options.html#boot.zfs.forceimportroot
|
|
# kernelParams = ["zfs_force=1"];
|
|
};
|
|
|
|
services.zfs = {
|
|
autoScrub.enable = true;
|
|
# enable default auto-snapshots
|
|
autoSnapshot = {
|
|
enable = true;
|
|
flags = "-k -p --utc";
|
|
};
|
|
};
|
|
};
|
|
}
|