k 3 fetchWallpaper: don't use user services
This commit is contained in:
parent
6af17a9ef6
commit
3be5ccd67f
|
@ -21,10 +21,9 @@ let
|
||||||
OnCalendar = "*:00,10,20,30,40,50";
|
OnCalendar = "*:00,10,20,30,40,50";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
# TODO find a better default stateDir
|
|
||||||
stateDir = mkOption {
|
stateDir = mkOption {
|
||||||
type = types.str;
|
type = types.str;
|
||||||
default = "$HOME/wallpaper";
|
default = "/var/lib/wallpaper";
|
||||||
};
|
};
|
||||||
display = mkOption {
|
display = mkOption {
|
||||||
type = types.str;
|
type = types.str;
|
||||||
|
@ -52,27 +51,35 @@ let
|
||||||
mkdir -p ${cfg.stateDir}
|
mkdir -p ${cfg.stateDir}
|
||||||
cd ${cfg.stateDir}
|
cd ${cfg.stateDir}
|
||||||
(curl --max-time ${toString cfg.maxTime} -s -o wallpaper.tmp -z wallpaper ${shell.escape cfg.url} && mv wallpaper.tmp wallpaper) || :
|
(curl --max-time ${toString cfg.maxTime} -s -o wallpaper.tmp -z wallpaper ${shell.escape cfg.url} && mv wallpaper.tmp wallpaper) || :
|
||||||
feh --no-fehbg --bg-scale wallpaper
|
feh --no-fehbg --bg-scale ${shell.escape cfg.stateDir}/wallpaper
|
||||||
'';
|
'';
|
||||||
|
|
||||||
imp = {
|
imp = {
|
||||||
systemd.user.timers.fetchWallpaper = {
|
users.users.fetchWallpaper = {
|
||||||
|
name = "fetchWallpaper";
|
||||||
|
uid = genid "fetchWallpaper";
|
||||||
|
description = "fetchWallpaper user";
|
||||||
|
home = cfg.stateDir;
|
||||||
|
createHome = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
systemd.timers.fetchWallpaper = {
|
||||||
description = "fetch wallpaper timer";
|
description = "fetch wallpaper timer";
|
||||||
wantedBy = [ "timers.target" ];
|
wantedBy = [ "timers.target" ];
|
||||||
|
|
||||||
timerConfig = cfg.timerConfig;
|
timerConfig = cfg.timerConfig;
|
||||||
};
|
};
|
||||||
systemd.user.services.fetchWallpaper = {
|
systemd.services.fetchWallpaper = {
|
||||||
description = "fetch wallpaper";
|
description = "fetch wallpaper";
|
||||||
wantedBy = [ "default.target" ];
|
after = [ "network.target" ];
|
||||||
|
|
||||||
path = with pkgs; [
|
path = with pkgs; [
|
||||||
curl
|
curl
|
||||||
feh
|
feh
|
||||||
coreutils
|
|
||||||
];
|
];
|
||||||
|
|
||||||
environment = {
|
environment = {
|
||||||
|
URL = cfg.url;
|
||||||
DISPLAY = cfg.display;
|
DISPLAY = cfg.display;
|
||||||
};
|
};
|
||||||
restartIfChanged = true;
|
restartIfChanged = true;
|
||||||
|
@ -80,6 +87,7 @@ let
|
||||||
serviceConfig = {
|
serviceConfig = {
|
||||||
Type = "simple";
|
Type = "simple";
|
||||||
ExecStart = fetchWallpaperScript;
|
ExecStart = fetchWallpaperScript;
|
||||||
|
User = "fetchWallpaper";
|
||||||
};
|
};
|
||||||
|
|
||||||
unitConfig = cfg.unitConfig;
|
unitConfig = cfg.unitConfig;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user