blob: 486cdeff021df99494370af6578570504c14ec57 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
|
{ lib
, buildGoModule
, fetchFromGitHub
, installShellFiles
, nix-update-script
, testers
, pulsarctl
}:
buildGoModule rec {
pname = "pulsarctl";
version = "2.11.1.3";
src = fetchFromGitHub {
owner = "streamnative";
repo = "pulsarctl";
rev = "v${version}";
hash = "sha256-sztjHw3su8KAV/zZcJqPWhjblINa8nYCN5Dzhn6X07w=";
};
vendorHash = "sha256-NQ8zvrW6lBF1js+WI2PPvXhv4YRS2IBT6S4vDoE1BFc=";
nativeBuildInputs = [ installShellFiles ];
preBuild = let
buildVars = {
ReleaseVersion = version;
BuildTS = "None";
GitHash = src.rev;
GitBranch = "None";
GoVersion = "$(go version | egrep -o 'go[0-9]+[.][^ ]*')";
};
buildVarsFlags = lib.concatStringsSep " " (lib.mapAttrsToList (k: v: "-X github.com/streamnative/pulsarctl/pkg/cmdutils.${k}=${v}") buildVars);
in
''
buildFlagsArray+=("-ldflags=${buildVarsFlags}")
'';
excludedPackages = [
"./pkg/test"
"./pkg/test/bookkeeper"
"./pkg/test/bookkeeper/containers"
"./pkg/test/pulsar"
"./pkg/test/pulsar/containers"
"./site/gen-pulsarctldocs"
"./site/gen-pulsarctldocs/generators"
];
doCheck = false;
postInstall = ''
installShellCompletion --cmd pulsarctl \
--bash <($out/bin/pulsarctl completion bash) \
--fish <($out/bin/pulsarctl completion fish) \
--zsh <($out/bin/pulsarctl completion zsh)
'';
passthru = {
updateScript = nix-update-script { };
tests.version = testers.testVersion {
package = pulsarctl;
command = "pulsarctl --version";
version = "v${version}";
};
};
meta = with lib; {
description = " a CLI for Apache Pulsar written in Go";
homepage = "https://github.com/streamnative/pulsarctl";
license = with licenses; [ asl20 ];
platforms = platforms.unix;
maintainers = with maintainers; [ gaelreyrol ];
mainProgram = "pulsarctl";
};
}
|