2016-02-14 15:43:44 +00:00
|
|
|
{ config, lib, pkgs, ... }:
|
2015-10-03 16:21:01 +00:00
|
|
|
|
2016-10-20 18:54:38 +00:00
|
|
|
with import <stockholm/lib>;
|
2015-10-03 16:21:01 +00:00
|
|
|
let
|
2015-10-05 12:49:36 +00:00
|
|
|
cfg = config.krebs.realwallpaper;
|
2015-10-03 16:21:01 +00:00
|
|
|
|
|
|
|
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;
|
2015-10-03 16:21:01 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
api = {
|
|
|
|
enable = mkEnableOption "realwallpaper";
|
|
|
|
|
|
|
|
workingDir = mkOption {
|
|
|
|
type = types.str;
|
|
|
|
default = "/var/realwallpaper/";
|
|
|
|
};
|
|
|
|
|
|
|
|
nightmap = mkOption {
|
|
|
|
type = types.str;
|
|
|
|
default = "http://eoimages.gsfc.nasa.gov/images/imagerecords/55000/55167/earth_lights_lrg.jpg";
|
|
|
|
};
|
|
|
|
|
|
|
|
daymap = mkOption {
|
|
|
|
type = types.str;
|
2016-12-26 12:16:40 +00:00
|
|
|
default = "https://www.nnvl.noaa.gov/images/globaldata/SnowIceCover_Daily.png";
|
2015-10-03 16:21:01 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
cloudmap = mkOption {
|
|
|
|
type = types.str;
|
2019-12-08 22:13:04 +00:00
|
|
|
default = "http://home.megapass.co.kr/~holywatr/cloud_data/clouds_2048.jpg";
|
2015-10-03 16:21:01 +00:00
|
|
|
};
|
|
|
|
|
2017-04-15 15:13:40 +00:00
|
|
|
marker = mkOption {
|
2015-10-03 16:21:01 +00:00
|
|
|
type = types.str;
|
2017-04-19 08:20:34 +00:00
|
|
|
default = "http://graph.r/marker.json";
|
2015-10-03 16:21:01 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
timerConfig = mkOption {
|
|
|
|
type = types.unspecified;
|
|
|
|
default = {
|
|
|
|
OnCalendar = "*:0/15";
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
imp = {
|
|
|
|
systemd.timers.realwallpaper = {
|
|
|
|
description = "real wallpaper generator timer";
|
2015-10-07 13:20:12 +00:00
|
|
|
wantedBy = [ "timers.target" ];
|
2015-10-03 16:21:01 +00:00
|
|
|
|
|
|
|
timerConfig = cfg.timerConfig;
|
|
|
|
};
|
|
|
|
|
|
|
|
systemd.services.realwallpaper = {
|
|
|
|
description = "real wallpaper generator";
|
|
|
|
after = [ "network.target" ];
|
|
|
|
|
|
|
|
path = with pkgs; [
|
|
|
|
xplanet
|
|
|
|
imagemagick
|
|
|
|
curl
|
|
|
|
file
|
2017-04-15 15:13:40 +00:00
|
|
|
jq
|
2015-10-03 16:21:01 +00:00
|
|
|
];
|
|
|
|
|
|
|
|
environment = {
|
|
|
|
working_dir = cfg.workingDir;
|
|
|
|
nightmap_url = cfg.nightmap;
|
|
|
|
daymap_url = cfg.daymap;
|
|
|
|
cloudmap_url = cfg.cloudmap;
|
2017-04-15 15:13:40 +00:00
|
|
|
marker_url = cfg.marker;
|
2015-10-03 16:21:01 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
restartIfChanged = true;
|
|
|
|
|
|
|
|
serviceConfig = {
|
|
|
|
Type = "simple";
|
2020-01-11 19:26:24 +00:00
|
|
|
ExecStart = "${pkgs.realwallpaper}/bin/generate-wallpaper";
|
2015-10-03 16:21:01 +00:00
|
|
|
User = "realwallpaper";
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
users.extraUsers.realwallpaper = {
|
2015-12-26 04:55:13 +00:00
|
|
|
uid = genid "realwallpaper";
|
2015-10-03 16:21:01 +00:00
|
|
|
home = cfg.workingDir;
|
|
|
|
createHome = true;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
in
|
|
|
|
out
|
|
|
|
|