about summary refs log tree commit diff
path: root/users/fcuny/desktop/media/sync-music.nix
diff options
context:
space:
mode:
authorFranck Cuny <franck@fcuny.net>2022-02-18 17:41:01 -0800
committerFranck Cuny <franck@fcuny.net>2022-02-18 17:41:01 -0800
commitf544e22cc0f8107eb1308b8fccb483f09f71e27a (patch)
treea653063d44b6971fab5db673f9d62094bc9496f5 /users/fcuny/desktop/media/sync-music.nix
parentxserver: add at-spi2-core package (diff)
downloadworld-f544e22cc0f8107eb1308b8fccb483f09f71e27a.tar.gz
media: reorganize in multiples modules
Add two new modules to synchronize videos and musics to the NAS.
Diffstat (limited to '')
-rw-r--r--users/fcuny/desktop/media/sync-music.nix30
1 files changed, 30 insertions, 0 deletions
diff --git a/users/fcuny/desktop/media/sync-music.nix b/users/fcuny/desktop/media/sync-music.nix
new file mode 100644
index 0000000..85e795a
--- /dev/null
+++ b/users/fcuny/desktop/media/sync-music.nix
@@ -0,0 +1,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" ]; };
+  };
+}