nixos-config/linux/blitzar/zfs.nix

92 lines
2.1 KiB
Nix
Raw Normal View History

2024-01-16 18:48:06 -08:00
{
2024-08-14 11:14:20 -07:00
config,
lib,
...
}: {
2024-09-22 00:44:00 -07:00
boot.loader.grub.zfsSupport = true;
2023-10-09 10:44:07 -07:00
services.zfs = {
autoScrub.enable = true;
trim.enable = true;
};
services.zrepl = {
enable = true;
settings = {
global = {
2024-08-14 11:14:20 -07:00
logging = [
{
type = "syslog";
level = "info";
format = "human";
}
];
2023-10-09 10:44:07 -07:00
};
jobs = [
{
name = "snapshot";
type = "snap";
2024-08-14 11:14:20 -07:00
filesystems = {"zroot/main/home" = true;};
2023-10-09 10:44:07 -07:00
snapshotting = {
type = "periodic";
prefix = "zrepl-";
interval = "1h";
};
pruning = {
2024-08-14 11:14:20 -07:00
keep = [
{
type = "grid";
regex = "^zrepl-.*";
grid = lib.concatStringsSep " | " ["1x1h(keep=all)" "24x1h" "7x1d" "4x1w"];
}
];
2023-10-09 10:44:07 -07:00
};
}
{
name = "push-to-local-drive";
type = "push";
2024-08-14 11:14:20 -07:00
send = {encrypted = true;};
2023-10-09 10:44:07 -07:00
connect = {
type = "local";
listener_name = "sink-to-local-drive";
client_identity = config.networking.hostName;
};
2024-08-14 11:14:20 -07:00
filesystems = {"zroot/main/home" = true;};
2023-10-09 10:44:07 -07:00
replication = {
protection = {
initial = "guarantee_resumability";
incremental = "guarantee_incremental";
};
};
2024-08-14 11:14:20 -07:00
snapshotting = {type = "manual";};
2023-10-09 10:44:07 -07:00
pruning = {
2024-08-14 11:14:20 -07:00
keep_sender = [
{
type = "regex";
regex = ".*";
}
];
keep_receiver = [
{
type = "grid";
regex = "^zrepl-.*";
grid = lib.concatStringsSep " | " ["1x1h(keep=all)" "365x1d" "52x1w"];
}
];
2023-10-09 10:44:07 -07:00
};
}
{
name = "sink-to-local-drive";
type = "sink";
2024-08-14 11:14:20 -07:00
recv = {placeholder = {encryption = "off";};};
2023-10-09 10:44:07 -07:00
root_fs = "zbackup";
serve = {
type = "local";
listener_name = "sink-to-local-drive";
};
}
];
};
};
}