91 lines
2.1 KiB
Nix
91 lines
2.1 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 = [
|
|
{
|
|
name = "snapshot";
|
|
type = "snap";
|
|
filesystems = {"zroot/main/home" = true;};
|
|
snapshotting = {
|
|
type = "periodic";
|
|
prefix = "zrepl-";
|
|
interval = "1h";
|
|
};
|
|
pruning = {
|
|
keep = [
|
|
{
|
|
type = "grid";
|
|
regex = "^zrepl-.*";
|
|
grid = lib.concatStringsSep " | " ["1x1h(keep=all)" "24x1h" "7x1d" "4x1w"];
|
|
}
|
|
];
|
|
};
|
|
}
|
|
{
|
|
name = "push-to-local-drive";
|
|
type = "push";
|
|
send = {encrypted = true;};
|
|
connect = {
|
|
type = "local";
|
|
listener_name = "sink-to-local-drive";
|
|
client_identity = config.networking.hostName;
|
|
};
|
|
filesystems = {"zroot/main/home" = true;};
|
|
replication = {
|
|
protection = {
|
|
initial = "guarantee_resumability";
|
|
incremental = "guarantee_incremental";
|
|
};
|
|
};
|
|
snapshotting = {type = "manual";};
|
|
pruning = {
|
|
keep_sender = [
|
|
{
|
|
type = "regex";
|
|
regex = ".*";
|
|
}
|
|
];
|
|
keep_receiver = [
|
|
{
|
|
type = "grid";
|
|
regex = "^zrepl-.*";
|
|
grid = lib.concatStringsSep " | " ["1x1h(keep=all)" "365x1d" "52x1w"];
|
|
}
|
|
];
|
|
};
|
|
}
|
|
{
|
|
name = "sink-to-local-drive";
|
|
type = "sink";
|
|
recv = {placeholder = {encryption = "off";};};
|
|
root_fs = "zbackup";
|
|
serve = {
|
|
type = "local";
|
|
listener_name = "sink-to-local-drive";
|
|
};
|
|
}
|
|
];
|
|
};
|
|
};
|
|
}
|