lol
1{
2 stdenv,
3 lib,
4 buildGoModule,
5 fetchFromGitHub,
6 installShellFiles,
7 testers,
8 kubeshark,
9 nix-update-script,
10}:
11
12buildGoModule rec {
13 pname = "kubeshark";
14 version = "52.8.1";
15
16 src = fetchFromGitHub {
17 owner = "kubeshark";
18 repo = "kubeshark";
19 rev = "v${version}";
20 hash = "sha256-o11gVE+s2tVd2RLD6Otd23wt3l6HxBwoOfwhaaqttn8=";
21 };
22
23 vendorHash = "sha256-4s1gxJo2w5BibZ9CJP7Jl9Z8Zzo8WpBokBnRN+zp8b4=";
24
25 ldflags =
26 let
27 t = "github.com/kubeshark/kubeshark";
28 in
29 [
30 "-s"
31 "-w"
32 "-X ${t}/misc.GitCommitHash=${src.rev}"
33 "-X ${t}/misc.Branch=master"
34 "-X ${t}/misc.BuildTimestamp=0"
35 "-X ${t}/misc.Platform=unknown"
36 "-X ${t}/misc.Ver=${version}"
37 ];
38
39 nativeBuildInputs = [ installShellFiles ];
40
41 checkPhase = ''
42 go test ./...
43 '';
44 doCheck = true;
45
46 postInstall = lib.optionalString (stdenv.buildPlatform.canExecute stdenv.hostPlatform) ''
47 installShellCompletion --cmd kubeshark \
48 --bash <($out/bin/kubeshark completion bash) \
49 --fish <($out/bin/kubeshark completion fish) \
50 --zsh <($out/bin/kubeshark completion zsh)
51 '';
52
53 passthru = {
54 tests.version = testers.testVersion {
55 package = kubeshark;
56 command = "kubeshark version";
57 inherit version;
58 };
59 updateScript = nix-update-script { };
60 };
61
62 meta = {
63 changelog = "https://github.com/kubeshark/kubeshark/releases/tag/v${version}";
64 description = "API Traffic Viewer for Kubernetes";
65 mainProgram = "kubeshark";
66 homepage = "https://kubeshark.co/";
67 license = lib.licenses.asl20;
68 longDescription = ''
69 The API traffic viewer for Kubernetes providing real-time, protocol-aware visibility into Kubernetes’ internal network,
70 Think TCPDump and Wireshark re-invented for Kubernetes
71 capturing, dissecting and monitoring all traffic and payloads going in, out and across containers, pods, nodes and clusters.
72 '';
73 maintainers = with lib.maintainers; [
74 bryanasdev000
75 qjoly
76 ];
77 };
78}