about summary refs log tree commit diff
path: root/pkgs/by-name/pr
diff options
context:
space:
mode:
authorh7x4 <h7x4@nani.wtf>2024-02-01 20:05:11 +0100
committerGitHub <noreply@github.com>2024-02-01 20:05:11 +0100
commit932344b54a276a1a74cad3bf1a3f4715ad85ef64 (patch)
tree7757081c5cd4245e9ac9266060600fe83ca725a3 /pkgs/by-name/pr
parentd070e3c00b929974dae80bc65936d690f5f14fe5 (diff)
parentda91e4d75b1c35e3a712887b20d4c9984649ff88 (diff)
downloadnixlib-932344b54a276a1a74cad3bf1a3f4715ad85ef64.tar
nixlib-932344b54a276a1a74cad3bf1a3f4715ad85ef64.tar.gz
nixlib-932344b54a276a1a74cad3bf1a3f4715ad85ef64.tar.bz2
nixlib-932344b54a276a1a74cad3bf1a3f4715ad85ef64.tar.lz
nixlib-932344b54a276a1a74cad3bf1a3f4715ad85ef64.tar.xz
nixlib-932344b54a276a1a74cad3bf1a3f4715ad85ef64.tar.zst
nixlib-932344b54a276a1a74cad3bf1a3f4715ad85ef64.zip
Merge pull request #270475 from MinerSebas/prometheus-restic-exporter
prometheus-restic-exporter: init at 1.4.0
Diffstat (limited to 'pkgs/by-name/pr')
-rw-r--r--pkgs/by-name/pr/prometheus-restic-exporter/package.nix49
1 files changed, 49 insertions, 0 deletions
diff --git a/pkgs/by-name/pr/prometheus-restic-exporter/package.nix b/pkgs/by-name/pr/prometheus-restic-exporter/package.nix
new file mode 100644
index 000000000000..4e3736a573b6
--- /dev/null
+++ b/pkgs/by-name/pr/prometheus-restic-exporter/package.nix
@@ -0,0 +1,49 @@
+{ lib
+, stdenvNoCC
+, fetchFromGitHub
+, python3
+, restic
+, nixosTests
+}:
+
+stdenvNoCC.mkDerivation rec {
+  pname = "prometheus-restic-exporter";
+  version = "1.4.0";
+
+  src = fetchFromGitHub {
+    owner = "ngosang";
+    repo = "restic-exporter";
+    rev = version;
+    hash = "sha256-Qwhlecginl5+V+iddN/vIHfJA1kQOZtscECsoD4LJPE=";
+  };
+
+  buildInputs = [
+    (python3.withPackages (ps: [ ps.prometheus-client ]))
+  ];
+
+  installPhase = ''
+    runHook preInstall
+
+    install -D -m0755 restic-exporter.py $out/bin/restic-exporter.py
+
+    substituteInPlace $out/bin/restic-exporter.py --replace \"restic\" \"${lib.makeBinPath [ restic ]}/restic\"
+
+    patchShebangs $out/bin/restic-exporter.py
+
+    runHook postInstall
+  '';
+
+  passthru.tests = {
+    restic-exporter = nixosTests.prometheus-exporters.restic;
+  };
+
+  meta = with lib; {
+    description = "Prometheus exporter for the Restic backup system";
+    homepage = "https://github.com/ngosang/restic-exporter";
+    changelog = "https://github.com/ngosang/restic-exporter/blob/${src.rev}/CHANGELOG.md";
+    license = licenses.mit;
+    maintainers = with maintainers; [ minersebas ];
+    mainProgram = "restic-exporter.py";
+    platforms = platforms.all;
+  };
+}