nixos/riemann: Add option configFiles

This commit is contained in:
Rickard Nilsson 2014-11-19 12:55:42 +01:00
parent aa9c9aecbe
commit 76f065a8de
1 changed files with 15 additions and 1 deletions

View File

@ -11,11 +11,15 @@ let
cfg.extraClasspathEntries ++ [ "${riemann}/share/java/riemann.jar" ] cfg.extraClasspathEntries ++ [ "${riemann}/share/java/riemann.jar" ]
); );
riemannConfig = concatStringsSep "\n" (
[cfg.config] ++ (map (f: ''(load-file "${f}")'') cfg.configFiles)
);
launcher = writeScriptBin "riemann" '' launcher = writeScriptBin "riemann" ''
#!/bin/sh #!/bin/sh
exec ${openjdk}/bin/java ${concatStringsSep "\n" cfg.extraJavaOpts} \ exec ${openjdk}/bin/java ${concatStringsSep "\n" cfg.extraJavaOpts} \
-cp ${classpath} \ -cp ${classpath} \
riemann.bin ${writeText "riemann.config" cfg.config} riemann.bin ${writeText "riemann-config.clj" riemannConfig}
''; '';
in { in {
@ -36,6 +40,16 @@ in {
Contents of the Riemann configuration file. 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
<literal>load-file</literal> function) at the end of the
configuration.
'';
};
extraClasspathEntries = mkOption { extraClasspathEntries = mkOption {
type = with types; listOf str; type = with types; listOf str;
default = []; default = [];