2023-11-27 16:39:02 +00:00
|
|
|
{
|
|
|
|
lib,
|
|
|
|
stdenvNoCC,
|
|
|
|
fetchFromGitHub,
|
|
|
|
python3,
|
|
|
|
restic,
|
2024-02-01 14:00:35 +00:00
|
|
|
nixosTests,
|
2023-11-27 16:39:02 +00:00
|
|
|
}:
|
|
|
|
|
|
|
|
stdenvNoCC.mkDerivation rec {
|
|
|
|
pname = "prometheus-restic-exporter";
|
2024-08-16 14:50:18 +00:00
|
|
|
version = "1.6.0";
|
2023-11-27 16:39:02 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "ngosang";
|
|
|
|
repo = "restic-exporter";
|
|
|
|
rev = version;
|
2024-08-16 14:50:18 +00:00
|
|
|
hash = "sha256-gXiEts0EY9H01+rs+2o+cbVENotM33uhcQiGDtroSU4=";
|
2023-11-27 16:39:02 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
buildInputs = [
|
|
|
|
(python3.withPackages (ps: [ ps.prometheus-client ]))
|
|
|
|
];
|
|
|
|
|
|
|
|
installPhase = ''
|
|
|
|
runHook preInstall
|
|
|
|
|
|
|
|
install -D -m0755 restic-exporter.py $out/bin/restic-exporter.py
|
|
|
|
|
2024-02-02 13:41:45 +00:00
|
|
|
substituteInPlace $out/bin/restic-exporter.py --replace-fail \"restic\" \"${lib.makeBinPath [ restic ]}/restic\"
|
2023-11-27 16:39:02 +00:00
|
|
|
|
|
|
|
patchShebangs $out/bin/restic-exporter.py
|
|
|
|
|
|
|
|
runHook postInstall
|
|
|
|
'';
|
|
|
|
|
2024-02-01 14:00:35 +00:00
|
|
|
passthru.tests = {
|
|
|
|
restic-exporter = nixosTests.prometheus-exporters.restic;
|
|
|
|
};
|
|
|
|
|
2023-11-27 16:39:02 +00:00
|
|
|
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;
|
|
|
|
};
|
|
|
|
}
|