From f544e22cc0f8107eb1308b8fccb483f09f71e27a Mon Sep 17 00:00:00 2001 From: Franck Cuny Date: Fri, 18 Feb 2022 17:41:01 -0800 Subject: media: reorganize in multiples modules Add two new modules to synchronize videos and musics to the NAS. --- users/fcuny/desktop/media/sync-videos.nix | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 users/fcuny/desktop/media/sync-videos.nix (limited to 'users/fcuny/desktop/media/sync-videos.nix') diff --git a/users/fcuny/desktop/media/sync-videos.nix b/users/fcuny/desktop/media/sync-videos.nix new file mode 100644 index 0000000..ced319d --- /dev/null +++ b/users/fcuny/desktop/media/sync-videos.nix @@ -0,0 +1,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" ]; }; + }; +} -- cgit 1.4.1