-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrsync.nix
39 lines (37 loc) · 1.24 KB
/
rsync.nix
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
# /etc/nixos/configuration.nix
{ config, pkgs, ... }:
let
sourceDatasets = [
"galaxy-${config.networking.hostName}/apps"
"galaxy-${config.networking.hostName}/frontier"
"galaxy-${config.networking.hostName}/wilds"
];
## Replace with your remote backup host
sshHost = "[email protected]";
sshKeyPath = "/home/root/.ssh/backup";
sshKeyService = {
enable = true;
description = "Generate SSH key for user ranka if it doesn't exist";
wantedBy = [ "multi-user.target" ];
serviceConfig = {
ExecStart="/etc/nixos/user-ssh-key.sh ${sshKeyPath}";
StandardOutput="journal";
StandardError="journal";
Type="oneshot";
Environment = "PATH=$PATH:/run/current-system/sw/bin:/run/wrappers/bin:/nix/var/nix/profiles/default/bin:/bin:/sbin:/usr/bin:/usr/sbin";
};
};
in
{
systemd.timers.snapshots = {
enable = true;
description = "ZFS Send Snapshots to remote host";
timerConfig = {
OnCalendar = "*-*-* *:15:00";
Persistent = true;
Unit = "snapshots.service";
};
wantedBy = [ "timers.target" ];
};
systemd.services.root-ssh-key = sshKeyService;
}