32 lines
1.1 KiB
Nix
32 lines
1.1 KiB
Nix
|
{ config, pkgs, lib, ... }:
|
||
|
{
|
||
|
# https://openzfs.github.io/openzfs-docs/Getting%20Started/NixOS/index.html
|
||
|
# https://nixos.org/manual/nixos/stable/#sec-linux-zfs
|
||
|
# https://nixos.wiki/wiki/ZFS
|
||
|
# https://search.nixos.org/options?query=services.zfs
|
||
|
|
||
|
boot.kernelPackages = lib.mkForce pkgs.zfs.latestCompatibleLinuxPackages;
|
||
|
boot.supportedFilesystems = [ "zfs" ];
|
||
|
boot.zfs.forceImportRoot = false;
|
||
|
|
||
|
# must be set per host
|
||
|
# head -c4 /dev/urandom | od -A none -t x4
|
||
|
# consider the one automatically generated by systemd:
|
||
|
# head -c 8 /etc/machine-id
|
||
|
#networking.hostId = "12345678";
|
||
|
|
||
|
services.zfs.autoSnapshot.enable = true; # simply runs zfstools
|
||
|
# default args, can be overriden per-dataset
|
||
|
services.zfs.autoSnapshot.frequent = 2; # 15 min
|
||
|
services.zfs.autoSnapshot.hourly = 3;
|
||
|
services.zfs.autoSnapshot.daily = 4;
|
||
|
services.zfs.autoSnapshot.weekly = 3;
|
||
|
services.zfs.autoSnapshot.monthly = 5;
|
||
|
|
||
|
#services.zfs.autoReplication.enable
|
||
|
#services.zfs.autoScrub.enable = true;
|
||
|
#services.zfs.trim.enable = true;
|
||
|
|
||
|
# config.services.nfs.server.enable will automatically export NFS dataset tagged as such
|
||
|
}
|