2023-09-22 10:14:12 +02:00
|
|
|
{ lib, config, ... }:
|
|
|
|
with lib;
|
|
|
|
let
|
|
|
|
cfg = config.my.services.wallpaper;
|
|
|
|
in
|
|
|
|
{
|
|
|
|
options.my.services.wallpaper = {
|
|
|
|
enable = mkEnableOption "wallpaper changer";
|
|
|
|
frequency = mkOption {
|
|
|
|
type = types.str;
|
|
|
|
default = "30m";
|
|
|
|
};
|
2023-10-25 17:19:26 +02:00
|
|
|
target = mkOption {
|
|
|
|
type = types.str;
|
|
|
|
default = "graphical-session.target";
|
|
|
|
};
|
2023-09-22 10:14:12 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
config = mkIf cfg.enable {
|
|
|
|
systemd.user.services.wallpaper = {
|
|
|
|
script = "${getExe config.my.programs.wallpaper.package} -r -v";
|
2023-10-25 17:19:26 +02:00
|
|
|
wantedBy = [ cfg.target ];
|
|
|
|
after = [ cfg.target ];
|
2023-09-22 10:14:12 +02:00
|
|
|
serviceConfig = {
|
|
|
|
Restart = "always";
|
|
|
|
RuntimeMaxSec = cfg.frequency;
|
|
|
|
ExitType = "cgroup";
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
}
|