lol
1{
2 lib,
3 buildGoModule,
4 fetchFromGitHub,
5 versionCheckHook,
6}:
7
8buildGoModule rec {
9 pname = "natscli";
10 version = "0.2.2";
11
12 src = fetchFromGitHub {
13 owner = "nats-io";
14 repo = "natscli";
15 tag = "v${version}";
16 hash = "sha256-5iGU23HsaMuRDcy3qeCJZE3p2ikaIlLnuWyGfCAlMYQ=";
17 };
18
19 vendorHash = "sha256-8JtMcEI3UMMuTa9jmkTspjKtseIb2XUcbNuWlrkAVfg=";
20
21 ldflags = [
22 "-s"
23 "-w"
24 "-X=main.version=${version}"
25 ];
26
27 nativeInstallCheckInputs = [ versionCheckHook ];
28
29 preCheck = ''
30 # Remove tests that depend on CLI output
31 substituteInPlace internal/asciigraph/asciigraph_test.go \
32 --replace-fail "TestPlot" "SkipPlot"
33 '';
34
35 doInstallCheck = true;
36
37 versionCheckProgram = "${placeholder "out"}/bin/nats";
38
39 meta = {
40 description = "NATS Command Line Interface";
41 homepage = "https://github.com/nats-io/natscli";
42 changelog = "https://github.com/nats-io/natscli/releases/tag/v${version}";
43 license = lib.licenses.asl20;
44 maintainers = with lib.maintainers; [ fab ];
45 mainProgram = "nats";
46 };
47}