summaryrefslogtreecommitdiffstats
path: root/lass/3modules
diff options
context:
space:
mode:
authorlassulus <lass@aidsballs.de>2015-10-03 18:21:01 +0200
committerlassulus <lass@aidsballs.de>2015-10-04 13:42:29 +0200
commit0a7d4c3469a0411790e6edb5bfe7d0bef3bf2dd6 (patch)
tree9c678d89e556499084b13fdc93c663cba7da099c /lass/3modules
parent041ef784486b554374fd5ad9e172889ad7e631d2 (diff)
lass 3: add wallpaper.nix
lass 2 configs: add wallpaper.nix lass 2: add wallpaper-server.nix lass: refactor realwallpaper
Diffstat (limited to 'lass/3modules')
-rw-r--r--lass/3modules/default.nix1
-rw-r--r--lass/3modules/realwallpaper.nix102
2 files changed, 103 insertions, 0 deletions
diff --git a/lass/3modules/default.nix b/lass/3modules/default.nix
index 9de987bf3..9b6211278 100644
--- a/lass/3modules/default.nix
+++ b/lass/3modules/default.nix
@@ -3,5 +3,6 @@ _:
{
imports = [
./xresources.nix
+ ./realwallpaper.nix
];
}
diff --git a/lass/3modules/realwallpaper.nix b/lass/3modules/realwallpaper.nix
new file mode 100644
index 000000000..85dd35233
--- /dev/null
+++ b/lass/3modules/realwallpaper.nix
@@ -0,0 +1,102 @@
+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
+