diff --git a/nixos/modules/services/monitoring/riemann.nix b/nixos/modules/services/monitoring/riemann.nix index a1935c29a04..ab37d717b86 100644 --- a/nixos/modules/services/monitoring/riemann.nix +++ b/nixos/modules/services/monitoring/riemann.nix @@ -11,11 +11,15 @@ let cfg.extraClasspathEntries ++ [ "${riemann}/share/java/riemann.jar" ] ); + riemannConfig = concatStringsSep "\n" ( + [cfg.config] ++ (map (f: ''(load-file "${f}")'') cfg.configFiles) + ); + launcher = writeScriptBin "riemann" '' #!/bin/sh exec ${openjdk}/bin/java ${concatStringsSep "\n" cfg.extraJavaOpts} \ -cp ${classpath} \ - riemann.bin ${writeText "riemann.config" cfg.config} + riemann.bin ${writeText "riemann-config.clj" riemannConfig} ''; in { @@ -36,6 +40,16 @@ in { Contents of the Riemann configuration file. ''; }; + configFiles = mkOption { + type = with types; listOf path; + default = []; + description = '' + Extra files containing Riemann configuration. These files will be + loaded at runtime by Riemann (with Clojure's + load-file function) at the end of the + configuration. + ''; + }; extraClasspathEntries = mkOption { type = with types; listOf str; default = [];