2015-10-03 16:21:01 +00:00
|
|
|
arg@{ config, lib, pkgs, ... }:
|
|
|
|
|
2015-12-26 04:55:13 +00:00
|
|
|
with 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;
|
2015-10-03 16:21:01 +00:00
|
|
|
config = mkIf cfg.enable imp;
|
|
|
|
};
|
|
|
|
|
|
|
|
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;
|
|
|
|
default = "http://www.nnvl.noaa.gov/images/globaldata/SnowIceCover_Daily.png";
|
|
|
|
};
|
|
|
|
|
|
|
|
cloudmap = mkOption {
|
|
|
|
type = types.str;
|
|
|
|
default = "http://xplanetclouds.com/free/local/clouds_2048.jpg";
|
|
|
|
};
|
|
|
|
|
|
|
|
outFile = mkOption {
|
|
|
|
type = types.str;
|
|
|
|
default = "/tmp/wallpaper.png";
|
|
|
|
};
|
|
|
|
|
|
|
|
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
|
|
|
|
];
|
|
|
|
|
|
|
|
environment = {
|
|
|
|
working_dir = cfg.workingDir;
|
|
|
|
nightmap_url = cfg.nightmap;
|
|
|
|
daymap_url = cfg.daymap;
|
|
|
|
cloudmap_url = cfg.cloudmap;
|
|
|
|
out_file = cfg.outFile;
|
|
|
|
};
|
|
|
|
|
|
|
|
restartIfChanged = true;
|
|
|
|
|
|
|
|
serviceConfig = {
|
|
|
|
Type = "simple";
|
2015-10-05 12:49:36 +00:00
|
|
|
ExecStart = "${pkgs.realwallpaper}/realwallpaper.sh";
|
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
|
|
|
|
|