2016-02-14 16:43:44 +01:00
|
|
|
{ config, lib, pkgs, ... }:
|
2015-10-03 18:21:01 +02:00
|
|
|
|
2023-06-10 12:50:53 +02:00
|
|
|
with import ../../lib/pure.nix { inherit lib; };
|
2015-10-03 18:21:01 +02:00
|
|
|
let
|
2015-10-05 14:49:36 +02:00
|
|
|
cfg = config.krebs.realwallpaper;
|
2015-10-03 18:21:01 +02:00
|
|
|
|
|
|
|
out = {
|
2015-10-05 14:49:36 +02:00
|
|
|
options.krebs.realwallpaper = api;
|
2016-02-14 16:43:44 +01:00
|
|
|
config = lib.mkIf cfg.enable imp;
|
2015-10-03 18:21:01 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
api = {
|
|
|
|
enable = mkEnableOption "realwallpaper";
|
|
|
|
|
|
|
|
workingDir = mkOption {
|
|
|
|
type = types.str;
|
|
|
|
default = "/var/realwallpaper/";
|
|
|
|
};
|
|
|
|
|
2017-04-15 17:13:40 +02:00
|
|
|
marker = mkOption {
|
2015-10-03 18:21:01 +02:00
|
|
|
type = types.str;
|
2021-12-09 11:35:27 +01:00
|
|
|
default = "http://graph.r/network.json";
|
2015-10-03 18:21:01 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
timerConfig = mkOption {
|
|
|
|
type = types.unspecified;
|
|
|
|
default = {
|
|
|
|
OnCalendar = "*:0/15";
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
imp = {
|
|
|
|
systemd.timers.realwallpaper = {
|
|
|
|
description = "real wallpaper generator timer";
|
2015-10-07 15:20:12 +02:00
|
|
|
wantedBy = [ "timers.target" ];
|
2015-10-03 18:21:01 +02:00
|
|
|
|
|
|
|
timerConfig = cfg.timerConfig;
|
|
|
|
};
|
|
|
|
|
|
|
|
systemd.services.realwallpaper = {
|
|
|
|
description = "real wallpaper generator";
|
|
|
|
after = [ "network.target" ];
|
|
|
|
|
|
|
|
environment = {
|
|
|
|
working_dir = cfg.workingDir;
|
2017-04-15 17:13:40 +02:00
|
|
|
marker_url = cfg.marker;
|
2015-10-03 18:21:01 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
restartIfChanged = true;
|
|
|
|
|
|
|
|
serviceConfig = {
|
|
|
|
Type = "simple";
|
2021-09-06 18:51:51 +02:00
|
|
|
Restart = "on-failure";
|
2020-01-11 20:26:24 +01:00
|
|
|
ExecStart = "${pkgs.realwallpaper}/bin/generate-wallpaper";
|
2015-10-03 18:21:01 +02:00
|
|
|
User = "realwallpaper";
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
users.extraUsers.realwallpaper = {
|
2015-12-26 05:55:13 +01:00
|
|
|
uid = genid "realwallpaper";
|
2021-12-01 18:27:04 +01:00
|
|
|
group = "realwallpaper";
|
2015-10-03 18:21:01 +02:00
|
|
|
home = cfg.workingDir;
|
|
|
|
createHome = true;
|
2021-06-05 14:56:41 +02:00
|
|
|
isSystemUser = true;
|
2015-10-03 18:21:01 +02:00
|
|
|
};
|
2021-12-01 18:27:04 +01:00
|
|
|
|
|
|
|
users.groups.realwallpaper = {};
|
2015-10-03 18:21:01 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
in
|
|
|
|
out
|
|
|
|
|