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