summaryrefslogtreecommitdiffstats
path: root/krebs/3modules/fetchWallpaper.nix
diff options
context:
space:
mode:
authormakefu <github@syntax-fehler.de>2017-03-16 23:28:32 +0100
committermakefu <github@syntax-fehler.de>2017-03-16 23:28:32 +0100
commit4b29caff2681d21ce4be687321fa4ab2f7713cd4 (patch)
treec0f59f1eafd87863173a957da3d5b79d69102b83 /krebs/3modules/fetchWallpaper.nix
parent6ec1a6296930569c97cf029bad17c998d4fae66d (diff)
parent8809797f1063945c03ebd70666c108c45d5d724a (diff)
Merge remote-tracking branch 'lass/master'
Diffstat (limited to 'krebs/3modules/fetchWallpaper.nix')
-rw-r--r--krebs/3modules/fetchWallpaper.nix22
1 files changed, 15 insertions, 7 deletions
diff --git a/krebs/3modules/fetchWallpaper.nix b/krebs/3modules/fetchWallpaper.nix
index e226a9060..e00c0ec9b 100644
--- a/krebs/3modules/fetchWallpaper.nix
+++ b/krebs/3modules/fetchWallpaper.nix
@@ -21,10 +21,9 @@ let
OnCalendar = "*:00,10,20,30,40,50";
};
};
- # TODO find a better default stateDir
stateDir = mkOption {
type = types.str;
- default = "$HOME/wallpaper";
+ default = "/var/lib/wallpaper";
};
display = mkOption {
type = types.str;
@@ -52,27 +51,35 @@ let
mkdir -p ${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) || :
- feh --no-fehbg --bg-scale wallpaper
+ feh --no-fehbg --bg-scale ${shell.escape cfg.stateDir}/wallpaper
'';
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";
wantedBy = [ "timers.target" ];
timerConfig = cfg.timerConfig;
};
- systemd.user.services.fetchWallpaper = {
+ systemd.services.fetchWallpaper = {
description = "fetch wallpaper";
- wantedBy = [ "default.target" ];
+ after = [ "network.target" ];
path = with pkgs; [
curl
feh
- coreutils
];
environment = {
+ URL = cfg.url;
DISPLAY = cfg.display;
};
restartIfChanged = true;
@@ -80,6 +87,7 @@ let
serviceConfig = {
Type = "simple";
ExecStart = fetchWallpaperScript;
+ User = "fetchWallpaper";
};
unitConfig = cfg.unitConfig;