22 lines
632 B
Nix
22 lines
632 B
Nix
{ config, lib, ... }:
|
|
let
|
|
cfg = config.custom.services.zfsReplication;
|
|
in
|
|
{
|
|
options.custom.services.zfsReplication.enable = lib.mkOption {
|
|
type = lib.types.bool;
|
|
default = false;
|
|
};
|
|
|
|
config = lib.mkIf cfg.enable {
|
|
services.zfs.autoReplication = {
|
|
enable = true;
|
|
host = "zfs-backup.vsinerva.fi";
|
|
identityFilePath = "/etc/ssh/ssh_host_ed25519_key";
|
|
localFilesystem = "zroot";
|
|
remoteFilesystem = "zroot/backups/${config.networking.hostName}";
|
|
username = "root";
|
|
};
|
|
services.openssh.knownHosts."zfs-backup.vsinerva.fi".publicKey = config.custom.sshKeys.zfs-backup;
|
|
};
|
|
}
|