lol
1{ stdenv, lib, buildGoModule, fetchFromGitHub, makeWrapper, iproute2, nettools }:
2
3buildGoModule rec {
4 pname = "mackerel-agent";
5 version = "0.78.0";
6
7 src = fetchFromGitHub {
8 owner = "mackerelio";
9 repo = pname;
10 rev = "v${version}";
11 sha256 = "sha256-L8kYbJ9RmCoec9keBHv61K94rjnH+Q4dRkn6PCtjgJI=";
12 };
13
14 nativeBuildInputs = [ makeWrapper ];
15 nativeCheckInputs = lib.optionals (!stdenv.isDarwin) [ nettools ];
16 buildInputs = lib.optionals (!stdenv.isDarwin) [ iproute2 ];
17
18 vendorHash = "sha256-A3e6qd6yjKsNUaXiltbS9G4WEMd3F1FxaxqMMVuBCUI=";
19
20 subPackages = [ "." ];
21
22 ldflags = [
23 "-X=main.version=${version}"
24 "-X=main.gitcommit=v${version}"
25 ];
26
27 postInstall = ''
28 wrapProgram $out/bin/mackerel-agent \
29 --prefix PATH : "${lib.makeBinPath buildInputs}"
30 '';
31
32 doCheck = true;
33
34 meta = with lib; {
35 description = "System monitoring service for mackerel.io";
36 homepage = "https://github.com/mackerelio/mackerel-agent";
37 license = licenses.asl20;
38 maintainers = with maintainers; [ midchildan ];
39 };
40}