From cf28831057d95a73bbc2326f43b9d29a79fca12b Mon Sep 17 00:00:00 2001 From: lassulus Date: Mon, 5 Oct 2015 14:49:36 +0200 Subject: move realwallpaper to krebs 3 --- krebs/3modules/default.nix | 1 + krebs/3modules/realwallpaper.nix | 100 ++++++++++++++++++++++++++++++++++++++ lass/3modules/default.nix | 1 - lass/3modules/realwallpaper.nix | 102 --------------------------------------- 4 files changed, 101 insertions(+), 103 deletions(-) create mode 100644 krebs/3modules/realwallpaper.nix delete mode 100644 lass/3modules/realwallpaper.nix diff --git a/krebs/3modules/default.nix b/krebs/3modules/default.nix index 430194405..edfbde9ba 100644 --- a/krebs/3modules/default.nix +++ b/krebs/3modules/default.nix @@ -14,6 +14,7 @@ let ./iptables.nix ./nginx.nix ./Reaktor.nix + ./realwallpaper.nix ./retiolum.nix ./urlwatch.nix ]; 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 + diff --git a/lass/3modules/default.nix b/lass/3modules/default.nix index 9b6211278..9de987bf3 100644 --- a/lass/3modules/default.nix +++ b/lass/3modules/default.nix @@ -3,6 +3,5 @@ _: { imports = [ ./xresources.nix - ./realwallpaper.nix ]; } diff --git a/lass/3modules/realwallpaper.nix b/lass/3modules/realwallpaper.nix deleted file mode 100644 index 85dd35233..000000000 --- a/lass/3modules/realwallpaper.nix +++ /dev/null @@ -1,102 +0,0 @@ -arg@{ config, lib, pkgs, ... }: - -let - inherit (lib) - mkEnableOption - mkOption - types - mkIf - ; - - lpkgs = import ../5pkgs { inherit pkgs; }; - - cfg = config.lass.realwallpaper; - - out = { - options.lass.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 = "${lpkgs.realwallpaper}/realwallpaper.sh"; - User = "realwallpaper"; - }; - }; - - users.extraUsers.realwallpaper = { - uid = 2009435407; #genid realwallpaper - home = cfg.workingDir; - createHome = true; - }; - }; - -in -out - -- cgit v1.2.3