diff --git a/pkgs/server/prometheus-folder-size-exporter.nix b/pkgs/server/prometheus-folder-size-exporter.nix new file mode 100644 index 000000000..0e403fa8b --- /dev/null +++ b/pkgs/server/prometheus-folder-size-exporter.nix @@ -0,0 +1,38 @@ +{ lib +, rustPlatform +, fetchFromGitHub +, stdenv +, darwin +}: + +rustPlatform.buildRustPackage rec { + pname = "prometheus-folder-size-exporter"; + version = "0.5.0"; + + src = fetchFromGitHub { + owner = "MindFlavor"; + repo = "prometheus_folder_size_exporter"; + rev = version; + hash = "sha256-G1oWGiTyftloPxgOuiYFO7hofHdbwPCG4QDXK1t5qWk="; + }; + + postPatch = '' + # patch to use gauge instead of counter + # from https://github.com/MindFlavor/prometheus_folder_size_exporter/pull/18/files + sed -i -E 's/(MetricType::)Counter/\1Gauge/g' ./src/main.rs + ''; + + cargoHash = "sha256-M9kvf0XNDtBzvCHVDs+JPC+oNTsWuDFKdjqVgNUnRLg="; + + buildInputs = lib.optionals stdenv.isDarwin [ + darwin.apple_sdk.frameworks.Security + ]; + + meta = with lib; { + description = "A Rust only folder size exporter for Prometheus (Grafana"; + homepage = "https://github.com/MindFlavor/prometheus_folder_size_exporter"; + license = licenses.mit; + maintainers = with maintainers; [ jpetrucciani ]; + mainProgram = "prometheus_folder_size_exporter"; + }; +}