2020-04-13 03:49:48 +01:00
|
|
|
{ stdenv, go, buildGoModule, fetchgit }:
|
2016-06-06 01:28:52 +01:00
|
|
|
|
2019-03-08 23:14:33 +00:00
|
|
|
buildGoModule rec {
|
2019-08-15 13:41:18 +01:00
|
|
|
pname = "gotools-unstable";
|
2020-10-29 03:51:18 +00:00
|
|
|
version = "2020-10-27";
|
|
|
|
rev = "eafbe7b904eb2418efc832e36ac634dc09084f10";
|
2016-06-06 01:28:52 +01:00
|
|
|
|
|
|
|
src = fetchgit {
|
|
|
|
inherit rev;
|
|
|
|
url = "https://go.googlesource.com/tools";
|
2020-10-29 03:51:18 +00:00
|
|
|
sha256 = "0884znfbm44f4ddjkm0g7qg2a257kwzv1ismd2m225f3c69n3mdg";
|
2016-06-06 01:28:52 +01:00
|
|
|
};
|
|
|
|
|
2020-09-11 10:07:54 +01:00
|
|
|
# The gopls folder contains a Go submodule which causes a build failure.
|
2020-06-02 19:31:54 +01:00
|
|
|
# Given that, we can't have the gopls binary be part of the gotools
|
|
|
|
# derivation.
|
|
|
|
#
|
2020-09-11 10:08:04 +01:00
|
|
|
# The attribute "gopls" provides the gopls binary.
|
2020-06-02 19:31:54 +01:00
|
|
|
#
|
|
|
|
# Related
|
|
|
|
#
|
|
|
|
# * https://github.com/NixOS/nixpkgs/pull/85868
|
|
|
|
# * https://github.com/NixOS/nixpkgs/issues/88716
|
2019-07-05 12:11:13 +01:00
|
|
|
postPatch = ''
|
|
|
|
rm -rf gopls
|
|
|
|
'';
|
|
|
|
|
2020-10-29 03:51:18 +00:00
|
|
|
vendorSha256 = "18qpjmmjpk322fvf81cafkpl3spv7hpdpymhympmld9isgzggfyz";
|
2016-06-06 01:28:52 +01:00
|
|
|
|
2020-08-04 01:26:27 +01:00
|
|
|
doCheck = false;
|
|
|
|
|
2019-03-22 03:40:07 +00:00
|
|
|
postConfigure = ''
|
2016-06-06 01:28:52 +01:00
|
|
|
# Make the builtin tools available here
|
2019-03-08 23:14:33 +00:00
|
|
|
mkdir -p $out/bin
|
2016-06-06 01:28:52 +01:00
|
|
|
eval $(go env | grep GOTOOLDIR)
|
|
|
|
find $GOTOOLDIR -type f | while read x; do
|
2019-03-08 23:14:33 +00:00
|
|
|
ln -sv "$x" "$out/bin"
|
2016-06-06 01:28:52 +01:00
|
|
|
done
|
2019-03-08 23:14:33 +00:00
|
|
|
export GOTOOLDIR=$out/bin
|
2016-06-06 01:28:52 +01:00
|
|
|
'';
|
|
|
|
|
|
|
|
excludedPackages = "\\("
|
|
|
|
+ stdenv.lib.concatStringsSep "\\|" ([ "testdata" ] ++ stdenv.lib.optionals (stdenv.lib.versionAtLeast go.meta.branch "1.5") [ "vet" "cover" ])
|
|
|
|
+ "\\)";
|
|
|
|
|
|
|
|
# Set GOTOOLDIR for derivations adding this to buildInputs
|
|
|
|
postInstall = ''
|
2019-03-08 23:14:33 +00:00
|
|
|
mkdir -p $out/nix-support
|
2020-01-21 05:09:11 +00:00
|
|
|
substitute ${../../go-modules/tools/setup-hook.sh} $out/nix-support/setup-hook \
|
|
|
|
--subst-var-by bin $out
|
2016-06-06 01:28:52 +01:00
|
|
|
'';
|
2019-03-08 23:14:33 +00:00
|
|
|
|
|
|
|
# Do not copy this without a good reason for enabling
|
|
|
|
# In this case tools is heavily coupled with go itself and embeds paths.
|
|
|
|
allowGoReference = true;
|
2020-07-31 04:58:04 +01:00
|
|
|
}
|