Error building Go package (darwin)


go: cannot find main module, but found Gopkg.lock in /private/tmp/nix-build-codesigndoc-2.4.2.drv-0/source
        to create a module there, run:
        go mod init


{ buildGoModule, fetchFromGitHub, lib }:

buildGoModule rec {
  pname = "codesigndoc";
  version = "2.4.2";

  src = fetchFromGitHub {
    owner = "bitrise-io";
    repo = "codesigndoc";
    rev = version;
    sha256 = "189chbjrynj34x8b3kk4vkh7pczrx0x31ja2karjwyfzhk2bl8m8";

  deleteVend = true;

  vendorSha256 = null;

  meta = with lib; {
    description = "XCode certificate/key collection tool";
    homepage = "";
    license =;
    maintainer = maintainers.spease;

I don’t believe this used to be an issue.

The repository you are trying to build is not a “go module”, you need to build it by other means.

A way to go might be buildGoPackage as described in the manual about legacy go packages.

It might be tedious to write up all the dependencies out by hand.

Though as “Gopkg” was used, you might be lucky and the vendor folder is properly populated such that you do not need to add any dependency at all…