Error building go package

Hi everyone,

I am trying to build the OliveTin package with Nix, but I am getting the following error:

/nix/store/fzb9wy1yz0hn69vxw12954szvrjnjjgk-stdenv-linux/setup: line 144: pop_var_context: head of shell_variables not a function context
error: builder for '/nix/store/m4pmmrbp4bkg08sl5qpv5gh53kpi51il-OliveTin-2023.03.25.drv' failed with exit code 1;
last 10 log lines:
> building
> go install "github.com/bufbuild/buf/cmd/buf"
> go install "github.com/fzipp/gocyclo/cmd/gocyclo"
> go install "github.com/go-critic/go-critic/cmd/gocritic"
> go install "github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-grpc-gateway"
> go install "github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-openapiv2"
> go install "google.golang.org/grpc/cmd/protoc-gen-go-grpc"
> go install "google.golang.org/protobuf/cmd/protoc-gen-go"
> Failure: the server hosted at that remote is unavailable.
> /nix/store/fzb9wy1yz0hn69vxw12954szvrjnjjgk-stdenv-linux/setup: line 144: pop_var_context: head of shell_variables not a function context
For full logs, run 'nix log /nix/store/m4pmmrbp4bkg08sl5qpv5gh53kpi51il-OliveTin-2023.03.25.drv'.

The derivation for the OliveTin package is as follows:

{ lib, buildGo119Module , fetchFromGitHub, gitMinimal }:

buildGo119Module rec {
pname = "OliveTin";
version = "2023.03.25";

src = fetchFromGitHub {
owner = "OliveTin";
repo = pname;
rev = "${version}";
sha256 = "sha256-PCNaznHUx+YrXjPY1AHool2SbQJG+AlyZpycUsLKR5U=";
};
vendorSha256 = "sha256-eWIo+OiW0e7lSVp+x65nSdRiIj3cBKB+xr2LYfVzeXI=";
preBuild = ''
export HOME=$(mktemp -d)
export PATH="/build/go/bin:$PATH"
make go-tools
buf generate
'';
meta = with lib; {
homepage = "https://github.com/OliveTin/OliveTin/";
changelog = "https://github.com/OliveTin/OliveTin/releases/tag/${version}";
description = "OliveTin gives safe and simple access to predefined shell commands from a web interface";
license = licenses.agpl3;
};
}

Can anyone help me to fix this error?

Thanks in advance!

1 Like

I switch to fetchurl to get the binary in the github release. I opened a pr and I’ll link this post in case someone can suggest me a way to improve the derivation