A hack, but works to bring in SSH access and configuring go/git to fetch private dependencies. Is there a better way?
package = with pkgs; buildGoModule {
pname = "project";
version = "local";
src = nix-gitignore.gitignoreSource [] ./.;
goPackagePath = "path/to/project";
subPackages = [ "cmd/thing" ];
~ vendorSha256 = "sha256-EtmOMdxN1/bI1ySaQNsy2SBFIu5htDxzWHPjzGb5ynQ=";
overrideModAttrs = old: {
preBuild = ''
export HOME=$(pwd)
cat <<EOF > $HOME/.gitconfig
~ [url "git@gitlab.company.com:"]
~ insteadOf = "https://gitlab.company.com/"
EOF
~ export GOPRIVATE="company.com"
export GIT_SSH_COMMAND="${pkgs.openssh}/bin/ssh -o StrictHostKeyChecking=no"
'';
impureEnvVars = lib.fetchers.proxyImpureEnvVars ++ [
"GIT_PROXY_COMMAND" "SOCKS_SERVER" "SSH_AUTH_SOCK"
];
};
buildInputs = dependencies;
nativeBuildInputs = [
pkgconfig
];
};