From 59e270033623cb34aef3ae2ffdc6609addd515ba Mon Sep 17 00:00:00 2001 From: Anish L Date: Tue, 14 Jun 2022 23:27:12 +1000 Subject: [PATCH] clean up get-music, needs to be in it's own proflie --- profiles/sync/get-music.nix | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) 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 ]; }