···
19
19
self.inputs.stockholm.nixosModules.exim
20
20
self.inputs.stockholm.nixosModules.exim-retiolum
21
21
self.inputs.stockholm.nixosModules.tinc
22
22
-
self.inputs.stockholm.nixosModules.fetchWallpaper
23
22
self.inputs.stockholm.nixosModules.iptables
24
23
self.inputs.stockholm.nixosModules.power-action
25
24
self.inputs.stockholm.nixosModules.setuid
···
1
1
-
{ config, pkgs, ... }:
2
2
-
3
3
-
let
4
4
-
5
5
-
in {
6
6
-
krebs.fetchWallpaper = {
1
1
+
{
2
2
+
lass.fetchWallpaper = {
7
3
enable = true;
8
4
url = "http://wallpaper.r/realwallpaper-krebs-stars-berlin.png";
9
5
};
···
9
9
./nichtparasoup.nix
10
10
./screenlock.nix
11
11
./usershadow.nix
12
12
+
./fetchWallpaper.nix
12
13
];
13
14
}
···
1
1
+
{ config, lib, pkgs, ... }:
2
2
+
3
3
+
let
4
4
+
cfg = config.lass.fetchWallpaper;
5
5
+
6
6
+
fetchWallpaperScript = pkgs.writers.writeDash "fetchWallpaper" ''
7
7
+
set -euf
8
8
+
9
9
+
mkdir -p ${cfg.stateDir}
10
10
+
chmod o+rx ${cfg.stateDir}
11
11
+
cd ${cfg.stateDir}
12
12
+
(curl -s -o wallpaper.tmp -z wallpaper.tmp ${lib.escapeShellArg cfg.url} && cp wallpaper.tmp wallpaper) || :
13
13
+
feh --no-fehbg --bg-scale wallpaper
14
14
+
'';
15
15
+
16
16
+
in {
17
17
+
options.lass.fetchWallpaper = {
18
18
+
enable = lib.mkEnableOption "fetch wallpaper";
19
19
+
url = lib.mkOption {
20
20
+
type = lib.types.str;
21
21
+
};
22
22
+
timerConfig = lib.mkOption {
23
23
+
type = lib.types.unspecified;
24
24
+
default = {
25
25
+
OnCalendar = "*:00,10,20,30,40,50";
26
26
+
};
27
27
+
};
28
28
+
stateDir = lib.mkOption {
29
29
+
type = lib.types.str;
30
30
+
default = "/var/lib/wallpaper";
31
31
+
};
32
32
+
display = lib.mkOption {
33
33
+
type = lib.types.str;
34
34
+
default = ":${toString config.services.xserver.display}";
35
35
+
};
36
36
+
unitConfig = lib.mkOption {
37
37
+
type = lib.types.attrsOf lib.types.str;
38
38
+
description = "Extra unit configuration for fetchWallpaper to define conditions and assertions for the unit";
39
39
+
example = lib.literalExample ''
40
40
+
# do not start when running on umts
41
41
+
{ ConditionPathExists = "!/var/run/ppp0.pid"; }
42
42
+
'';
43
43
+
default = {};
44
44
+
};
45
45
+
};
46
46
+
47
47
+
config = {
48
48
+
systemd.timers.fetchWallpaper = {
49
49
+
description = "fetch wallpaper timer";
50
50
+
wantedBy = [ "timers.target" ];
51
51
+
52
52
+
timerConfig = cfg.timerConfig;
53
53
+
};
54
54
+
systemd.services.fetchWallpaper = {
55
55
+
description = "fetch wallpaper";
56
56
+
after = [ "network.target" ];
57
57
+
58
58
+
path = with pkgs; [
59
59
+
curl
60
60
+
feh
61
61
+
];
62
62
+
63
63
+
environment = {
64
64
+
URL = cfg.url;
65
65
+
DISPLAY = cfg.display;
66
66
+
};
67
67
+
restartIfChanged = true;
68
68
+
69
69
+
serviceConfig = {
70
70
+
Type = "simple";
71
71
+
ExecStart = fetchWallpaperScript;
72
72
+
User = "fetchWallpaper";
73
73
+
StateDirectory = true;
74
74
+
StateDirectoryMode = "0755";
75
75
+
};
76
76
+
77
77
+
unitConfig = cfg.unitConfig;
78
78
+
};
79
79
+
};
80
80
+
}