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