nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 lib,
3 buildGoModule,
4 fetchFromGitHub,
5 nix-update-script,
6}:
7
8buildGoModule (finalAttrs: {
9 pname = "lakectl";
10 version = "1.65.2";
11
12 src = fetchFromGitHub {
13 owner = "treeverse";
14 repo = "lakeFS";
15 tag = "v${finalAttrs.version}";
16 hash = "sha256-X7cjNa9PQFUuvCN8/i8p9kqsvHqc3IGFWL++Mj0KdfY=";
17 };
18
19 subPackages = [ "cmd/lakectl" ];
20 proxyVendor = true;
21 vendorHash = "sha256-JEAVAXWscq/u+ABvYThlWkpaVRQd2e2gtmYoLDjVx/s=";
22
23 ldflags = [
24 "-s"
25 "-w"
26 "-X github.com/treeverse/lakefs/pkg/version.Version=${finalAttrs.version}"
27 ];
28
29 preBuild = ''
30 go generate ./pkg/api/apigen ./pkg/auth
31 '';
32
33 doInstallCheck = true;
34
35 # custom version test for install phase,
36 # versionCheckHook doesn't work as it expects only version to be returned as output, here it's a string with version
37 installCheckPhase = ''
38 runHook preInstallCheck
39
40 versionOutput=$($out/bin/lakectl --version)
41 echo "Version output: $versionOutput"
42 if [[ "$versionOutput" == *"lakectl version: ${finalAttrs.version}"* ]]; then
43 echo "Version check passed!"
44 else
45 echo "Version check failed!"
46 echo "Expected version: 'lakectl version: ${finalAttrs.version}'"
47 echo "Got version: $versionOutput"
48 exit 1
49 fi
50
51 runHook postInstallCheck
52 '';
53
54 passthru.updateScript = nix-update-script { };
55
56 meta = {
57 description = "Command line tool for LakeFS";
58 homepage = "https://docs.lakefs.io/reference/cli.html";
59 changelog = "https://github.com/treeverse/lakeFS/blob/v${finalAttrs.version}/CHANGELOG.md";
60 license = lib.licenses.asl20;
61 maintainers = with lib.maintainers; [ daspk04 ];
62 mainProgram = "lakectl";
63 };
64})