summary refs log tree commit diff
diff options
context:
space:
mode:
authorBen Kelly <bk@ancilla.ca>2018-12-13 21:55:41 -0500
committerBen Kelly <btk@google.com>2019-02-04 20:17:26 -0500
commitc4437fee7e41d54d58ef680546cc8814b0da3575 (patch)
tree106578d1b68957ae639cb8762d77894ae3e1d93f
parent6c907851f4fbb1252b7d667b46389989e3207cac (diff)
downloadnixpkgs-c4437fee7e41d54d58ef680546cc8814b0da3575.tar
nixpkgs-c4437fee7e41d54d58ef680546cc8814b0da3575.tar.gz
nixpkgs-c4437fee7e41d54d58ef680546cc8814b0da3575.tar.bz2
nixpkgs-c4437fee7e41d54d58ef680546cc8814b0da3575.tar.lz
nixpkgs-c4437fee7e41d54d58ef680546cc8814b0da3575.tar.xz
nixpkgs-c4437fee7e41d54d58ef680546cc8814b0da3575.tar.zst
nixpkgs-c4437fee7e41d54d58ef680546cc8814b0da3575.zip
nixos/munin: add extraCSS option
This permits custom styling of the generated HTML without needing to
build your own Munin package from source. Also comes with an example
that works as a passable dark theme for Munin.
-rw-r--r--nixos/modules/services/monitoring/munin.nix28
1 files changed, 28 insertions, 0 deletions
diff --git a/nixos/modules/services/monitoring/munin.nix b/nixos/modules/services/monitoring/munin.nix
index af3562befde..c65432b4bbf 100644
--- a/nixos/modules/services/monitoring/munin.nix
+++ b/nixos/modules/services/monitoring/munin.nix
@@ -24,6 +24,8 @@ let
       logdir    /var/log/munin
       rundir    /run/munin
 
+      ${lib.optionalString (cronCfg.extraCSS != "") "staticdir ${customStaticDir}"}
+
       ${cronCfg.extraGlobalConfig}
 
       ${cronCfg.hosts}
@@ -114,6 +116,14 @@ let
       (map
         (path: { name = baseNameOf path; value = path; })
         nodeCfg.extraAutoPlugins));
+
+  customStaticDir = pkgs.runCommand "munin-custom-static-data" {} ''
+    cp -a "${pkgs.munin}/etc/opt/munin/static" "$out"
+    cd "$out"
+    chmod -R u+w .
+    echo "${cronCfg.extraCSS}" >> style.css
+    echo "${cronCfg.extraCSS}" >> style-new.css
+  '';
 in
 
 {
@@ -266,6 +276,24 @@ in
         '';
       };
 
+      extraCSS = mkOption {
+        default = "";
+        type = types.lines;
+        description = ''
+          Custom styling for the HTML that munin-cron generates. This will be
+          appended to the CSS files used by munin-cron and will thus take
+          precedence over the builtin styles.
+        '';
+        example = ''
+          /* A simple dark theme. */
+          html, body { background: #222222; }
+          #header, #footer { background: #333333; }
+          img.i, img.iwarn, img.icrit, img.iunkn {
+            filter: invert(100%) hue-rotate(-30deg);
+          }
+        '';
+      };
+
     };
 
   };