1 { config, pkgs, lib, ... }:
8 cfg = config.services.riemann;
10 classpath = concatStringsSep ":" (
11 cfg.extraClasspathEntries ++ [ "${riemann}/share/java/riemann.jar" ]
14 riemannConfig = concatStringsSep "\n" (
15 [cfg.config] ++ (map (f: ''(load-file "${f}")'') cfg.configFiles)
18 launcher = writeScriptBin "riemann" ''
20 exec ${jdk}/bin/java ${concatStringsSep " " cfg.extraJavaOpts} \
22 riemann.bin ${cfg.configFile}
30 enable = mkEnableOption "Riemann network monitoring daemon";
35 Contents of the Riemann configuration file. For more complicated
36 config you should use configFile.
39 configFiles = mkOption {
40 type = with types; listOf path;
43 Extra files containing Riemann configuration. These files will be
44 loaded at runtime by Riemann (with Clojure's
45 `load-file` function) at the end of the
46 configuration if you use the config option, this is ignored if you
50 configFile = mkOption {
53 A Riemann config file. Any files in the same directory as this file
54 will be added to the classpath by Riemann.
57 extraClasspathEntries = mkOption {
58 type = with types; listOf str;
61 Extra entries added to the Java classpath when running Riemann.
64 extraJavaOpts = mkOption {
65 type = with types; listOf str;
68 Extra Java options used when launching Riemann.
74 config = mkIf cfg.enable {
76 users.groups.riemann.gid = config.ids.gids.riemann;
78 users.users.riemann = {
79 description = "riemann daemon user";
80 uid = config.ids.uids.riemann;
84 services.riemann.configFile = mkDefault (
85 writeText "riemann-config.clj" riemannConfig
88 systemd.services.riemann = {
89 wantedBy = [ "multi-user.target" ];
93 ExecStart = "${launcher}/bin/riemann";
95 serviceConfig.LimitNOFILE = 65536;