about summary refs log tree commit diff
path: root/users/fcuny/desktop/media/sync-videos.nix
blob: ced319dcc4ae945bcdd5f0c8c87b9ab60830cd3e (plain) (blame)
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
{ config, pkgs, ... }:

{
  systemd.user.services.sync-videos = {
    Unit = {
      Description = "synchronize my videos to the NAS";
      Documentation = "man:rsync(1)";
      ConditionFileIsExecutable = "${pkgs.rsync}/bin/rsync";
    };
    Service = {
      Type = "oneshot";
      ExecStart = "${pkgs.rsync}/bin/rysnc -avz -t %h/media/videos/ nas.home:/data/videos/incoming";
    };
  };

  systemd.user.timers.sync-videos = {
    Unit = {
      Description = "synchronize my videos to the NAS";
      Documentation = "man:rsync(1)";
    };
    Timer = {
      OnBootSec = "120m";
      OnUnitActiveSec = "1d";
      RandomizedDelaySec = "1800";
      Persistent = true;
    };
    Install = { WantedBy = [ "timers.target" ]; };
  };
}