summaryrefslogtreecommitdiffstats
path: root/krebs/3modules/fetchWallpaper.nix
diff options
context:
space:
mode:
authortv <tv@krebsco.de>2017-03-05 00:28:32 +0100
committertv <tv@krebsco.de>2017-03-05 00:28:32 +0100
commit4499cc406560963d65b016075ba2df6451c834cd (patch)
treeffea19187190a105e7b0caf617a0215c02c281da /krebs/3modules/fetchWallpaper.nix
parentd7761aed6559adba3cfa61d822165c42c90fc276 (diff)
parent39fd77b84c7c14d6460722721726b378bdab7acd (diff)
Merge remote-tracking branch 'prism/master'
Diffstat (limited to 'krebs/3modules/fetchWallpaper.nix')
-rw-r--r--krebs/3modules/fetchWallpaper.nix28
1 files changed, 10 insertions, 18 deletions
diff --git a/krebs/3modules/fetchWallpaper.nix b/krebs/3modules/fetchWallpaper.nix
index 29c4f50e9..e226a9060 100644
--- a/krebs/3modules/fetchWallpaper.nix
+++ b/krebs/3modules/fetchWallpaper.nix
@@ -21,13 +21,14 @@ let
OnCalendar = "*:00,10,20,30,40,50";
};
};
+ # TODO find a better default stateDir
stateDir = mkOption {
type = types.str;
- default = "/var/lib/wallpaper";
+ default = "$HOME/wallpaper";
};
display = mkOption {
type = types.str;
- default = ":11";
+ default = ":0";
};
unitConfig = mkOption {
type = types.attrsOf types.str;
@@ -48,38 +49,30 @@ let
fetchWallpaperScript = pkgs.writeDash "fetchWallpaper" ''
set -euf
- mkdir -p ${shell.escape cfg.stateDir}
- cd ${shell.escape cfg.stateDir}
+ 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 ${shell.escape cfg.stateDir}/wallpaper
+ feh --no-fehbg --bg-scale wallpaper
'';
imp = {
- users.users.fetchWallpaper = {
- name = "fetchWallpaper";
- uid = genid "fetchWallpaper";
- description = "fetchWallpaper user";
- home = cfg.stateDir;
- createHome = true;
- };
-
- systemd.timers.fetchWallpaper = {
+ systemd.user.timers.fetchWallpaper = {
description = "fetch wallpaper timer";
wantedBy = [ "timers.target" ];
timerConfig = cfg.timerConfig;
};
- systemd.services.fetchWallpaper = {
+ systemd.user.services.fetchWallpaper = {
description = "fetch wallpaper";
- after = [ "network.target" ];
+ wantedBy = [ "default.target" ];
path = with pkgs; [
curl
feh
+ coreutils
];
environment = {
- URL = cfg.url;
DISPLAY = cfg.display;
};
restartIfChanged = true;
@@ -87,7 +80,6 @@ let
serviceConfig = {
Type = "simple";
ExecStart = fetchWallpaperScript;
- User = "fetchWallpaper";
};
unitConfig = cfg.unitConfig;