nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 lib,
3 buildGoModule,
4 fetchFromGitHub,
5 installShellFiles,
6 kargo,
7 stdenv,
8 testers,
9 writableTmpDirAsHomeHook,
10}:
11
12buildGoModule rec {
13 pname = "kargo";
14 version = "1.8.6";
15
16 src = fetchFromGitHub {
17 owner = "akuity";
18 repo = "kargo";
19 tag = "v${version}";
20 hash = "sha256-sBUgoR3Eqv2OQRnXR9IaB4QcZ+awJb3ah7ySZ0XsaYA=";
21 };
22
23 vendorHash = "sha256-ZB1Eq8xQ/oF5sm750K9yJyBpwCIcCqmFL8FWpNsiXfo=";
24
25 subPackages = [ "cmd/cli" ];
26
27 ldflags =
28 let
29 package_url = "github.com/akuity/kargo/pkg/x/version";
30 in
31 [
32 "-s"
33 "-w"
34 "-X ${package_url}.version=${version}"
35 "-X ${package_url}.buildDate=1970-01-01T00:00:00Z"
36 "-X ${package_url}.gitCommit=${src.rev}"
37 "-X ${package_url}.gitTreeState=clean"
38 ];
39
40 nativeBuildInputs = [
41 installShellFiles
42 writableTmpDirAsHomeHook
43 ];
44
45 installPhase = ''
46 runHook preInstall
47 mkdir -p $out/bin
48 install -Dm755 "$GOPATH/bin/cli" -T $out/bin/kargo
49 runHook postInstall
50 '';
51
52 passthru.tests.version = testers.testVersion {
53 package = kargo;
54 command = "HOME=$TMPDIR ${meta.mainProgram} version --client";
55 };
56
57 postInstall = lib.optionalString (stdenv.buildPlatform.canExecute stdenv.hostPlatform) ''
58 installShellCompletion --cmd kargo \
59 --bash <($out/bin/kargo completion bash) \
60 --fish <($out/bin/kargo completion fish) \
61 --zsh <($out/bin/kargo completion zsh)
62 '';
63
64 meta = {
65 description = "Application lifecycle orchestration";
66 mainProgram = "kargo";
67 downloadPage = "https://github.com/akuity/kargo";
68 homepage = "https://kargo.akuity.io";
69 license = lib.licenses.asl20;
70 maintainers = with lib.maintainers; [
71 bbigras
72 ];
73 };
74}