lol
1{ lib
2, buildGoModule
3, fetchFromGitHub
4, nodejs
5, nix-update-script
6}:
7
8buildGoModule rec {
9 pname = "jfrog-cli";
10 version = "2.56.1";
11
12 src = fetchFromGitHub {
13 owner = "jfrog";
14 repo = "jfrog-cli";
15 rev = "refs/tags/v${version}";
16 hash = "sha256-oUICnpVHRNCauWEplz7xH6AdP6CbbYX/Uy/QUPjwGHc=";
17 };
18
19 vendorHash = "sha256-zQjOOUlqL0Mj2DKHiG9rOfu41SKMO7C99JBJDycXAs4=";
20
21 # Upgrade the Go version during the vendoring FOD build because it fails otherwise.
22 overrideModAttrs = _: {
23 preBuild = ''
24 substituteInPlace go.mod --replace-fail 'go 1.20' 'go 1.21'
25 '';
26 postInstall = ''
27 cp go.mod "$out/go.mod"
28 '';
29 };
30
31 # Copy the modified go.mod we got from the vendoring process.
32 preBuild = ''
33 cp vendor/go.mod go.mod
34 '';
35
36 postPatch = ''
37 # Patch out broken test cleanup.
38 substituteInPlace artifactory_test.go \
39 --replace-fail \
40 'deleteReceivedReleaseBundle(t, "cli-tests", "2")' \
41 '// deleteReceivedReleaseBundle(t, "cli-tests", "2")'
42 '';
43
44 postInstall = ''
45 # Name the output the same way as the original build script does
46 mv $out/bin/jfrog-cli $out/bin/jf
47 '';
48
49 # Some of the tests require a writable $HOME
50 preCheck = "export HOME=$TMPDIR";
51
52 nativeCheckInputs = [ nodejs ];
53
54 passthru.updateScript = nix-update-script { };
55
56 meta = with lib; {
57 homepage = "https://github.com/jfrog/jfrog-cli";
58 description = "Client for accessing to JFrog's Artifactory and Mission Control through their respective REST APIs";
59 changelog = "https://github.com/jfrog/jfrog-cli/releases/tag/v${version}";
60 license = licenses.asl20;
61 mainProgram = "jf";
62 maintainers = with maintainers; [ detegr aidalgol ];
63 };
64}