Can't get overlay for buildGoModule to work

Hi,

I want to install vault-editor. It is not in the standard protonmail-bridge package so I thought an overlay would be a way to install it. I’ve created this overlay:

{ lib, pkgs, ... }:
{
  nixpkgs.overlays = [
    (final: _: {
      protonmail-vault-editor = final.protonmail-bridge.overrideAttrs (_: rec {
        pname = "vault-editor";
        makeFlags = [ "PREFIX=$(out)" "vault-editor" ];
        # installTargets = [ "vault-editor" ];
        subPackages = [ "utils/vault-editor" ];
        postInstall = ''
          ls -la
          mkdir $out/bin
          cp ${pname} $out/bin
         '';
      });
    })
  ];
}

But I can’t get it to compile vault-editor. The error message I get is:

Running phase: unpackPhase
@nix { "action": "setPhase", "phase": "unpackPhase" }
unpacking source archive /nix/store/mplj0v0f3qsy078rsjvbwmklk7qa8njq-source
source root is source
Running phase: patchPhase
@nix { "action": "setPhase", "phase": "patchPhase" }
Running phase: updateAutotoolsGnuConfigScriptsPhase
@nix { "action": "setPhase", "phase": "updateAutotoolsGnuConfigScriptsPhase" }
Running phase: configurePhase
@nix { "action": "setPhase", "phase": "configurePhase" }
Running phase: buildPhase
@nix { "action": "setPhase", "phase": "buildPhase" }
patching script interpreter paths in ./utils/
./utils/missing_license.sh: interpreter directive changed from "#!/bin/bash" to "/nix/store/fwr62xmh06l8y8zfgc5m18pfap9b8az0-bash-5.3p3/bin/bash"
./utils/credits.sh: interpreter directive changed from "#!/bin/bash" to "/nix/store/fwr62xmh06l8y8zfgc5m18pfap9b8az0-bash-5.3p3/bin/bash"
./utils/release_notes.sh: interpreter directive changed from "#!/bin/bash" to "/nix/store/fwr62xmh06l8y8zfgc5m18pfap9b8az0-bash-5.3p3/bin/bash"
./utils/dependency_license.sh: interpreter directive changed from "#!/bin/bash" to "/nix/store/fwr62xmh06l8y8zfgc5m18pfap9b8az0-bash-5.3p3/bin/bash"
./utils/get_revision.sh: interpreter directive changed from "#!/usr/bin/env bash" to "/nix/store/fwr62xmh06l8y8zfgc5m18pfap9b8az0-bash-5.3p3/bin/bash"
./utils/bridge_app_version.sh: interpreter directive changed from "#!/bin/sh" to "/nix/store/fwr62xmh06l8y8zfgc5m18pfap9b8az0-bash-5.3p3/bin/sh"
./utils/remove_non_relative_links_darwin.sh: interpreter directive changed from "#!/bin/bash" to "/nix/store/fwr62xmh06l8y8zfgc5m18pfap9b8az0-bash-5.3p3/bin/bash"
./utils/coverage.sh: interpreter directive changed from "#!/usr/bin/env bash" to "/nix/store/fwr62xmh06l8y8zfgc5m18pfap9b8az0-bash-5.3p3/bin/bash"
./utils/govulncheck.sh: interpreter directive changed from "#!/usr/bin/env bash" to "/nix/store/fwr62xmh06l8y8zfgc5m18pfap9b8az0-bash-5.3p3/bin/bash"
./utils/changelog_linter.sh: interpreter directive changed from "#!/bin/bash" to "/nix/store/fwr62xmh06l8y8zfgc5m18pfap9b8az0-bash-5.3p3/bin/bash"
Building subPackage ./utils/vault-editor
package github.com/ProtonMail/proton-bridge/v3/utils/vault-editor: build constraints exclude all Go files in /build/source/utils/vault-editor
Running phase: checkPhase
@nix { "action": "setPhase", "phase": "checkPhase" }
# github.com/ProtonMail/proton-bridge/v3/utils/vault-editor
package github.com/ProtonMail/proton-bridge/v3/utils/vault-editor: build constraints exclude all Go files in /build/source/utils/vault-editor
FAIL    github.com/ProtonMail/proton-bridge/v3/utils/vault-editor [setup failed]
FAIL
Running phase: glibPreInstallPhase
@nix { "action": "setPhase", "phase": "glibPreInstallPhase" }
Running phase: installPhase
@nix { "action": "setPhase", "phase": "installPhase" }
total 263
drwxr-xr-x 13 nixbld nixbld     29 Feb  9 16:56 .
drwx------  4 nixbld nixbld      5 Feb  9 16:56 ..
-rw-r--r--  1 nixbld nixbld     26 Jan  1  1970 .gitattributes
-rw-r--r--  1 nixbld nixbld    576 Jan  1  1970 .gitignore
drwxr-xr-x  2 nixbld nixbld      3 Jan  1  1970 .gitlab
-rw-r--r--  1 nixbld nixbld   1469 Jan  1  1970 .gitlab-ci.yml
-rw-r--r--  1 nixbld nixbld     98 Jan  1  1970 .gitmodules
-rw-r--r--  1 nixbld nixbld   9969 Jan  1  1970 .golangci.yml
-rw-r--r--  1 nixbld nixbld    131 Jan  1  1970 .grype.yaml
-rw-r--r--  1 nixbld nixbld   3052 Jan  1  1970 BUILDS.md
-rw-r--r--  1 nixbld nixbld   5048 Jan  1  1970 CONTRIBUTING.md
-rw-r--r--  1 nixbld nixbld  18282 Jan  1  1970 COPYING_NOTES.md
-rw-r--r--  1 nixbld nixbld 122092 Jan  1  1970 Changelog.md
-rw-r--r--  1 nixbld nixbld  32473 Jan  1  1970 LICENSE
-rw-r--r--  1 nixbld nixbld  16157 Jan  1  1970 Makefile
-rw-r--r--  1 nixbld nixbld   4695 Jan  1  1970 README.md
-rw-r--r--  1 nixbld nixbld    141 Jan  1  1970 TODO.md
drwxr-xr-x  2 nixbld nixbld      8 Jan  1  1970 ci
drwxr-xr-x  4 nixbld nixbld      4 Jan  1  1970 cmd
drwxr-xr-x  3 nixbld nixbld      9 Jan  1  1970 dist
drwxr-xr-x  3 nixbld nixbld      3 Jan  1  1970 extern
-rw-r--r--  1 nixbld nixbld   6809 Jan  1  1970 go.mod
-rw-r--r--  1 nixbld nixbld  72719 Jan  1  1970 go.sum
drwxr-xr-x 35 nixbld nixbld     36 Jan  1  1970 internal
drwxr-xr-x 14 nixbld nixbld     14 Jan  1  1970 pkg
drwxr-xr-x  2 nixbld nixbld      4 Jan  1  1970 release-notes
drwxr-xr-x  7 nixbld nixbld     34 Jan  1  1970 tests
drwxr-xr-x 14 nixbld nixbld     33 Jan  1  1970 utils
dr-xr-xr-x 11 nixbld nixbld     12 Feb  9 16:56 vendor
cp: cannot stat 'vault-editor': No such file or directory

Of course the error of the cp command is expected, but I don’t understand the error package github.com/ProtonMail/proton-bridge/v3/utils/vault-editor: build constraints exclude all Go files in /build/source/utils/vault-editor.

Is this a good approach to build vault-editor and what should I do to get it compiled?

It was a issue with go itself, the main.go file had a debug tag which prevented it from building. This overlay solved the issue:

    (final: _: {
      protonmail-vault-editor = final.protonmail-bridge.overrideAttrs (_: {
        pname = "vault-editor";
        subPackages = [ "utils/vault-editor" ];
        tags = [ "debug" ];
        postInstall = "";
      });
    })