NixOS / nixpkgs

Nix Packages collection & NixOS
MIT License
17.44k stars 13.64k forks source link

Package request: lakectl #289408

Open lunik1 opened 7 months ago

lunik1 commented 7 months ago

Project description

The lakectl command line tool for use with lakeFS

Metadata


I took a crack at this with

{ lib
, buildGoModule
, fetchFromGitHub
}:

buildGoModule rec {
  pname = "lakectl";
  version = "1.11.0";

  src = fetchFromGitHub {
    owner = "treeverse";
    repo = "lakeFS";
    rev = "v${version}";
    hash = "sha256-ft1a2MbF9i4gZLnRBU+rPdllt0Y2OOPKDXJbsdBgb3c=";
  };

  ldflags = [ "-X github.com/treeverse/lakefs/pkg/version.Version=${version}" ];

  preBuild = ''
    go generate ./pkg/api/apigen ./pkg/auth
  '';

  subPackages = [ "cmd/lakectl" ];

  vendorHash = "sha256-DEPK7SQsZ/ebDZXLOVbseW3BWPbns3THljrGTHIQ96w=";

  meta = with lib; {
    description = "Git for data";
    homepage = "https://lakefs.io/";
    license = licenses.asl20;
    maintainers = with maintainers; [ lunik1 ];
  };
}

but this errors with

       last 10 log lines:
       > source root is source
       > patching sources
       > updateAutotoolsGnuConfigScriptsPhase
       > configuring
       > building
       > go: github.com/deepmap/oapi-codegen/cmd/oapi-codegen@v1.5.6: cannot query module due to -mod=vendor
       > pkg/api/apigen/doc.go:4: running "go": exit status 1
       > go: github.com/deepmap/oapi-codegen/cmd/oapi-codegen@v1.5.6: cannot query module due to -mod=vendor
       > pkg/auth/service.go:3: running "go": exit status 1
       > /nix/store/wr08yanv2bjrphhi5aai12hf2qz5kvic-stdenv-linux/setup: line 131: pop_var_context: head of shell_variables not a function context

Maybe somebody who knows more about go packaging knows what's up?

Add a :+1: reaction to issues you find important.

TomaSajt commented 7 months ago

The error is coming from here: https://github.com/treeverse/lakeFS/blob/master/pkg/api/apigen/doc.go It looks as if it's trying to do some code generation

lunik1 commented 7 months ago

Yeah it does, that's why I needed the preBuild step.

jamietanna commented 7 months ago

I've not done much Nix stuff, but I'm a maintainer on oapi-codegen.

Maybe try go mod download then go generate ...? But looking at the project's Makefile there's a few other things that may need to be made alongside it :thinking:

It looks like the project has the version of oapi-codegen pinned correctly, so it should work :thinking: