1{
2 lib,
3 stdenv,
4 buildGoModule,
5 fetchFromGitHub,
6 gotools,
7}:
8
9buildGoModule rec {
10 pname = "mtail";
11 version = "3.2.8";
12
13 src = fetchFromGitHub {
14 owner = "jaqx0r";
15 repo = "mtail";
16 rev = "v${version}";
17 hash = "sha256-jRaIDYEzpSFOTPFks6lWMidxmcmHfym4kG71+byJ9vI=";
18 };
19
20 vendorHash = "sha256-KZOcmZGv1kI9eDhQdtQeQ3ITyEw9vEDPz4RAz30pP9s=";
21
22 nativeBuildInputs = [
23 gotools # goyacc
24 ];
25
26 ldflags = [
27 "-X=main.Branch=main"
28 "-X=main.Version=${version}"
29 "-X=main.Revision=${src.rev}"
30 ];
31
32 # fails on darwin with: write unixgram -> <tmpdir>/rsyncd.log: write: message too long
33 doCheck = !stdenv.hostPlatform.isDarwin;
34
35 checkFlags = [
36 # can only be executed under bazel
37 "-skip=TestExecMtail"
38 ];
39
40 preBuild = ''
41 GOOS= GOARCH= go generate ./...
42 '';
43
44 meta = {
45 description = "Tool for extracting metrics from application logs";
46 homepage = "https://github.com/jaqx0r/mtail";
47 license = lib.licenses.asl20;
48 maintainers = with lib.maintainers; [ nickcao ];
49 mainProgram = "mtail";
50 };
51}