1{
2 lib,
3 stdenv,
4 buildGoModule,
5 fetchFromGitHub,
6 systemd,
7}:
8
9buildGoModule rec {
10 pname = "node-problem-detector";
11 version = "0.8.21";
12
13 src = fetchFromGitHub {
14 owner = "kubernetes";
15 repo = "node-problem-detector";
16 rev = "v${version}";
17 sha256 = "sha256-byxj6EXKAmesFOBtBt0URcT0h1pYdrW8ewtITuEPFcs=";
18 };
19
20 vendorHash = null;
21
22 doCheck = false;
23
24 # Optionally, a log counter binary can be created to parse journald logs.
25 # The binary is dynamically linked against systemd libraries, making it a
26 # Linux-only feature. See 'ENABLE_JOURNALD' upstream:
27 # https://github.com/kubernetes/node-problem-detector/blob/master/Makefile
28 subPackages = [
29 "cmd/nodeproblemdetector"
30 ]
31 ++ lib.optionals stdenv.hostPlatform.isLinux [ "cmd/logcounter" ];
32
33 preBuild = ''
34 export CGO_ENABLED=${if stdenv.hostPlatform.isLinux then "1" else "0"}
35 '';
36
37 buildInputs = lib.optionals stdenv.hostPlatform.isLinux [ systemd ];
38
39 tags = lib.optionals stdenv.hostPlatform.isLinux [ "journald" ];
40
41 ldflags = [
42 "-X k8s.io/node-problem-detector/pkg/version.version=v${version}"
43 ];
44
45 meta = {
46 description = "Various problem detectors running on the Kubernetes nodes";
47 homepage = "https://github.com/kubernetes/node-problem-detector";
48 changelog = "https://github.com/kubernetes/node-problem-detector/releases/tag/v${version}";
49 license = lib.licenses.asl20;
50 maintainers = with lib.maintainers; [ lbpdt ];
51 };
52}