about summary refs log tree commit diff
path: root/users/fcuny/desktop/media/sync-music.nix
blob: 85e795aacc630f39b7e36996caf2d89fea4ebf9c (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
30
{ config, pkgs, ... }:

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

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