nixos/riemann: refactor config

Previously it was only possible to use very simple Riemann config.
For more complicated scenarios you need a directory of clojure
files and the config file that riemann starts with should be in this
directory.

Changed files
+18 -4
nixos
modules
services
monitoring
+18 -4
nixos/modules/services/monitoring/riemann.nix
···
launcher = writeScriptBin "riemann" ''
#!/bin/sh
-
exec ${jdk}/bin/java ${concatStringsSep "\n" cfg.extraJavaOpts} \
+
exec ${jdk}/bin/java ${concatStringsSep " " cfg.extraJavaOpts} \
-cp ${classpath} \
-
riemann.bin ${writeText "riemann-config.clj" riemannConfig}
+
riemann.bin ${cfg.configFile}
'';
in {
···
config = mkOption {
type = types.lines;
description = ''
-
Contents of the Riemann configuration file.
+
Contents of the Riemann configuration file. For more complicated
+
config you should use configFile.
'';
};
configFiles = mkOption {
···
Extra files containing Riemann configuration. These files will be
loaded at runtime by Riemann (with Clojure's
<literal>load-file</literal> function) at the end of the
-
configuration.
+
configuration if you use the config option, this is ignored if you
+
use configFile.
+
'';
+
};
+
configFile = mkOption {
+
type = types.str;
+
description = ''
+
A Riemann config file. Any files in the same directory as this file
+
will be added to the classpath by Riemann.
'';
};
extraClasspathEntries = mkOption {
···
group = "riemann";
};
+
services.riemann.configFile = mkDefault (
+
writeText "riemann-config.clj" riemannConfig
+
);
+
systemd.services.riemann = {
wantedBy = [ "multi-user.target" ];
path = [ inetutils ];
···
User = "riemann";
ExecStart = "${launcher}/bin/riemann";
};
+
serviceConfig.LimitNOFILE = 65536;
};
};