nixos/global/fs/zfs/replication.nix

29 lines
753 B
Nix
Raw Normal View History

2024-02-10 00:57:35 +08:00
{ pkgs
, lib
, config
, ... }: with lib; let
cfg = config.global.fs.zfs.replication;
in mkIf cfg.enable {
services.syncoid = {
enable = mkDefault true;
interval = mkDefault "daily";
sshKey = mkDefault "/var/lib/syncoid/.ssh/id_ed25519";
commonArgs = [
"--recursive"
"--mbuffer-size=128M"
];
2024-02-10 01:03:36 +08:00
localSourceAllow = mkOptionDefault [ "mount" ];
2024-02-10 00:57:35 +08:00
commands = (lists.foldr (name: commands: commands // {
"${config.global.fs.store}/${name}" = {
inherit (cfg) sendOptions;
target = "${cfg.remote}/${name}";
};
}) { }) cfg.datasets;
};
users.users.syncoid.uid = 82;
users.groups.syncoid.gid = 82;
environment.persistence."/nix/persist/fhs".directories = [ "/var/lib/syncoid" ];
}