This repository has no description
1.6 kB
81 lines
1# Copied from stockholm krebs/3modules/realwallpaper.nix (cc283503);
2# realwallpaper itself is pkgs/realwallpaper.
3{
4 config,
5 lib,
6 pkgs,
7 self,
8 ...
9}:
10
11with lib;
12let
13 cfg = config.krebs.realwallpaper;
14
15 out = {
16 options.krebs.realwallpaper = api;
17 config = lib.mkIf cfg.enable imp;
18 };
19
20 api = {
21 enable = mkEnableOption "realwallpaper";
22
23 workingDir = mkOption {
24 type = types.str;
25 default = "/var/realwallpaper/";
26 };
27
28 marker = mkOption {
29 type = types.str;
30 default = "http://graph.r/network.json";
31 };
32
33 timerConfig = mkOption {
34 type = types.unspecified;
35 default = {
36 OnCalendar = "*:0/15";
37 };
38 };
39 };
40
41 imp = {
42 systemd.timers.realwallpaper = {
43 description = "real wallpaper generator timer";
44 wantedBy = [ "timers.target" ];
45
46 timerConfig = cfg.timerConfig;
47 };
48
49 systemd.services.realwallpaper = {
50 description = "real wallpaper generator";
51 after = [ "network.target" ];
52
53 environment = {
54 working_dir = cfg.workingDir;
55 marker_url = cfg.marker;
56 };
57
58 restartIfChanged = true;
59
60 serviceConfig = {
61 Type = "simple";
62 Restart = "on-failure";
63 ExecStart = "${
64 self.packages.${pkgs.stdenv.hostPlatform.system}.realwallpaper
65 }/bin/generate-wallpaper";
66 User = "realwallpaper";
67 };
68 };
69
70 users.extraUsers.realwallpaper = {
71 group = "realwallpaper";
72 home = cfg.workingDir;
73 createHome = true;
74 isSystemUser = true;
75 };
76
77 users.groups.realwallpaper = { };
78 };
79
80in
81out