Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
1{
2 lib,
3 buildGoModule,
4 fetchFromGitHub,
5 installShellFiles,
6 testers,
7 roxctl,
8}:
9
10buildGoModule rec {
11 pname = "roxctl";
12 version = "4.8.0";
13
14 src = fetchFromGitHub {
15 owner = "stackrox";
16 repo = "stackrox";
17 rev = version;
18 sha256 = "sha256-IIvHQFhdQiOtdceW6GhgeJ2yqXdL+FDeE7Y9VkTShJA=";
19 };
20
21 vendorHash = "sha256-nobE6QJfzFLFgWzzy04uynOtFoYHx8iv8RMcX8F2JOY=";
22
23 nativeBuildInputs = [ installShellFiles ];
24
25 subPackages = [ "roxctl" ];
26
27 ldflags = [
28 "-s"
29 "-w"
30 "-X github.com/stackrox/rox/pkg/version/internal.MainVersion=${version}"
31 ];
32
33 postInstall = ''
34 installShellCompletion --cmd roxctl \
35 --bash <($out/bin/roxctl completion bash) \
36 --fish <($out/bin/roxctl completion fish) \
37 --zsh <($out/bin/roxctl completion zsh)
38 '';
39
40 passthru.tests.version = testers.testVersion {
41 package = roxctl;
42 command = "roxctl version";
43 };
44
45 meta = with lib; {
46 description = "Command-line client of the StackRox Kubernetes Security Platform";
47 mainProgram = "roxctl";
48 license = licenses.asl20;
49 homepage = "https://www.stackrox.io";
50 maintainers = with maintainers; [ stehessel ];
51 };
52}