aboutsummaryrefslogtreecommitdiff
path: root/nixos/profiles/server/prometheus-storagebox-exporter.nix
diff options
context:
space:
mode:
authorMartin Fischer <martin@push-f.com>2026-10-17 11:14:02 +0200
committerMartin Fischer <martin@push-f.com>2026-10-18 07:25:43 +0200
commit9237328fb09b2c18365bb5fcef1c4596d77973a9 (patch)
tree55bbfd35140871166a52bbf01bb658c03ca127d6 /nixos/profiles/server/prometheus-storagebox-exporter.nix
parentf29ddff912ddcd58a4726736702b24655505ce09 (diff)
refactor: make server packages buildable via packages.*
Diffstat (limited to 'nixos/profiles/server/prometheus-storagebox-exporter.nix')
-rw-r--r--nixos/profiles/server/prometheus-storagebox-exporter.nix33
1 files changed, 33 insertions, 0 deletions
diff --git a/nixos/profiles/server/prometheus-storagebox-exporter.nix b/nixos/profiles/server/prometheus-storagebox-exporter.nix
new file mode 100644
index 0000000..16b03e6
--- /dev/null
+++ b/nixos/profiles/server/prometheus-storagebox-exporter.nix
@@ -0,0 +1,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"];
+ };
+ };
+}