1{
2 lib,
3 stdenv,
4 go,
5 buildGoModule,
6 fetchFromGitHub,
7 nix-update-script,
8 installShellFiles,
9 testers,
10 updatecli,
11}:
12
13buildGoModule rec {
14 pname = "updatecli";
15 version = "0.105.0";
16
17 src = fetchFromGitHub {
18 owner = "updatecli";
19 repo = "updatecli";
20 rev = "v${version}";
21 hash = "sha256-VE5sU3R9dVi97fyc+bafZUz/9v6iPfw3MRsjCm8ifuo=";
22 };
23
24 vendorHash = "sha256-HdeFXQGisz0q/ZZv1UMo9ig9zBzH6Uyap8c1vl4zl5w=";
25
26 # tests require network access
27 doCheck = false;
28
29 env.CGO_ENABLED = 0;
30
31 ldflags = [
32 "-s"
33 "-w"
34 "-X github.com/updatecli/updatecli/pkg/core/version.BuildTime=unknown"
35 ''-X "github.com/updatecli/updatecli/pkg/core/version.GoVersion=go version go${lib.getVersion go}"''
36 "-X github.com/updatecli/updatecli/pkg/core/version.Version=${version}"
37 ];
38
39 passthru = {
40 updateScript = nix-update-script { };
41 tests.version = testers.testVersion {
42 package = updatecli;
43 command = "updatecli version";
44 };
45 };
46
47 nativeBuildInputs = [ installShellFiles ];
48
49 postInstall = lib.optionalString (stdenv.buildPlatform.canExecute stdenv.hostPlatform) ''
50 installShellCompletion --cmd updatecli \
51 --bash <($out/bin/updatecli completion bash) \
52 --fish <($out/bin/updatecli completion fish) \
53 --zsh <($out/bin/updatecli completion zsh)
54
55 $out/bin/updatecli man > updatecli.1
56 installManPage updatecli.1
57 '';
58
59 meta = with lib; {
60 description = "Declarative Dependency Management tool";
61 longDescription = ''
62 Updatecli is a command-line tool used to define and apply update strategies.
63 '';
64 homepage = "https://www.updatecli.io";
65 changelog = "https://github.com/updatecli/updatecli/releases/tag/${src.rev}";
66 license = licenses.asl20;
67 mainProgram = "updatecli";
68 maintainers = with maintainers; [ croissong ];
69 };
70}