Wallpaper background script with systemd timers

Hi,

i have a small script that moves a picture in my home directory in a new location to update the current background (cycle.sh).

Nixos config:

systemd = {
	services = {
		update-background = {
			description = "Update background image service";
			serviceConfig.Type = "oneshot";
			script = ''
				runuser -l me -c 'sh ~/bin/cycle.sh'
			'';
		};
	};
	
	timers = {
		update-background-timer = {
			wantedBy = [ "timers.target" ];
			partOf = [ "update-background.service" ];
			timerConfig.OnCalendar = "*-*-* 8:00:00";
			timerConfig.Persistent = true;
		};
	};
};

I am having trouble with getting runuser in this environment.
Systemd cannot find the command runuser on execution.

Maybe there is a more ideomatic way to do this.

try this

systemd.services.update-background =  {
  paths = [ pkgs.util-linux ];
  # ...
};

or

systemd.services.update-background =  {
  User = "<youruser>";
};

Thanks for your help, this works:

update-background = {
	path = [ pkgs.utillinux ];
	description = "Update background image service";
	serviceConfig.Type = "oneshot";
	script = "runuser -l me -c 'sh ~/bin/cycle.sh'";
};

systemd.timers.<name>.enable is true by default, is there some other option that i need to enable for the timer to work? Systemd gives me:

~(laptop ✗) sudo systemctl list-timers --all      
NEXT                         LEFT       LAST PASSED UNIT                          ACTIVATES                      
Wed 2021-04-14 20:15:51 CEST 12min left n/a  n/a    systemd-tmpfiles-clean.timer  systemd-tmpfiles-clean.service 
Thu 2021-04-15 03:15:00 CEST 7h left    n/a  n/a    nix-gc.timer                  nix-gc.service                 
n/a                          n/a        n/a  n/a    update-background-timer.timer update-background-timer.service