blob: 16b03e6f87657acf5c96f8a358a5f38e3b64d101 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
|
# TODO: submit Christian's storagebox exporter to nixpkgs
{ config, lib, pkgs, sources, ... }:
let
storageboxExporter = pkgs.callPackage ./pkgs/prometheus-storagebox-exporter.nix { inherit sources; };
cfg = config.services.prometheus-storagebox-exporter;
in
{
options.services.prometheus-storagebox-exporter = {
enable = lib.mkEnableOption "storagebox-exporter";
port = lib.mkOption {
type = lib.types.int;
};
hetznerTokenFile = lib.mkOption {
type = lib.types.path;
};
};
config = lib.mkIf cfg.enable {
systemd.services.storagebox-exporter = {
serviceConfig = {
ExecStart = "${storageboxExporter}/bin/prometheus-storagebox-exporter";
DynamicUser = "true";
LoadCredential = "hetznerToken:${cfg.hetznerTokenFile}";
};
environment = {
HETZNER_TOKEN_FILE = "%d/hetznerToken";
LISTEN_ADDRESS = ":${toString cfg.port}";
};
wantedBy = ["multi-user.target"];
};
};
}
|