1 { config, lib, pkgs, ... }:
6 cfg = config.services.grafana_reporter;
9 options.services.grafana_reporter = {
10 enable = mkEnableOption "grafana_reporter";
14 description = "Grafana protocol.";
16 type = types.enum ["http" "https"];
19 description = "Grafana address.";
20 default = "127.0.0.1";
24 description = "Grafana port.";
31 description = "Listening address.";
32 default = "127.0.0.1";
37 description = "Listening port.";
42 templateDir = mkOption {
43 description = "Optional template directory to use custom tex templates";
44 default = pkgs.grafana_reporter;
45 defaultText = literalExpression "pkgs.grafana_reporter";
46 type = types.either types.str types.path;
50 config = mkIf cfg.enable {
51 systemd.services.grafana_reporter = {
52 description = "Grafana Reporter Service Daemon";
53 wantedBy = ["multi-user.target"];
54 after = ["network.target"];
56 args = lib.concatStringsSep " " [
57 "-proto ${cfg.grafana.protocol}://"
58 "-ip ${cfg.grafana.addr}:${toString cfg.grafana.port}"
59 "-port :${toString cfg.port}"
60 "-templates ${cfg.templateDir}"
63 ExecStart = "${pkgs.grafana-reporter}/bin/grafana-reporter ${args}";