diff --git a/profiles/sync/get-music.nix b/profiles/sync/get-music.nix index 721696ec..4c070e43 100644 --- a/profiles/sync/get-music.nix +++ b/profiles/sync/get-music.nix @@ -1,12 +1,20 @@ { pkgs, lib, ... }: { - services.cron = { - enable = true; - systemCronJobs = [ - "* */24 * * * * anish /etc/get-music.sh" + systemd.services.get-music-sync = { + serviceConfig.Type = "oneshot"; + path = [ + pkgs.coreutils + pkgs.rsync ]; + script = builtins.readFile ./get-music.sh; + serviceConfig = { + User = "anish"; + }; + }; + systemd.timers.get-music-timer = { + wantedBy = [ "timers.target" ]; + partOf = [ "get-music-sync.service" ]; + timerConfig.OnCalendar = [ "daily" ]; }; - environment.etc."get-music.sh".text = builtins.readFile "./get-music.sh"; - evironment.systemPackages = [ pkgs.rsync ]; }