stockholm/krebs/3modules/realwallpaper.nix

70 lines
1.3 KiB
Nix
Raw Normal View History

2016-02-14 15:43:44 +00:00
{ config, lib, pkgs, ... }:
2016-10-20 18:54:38 +00:00
with import <stockholm/lib>;
let
2015-10-05 12:49:36 +00:00
cfg = config.krebs.realwallpaper;
out = {
2015-10-05 12:49:36 +00:00
options.krebs.realwallpaper = api;
2016-02-14 15:43:44 +00:00
config = lib.mkIf cfg.enable imp;
};
api = {
enable = mkEnableOption "realwallpaper";
workingDir = mkOption {
type = types.str;
default = "/var/realwallpaper/";
};
2017-04-15 15:13:40 +00:00
marker = mkOption {
type = types.str;
2017-04-19 08:20:34 +00:00
default = "http://graph.r/marker.json";
};
timerConfig = mkOption {
type = types.unspecified;
default = {
OnCalendar = "*:0/15";
};
};
};
imp = {
systemd.timers.realwallpaper = {
description = "real wallpaper generator timer";
wantedBy = [ "timers.target" ];
timerConfig = cfg.timerConfig;
};
systemd.services.realwallpaper = {
description = "real wallpaper generator";
after = [ "network.target" ];
environment = {
working_dir = cfg.workingDir;
2017-04-15 15:13:40 +00:00
marker_url = cfg.marker;
};
restartIfChanged = true;
serviceConfig = {
Type = "simple";
2020-01-11 19:26:24 +00:00
ExecStart = "${pkgs.realwallpaper}/bin/generate-wallpaper";
User = "realwallpaper";
};
};
users.extraUsers.realwallpaper = {
2015-12-26 04:55:13 +00:00
uid = genid "realwallpaper";
home = cfg.workingDir;
createHome = true;
2021-06-05 12:56:41 +00:00
isSystemUser = true;
};
};
in
out