2022-03-24 17:24:40 +01:00
|
|
|
{ lib, stdenv, buildGoModule, fetchFromGitHub, nixosTests
|
|
|
|
# darwin
|
|
|
|
, CoreFoundation, IOKit
|
|
|
|
}:
|
2016-06-05 15:52:16 +02:00
|
|
|
|
2021-05-11 07:02:02 +02:00
|
|
|
buildGoModule rec {
|
2019-08-15 14:41:18 +02:00
|
|
|
pname = "node_exporter";
|
2021-12-08 14:18:25 +01:00
|
|
|
version = "1.3.1";
|
2016-12-01 01:34:21 +01:00
|
|
|
rev = "v${version}";
|
2016-06-28 15:32:22 +02:00
|
|
|
|
2016-06-06 12:26:56 +02:00
|
|
|
src = fetchFromGitHub {
|
2016-06-05 15:52:16 +02:00
|
|
|
inherit rev;
|
2016-06-06 12:26:56 +02:00
|
|
|
owner = "prometheus";
|
|
|
|
repo = "node_exporter";
|
2021-12-08 14:18:25 +01:00
|
|
|
sha256 = "sha256-+0k9LBsHqNHmoOAY1UDzbbqni+ikj+c3ijfT41rCfLc=";
|
2016-06-05 15:52:16 +02:00
|
|
|
};
|
|
|
|
|
2021-11-25 17:59:12 +01:00
|
|
|
vendorSha256 = "sha256-nAvODyy+PfkGFAaq+3hBhQaPji5GUMU7N8xcgbGQMeI=";
|
2021-05-11 07:02:02 +02:00
|
|
|
|
2018-06-18 19:21:20 +02:00
|
|
|
# FIXME: tests fail due to read-only nix store
|
2016-06-28 15:32:22 +02:00
|
|
|
doCheck = false;
|
2016-06-05 15:52:16 +02:00
|
|
|
|
2022-03-24 17:24:40 +01:00
|
|
|
buildInputs = lib.optionals stdenv.isDarwin [ CoreFoundation IOKit ];
|
|
|
|
# upstream currently doesn't work with the version of the macOS SDK
|
|
|
|
# we're building against in nix-darwin without a patch.
|
|
|
|
# this patch has been submitted upstream at https://github.com/prometheus/node_exporter/pull/2327
|
|
|
|
# and only needs to be carried until it lands in a new release.
|
|
|
|
patches = lib.optionals stdenv.isDarwin [ ./node-exporter/node-exporter-darwin.patch ];
|
|
|
|
|
2021-05-11 07:02:02 +02:00
|
|
|
excludedPackages = [ "docs/node-mixin" ];
|
|
|
|
|
2021-07-29 15:09:02 +02:00
|
|
|
ldflags = [
|
|
|
|
"-s"
|
|
|
|
"-w"
|
|
|
|
"-X github.com/prometheus/common/version.Version=${version}"
|
|
|
|
"-X github.com/prometheus/common/version.Revision=${rev}"
|
|
|
|
"-X github.com/prometheus/common/version.Branch=unknown"
|
|
|
|
"-X github.com/prometheus/common/version.BuildUser=nix@nixpkgs"
|
|
|
|
"-X github.com/prometheus/common/version.BuildDate=unknown"
|
|
|
|
];
|
2019-06-25 09:17:46 +02:00
|
|
|
|
2020-06-18 12:48:40 +02:00
|
|
|
passthru.tests = { inherit (nixosTests.prometheus-exporters) node; };
|
|
|
|
|
2021-01-11 08:54:33 +01:00
|
|
|
meta = with lib; {
|
2016-06-05 15:52:16 +02:00
|
|
|
description = "Prometheus exporter for machine metrics";
|
2020-04-01 03:11:51 +02:00
|
|
|
homepage = "https://github.com/prometheus/node_exporter";
|
2016-06-05 15:52:16 +02:00
|
|
|
license = licenses.asl20;
|
2020-05-26 21:09:43 +02:00
|
|
|
maintainers = with maintainers; [ benley fpletz globin Frostman ];
|
2016-06-05 15:52:16 +02:00
|
|
|
};
|
|
|
|
}
|