diff options
author | makefu <github@syntax-fehler.de> | 2015-10-07 15:18:50 +0200 |
---|---|---|
committer | makefu <github@syntax-fehler.de> | 2015-10-07 15:18:50 +0200 |
commit | eef7ff0ca525d71c9477e8b2d4a72f61f848abb3 (patch) | |
tree | fb6a084a5984d628b5fe6ccb442540dfc873aebb /krebs/3modules/realwallpaper.nix | |
parent | 973e7adab745c7493c592e6bc0e3f8367b32dfbc (diff) | |
parent | eabf194460f695044d32713900419583986a9bd5 (diff) |
Merge remote-tracking branch 'cloudkrebs/master'
Diffstat (limited to 'krebs/3modules/realwallpaper.nix')
-rw-r--r-- | krebs/3modules/realwallpaper.nix | 100 |
1 files changed, 100 insertions, 0 deletions
diff --git a/krebs/3modules/realwallpaper.nix b/krebs/3modules/realwallpaper.nix new file mode 100644 index 000000000..d5c1aeabd --- /dev/null +++ b/krebs/3modules/realwallpaper.nix @@ -0,0 +1,100 @@ +arg@{ config, lib, pkgs, ... }: + +let + inherit (lib) + mkEnableOption + mkOption + types + mkIf + ; + + cfg = config.krebs.realwallpaper; + + out = { + options.krebs.realwallpaper = api; + 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"; + + timerConfig = cfg.timerConfig; + }; + + systemd.services.realwallpaper = { + description = "real wallpaper generator"; + wantedBy = [ "multi-user.target" ]; + 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"; + ExecStart = "${pkgs.realwallpaper}/realwallpaper.sh"; + User = "realwallpaper"; + }; + }; + + users.extraUsers.realwallpaper = { + uid = 2009435407; #genid realwallpaper + home = cfg.workingDir; + createHome = true; + }; + }; + +in +out + |