buildGoModule and GOPRIVATE? - Nix

Welcome to the Functional Programming Zulip Chat Archive. You can join the chat here.

Magnus Therning

I'm looking for a way to get buildGoModule to work with private repos. The naive approach of just setting it like this:

  thePkg = buildGoModule rec {
    pname = name;
    version = "0.0.1";
    src = lib.cleanSource ./.;
    vendorSha256 = lib.fakeSha256;

    GOPRIVATE = "<user>/*'';

doesn't seem to work.

Does anyone know if it's even supported?

Magnus Therning

This works, but is there no nicer way?

    overrideModAttrs = _: {
        preBuild = ''
            export HOME=$(pwd)
            cat <<EOF > $HOME/.gitconfig
            [url "https://${github_token}<org>"]df
                insteadOf = "<org>"
            export GOPRIVATE="<org>/*"