prometheus-node-exporter: fix build on darwin (#165546)
This commit is contained in:
parent
077f078a01
commit
6af081ad33
3 changed files with 31 additions and 2 deletions
|
@ -1,4 +1,7 @@
|
|||
{ lib, buildGoModule, fetchFromGitHub, nixosTests }:
|
||||
{ lib, stdenv, buildGoModule, fetchFromGitHub, nixosTests
|
||||
# darwin
|
||||
, CoreFoundation, IOKit
|
||||
}:
|
||||
|
||||
buildGoModule rec {
|
||||
pname = "node_exporter";
|
||||
|
@ -17,6 +20,13 @@ buildGoModule rec {
|
|||
# FIXME: tests fail due to read-only nix store
|
||||
doCheck = false;
|
||||
|
||||
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 ];
|
||||
|
||||
excludedPackages = [ "docs/node-mixin" ];
|
||||
|
||||
ldflags = [
|
||||
|
|
|
@ -0,0 +1,17 @@
|
|||
diff --git a/collector/powersupplyclass_darwin.go b/collector/powersupplyclass_darwin.go
|
||||
index a070f64..01d7f18 100644
|
||||
--- a/collector/powersupplyclass_darwin.go
|
||||
+++ b/collector/powersupplyclass_darwin.go
|
||||
@@ -18,9 +18,11 @@ package collector
|
||||
|
||||
/*
|
||||
#cgo LDFLAGS: -framework IOKit -framework CoreFoundation
|
||||
+#include <CoreFoundation/CFNumber.h>
|
||||
+#include <CoreFoundation/CFRunLoop.h>
|
||||
+#include <CoreFoundation/CFString.h>
|
||||
#include <IOKit/ps/IOPowerSources.h>
|
||||
#include <IOKit/ps/IOPSKeys.h>
|
||||
-#include <CoreFoundation/CFArray.h>
|
||||
|
||||
// values collected from IOKit Power Source APIs
|
||||
// Functions documentation available at
|
|
@ -22000,7 +22000,9 @@ with pkgs;
|
|||
prometheus-nextcloud-exporter = callPackage ../servers/monitoring/prometheus/nextcloud-exporter.nix { };
|
||||
prometheus-nginx-exporter = callPackage ../servers/monitoring/prometheus/nginx-exporter.nix { };
|
||||
prometheus-nginxlog-exporter = callPackage ../servers/monitoring/prometheus/nginxlog-exporter.nix { };
|
||||
prometheus-node-exporter = callPackage ../servers/monitoring/prometheus/node-exporter.nix { };
|
||||
prometheus-node-exporter = callPackage ../servers/monitoring/prometheus/node-exporter.nix {
|
||||
inherit (darwin.apple_sdk.frameworks) CoreFoundation IOKit;
|
||||
};
|
||||
prometheus-openldap-exporter = callPackage ../servers/monitoring/prometheus/openldap-exporter.nix { };
|
||||
prometheus-openvpn-exporter = callPackage ../servers/monitoring/prometheus/openvpn-exporter.nix { };
|
||||
prometheus-pihole-exporter = callPackage ../servers/monitoring/prometheus/pihole-exporter.nix { };
|
||||
|
|
Loading…
Reference in a new issue