1{
2 config,
3 lib,
4 pkgs,
5 ...
6}:
7
8let
9 cfg = config.services.prometheus.exporters.borgmatic;
10in
11{
12 port = 9996;
13 extraOpts.configFile = lib.mkOption {
14 type = lib.types.path;
15 default = "/etc/borgmatic/config.yaml";
16 description = ''
17 The path to the borgmatic config file
18 '';
19 };
20
21 serviceOpts = {
22 serviceConfig = {
23 DynamicUser = false;
24 ProtectSystem = false;
25 ProtectHome = lib.mkForce false;
26 ExecStart = ''
27 ${pkgs.prometheus-borgmatic-exporter}/bin/borgmatic-exporter run \
28 --port ${toString cfg.port} \
29 --config ${toString cfg.configFile} \
30 ${lib.concatMapStringsSep " " (f: lib.escapeShellArg f) cfg.extraFlags}
31 '';
32 };
33 };
34}