nixos-config/linux/quasar/zfs.nix

77 lines
1.8 KiB
Nix

{
config,
lib,
...
}: {
boot.loader.grub.zfsSupport = true;
services.zfs = {
autoScrub.enable = true;
trim.enable = true;
};
services.zrepl = {
enable = true;
settings = {
global = {
logging = [
{
type = "syslog";
level = "info";
format = "human";
}
];
};
jobs = let
listener_name = "archive";
in [
{
type = "push";
name = "snapshot";
connect = {
inherit listener_name;
type = "local";
client_identity = config.networking.hostName;
};
filesystems."zactive/main/home" = true;
send.encrypted = true;
snapshotting = {
type = "periodic";
prefix = "zrepl-";
interval = "1h";
};
pruning = {
keep_sender = [
{
type = "grid";
regex = "^zrepl-.*";
grid = lib.concatStringsSep " | " ["1x1h(keep=all)" "24x1h" "7x1d" "4x1w"];
}
];
keep_receiver = [
{
type = "grid";
regex = "^zrepl-.*";
grid = lib.concatStringsSep " | " ["1x1h(keep=all)" "30x1d" "52x1w"];
}
];
};
replication.protection = {
initial = "guarantee_resumability";
incremental = "guarantee_incremental";
};
}
{
type = "sink";
name = "archive";
serve = {
inherit listener_name;
type = "local";
};
root_fs = "zarchive/snapshot";
recv.placeholder.encryption = "off";
}
];
};
};
}