This repository has been archived on 2023-08-08. You can view files and clone it, but cannot push or open issues or pull requests.
nil/modules/system/zfs.nix

28 lines
677 B
Nix
Raw Normal View History

2021-12-15 05:12:00 +00:00
{ config, lib, pkgs, ... }:
2022-08-14 02:42:16 +00:00
let this = config.my.system.zfs;
2021-12-15 05:12:00 +00:00
in with lib; {
2022-08-14 02:42:04 +00:00
options.my.system.zfs.enable = mkEnableOption "zfs";
2021-12-15 05:11:38 +00:00
2022-08-14 02:42:16 +00:00
config = mkIf this.enable {
2021-12-15 05:12:00 +00:00
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"];
2021-12-15 05:11:38 +00:00
};
2021-12-15 05:12:00 +00:00
services.zfs = {
autoScrub.enable = true;
# enable default auto-snapshots
autoSnapshot = {
enable = true;
flags = "-k -p --utc";
};
};
};
2021-12-15 05:11:38 +00:00
}