2021-05-03 16:01:13 +01:00
|
|
|
{ stdenv, fetchFromGitHub, lib, python3, nixosTests, fetchpatch }:
|
2021-03-05 12:06:20 +00:00
|
|
|
|
|
|
|
stdenv.mkDerivation rec {
|
2021-03-07 21:12:09 +00:00
|
|
|
pname = "knot-exporter";
|
|
|
|
version = "unstable-2020-01-30";
|
2021-03-05 12:06:20 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "ghedo";
|
|
|
|
repo = "knot_exporter";
|
|
|
|
rev = "21dd46b401e0c1aea0b173e19462cdf89e1f444e";
|
|
|
|
sha256 = "sha256-4au4lpaq3jcqC2JXdCcf8h+YN8Nmm4eE0kZwA+1rWlc=";
|
|
|
|
};
|
|
|
|
|
2021-05-03 16:01:13 +01:00
|
|
|
patches = [
|
|
|
|
# Fixes a crash with all metrics enabled. See
|
|
|
|
# https://github.com/ghedo/knot_exporter/pull/6 for further context.
|
|
|
|
(fetchpatch {
|
|
|
|
url = "https://github.com/ghedo/knot_exporter/commit/2317476e080369450ae51a707ccd30d4b89d680f.patch";
|
|
|
|
sha256 = "sha256-yEPu8EE1V/draNx9DeMrPj+bMfJRxauweo33dITl4AA=";
|
|
|
|
})
|
|
|
|
];
|
|
|
|
|
2021-03-05 12:06:20 +00:00
|
|
|
dontBuild = true;
|
|
|
|
|
|
|
|
nativeBuildInputs = [ python3.pkgs.wrapPython ];
|
|
|
|
buildInputs = [ python3 ];
|
|
|
|
|
|
|
|
installPhase = ''
|
|
|
|
runHook preInstall
|
|
|
|
|
|
|
|
install -Dm0755 knot_exporter $out/bin/knot_exporter
|
|
|
|
patchShebangs $out/bin
|
|
|
|
buildPythonPath ${python3.pkgs.prometheus_client}
|
|
|
|
patchPythonScript $out/bin/knot_exporter
|
|
|
|
|
|
|
|
runHook postInstall
|
|
|
|
'';
|
|
|
|
|
2021-03-11 17:39:17 +00:00
|
|
|
passthru.tests = { inherit (nixosTests.prometheus-exporters) knot; };
|
|
|
|
|
2021-03-05 12:06:20 +00:00
|
|
|
meta = with lib; {
|
|
|
|
homepage = "https://github.com/ghedo/knot_exporter";
|
|
|
|
description = " Prometheus exporter for Knot DNS";
|
|
|
|
license = licenses.gpl3Only;
|
|
|
|
maintainers = with maintainers; [ ma27 ];
|
|
|
|
platforms = platforms.linux;
|
|
|
|
};
|
|
|
|
}
|