2021-01-25 09:26:54 +01:00
|
|
|
{ lib, buildGoModule, fetchgit }:
|
2016-06-06 02:28:52 +02:00
|
|
|
|
2019-03-09 00:14:33 +01:00
|
|
|
buildGoModule rec {
|
2019-08-15 14:41:18 +02:00
|
|
|
pname = "gotools-unstable";
|
2021-01-13 21:24:50 +01:00
|
|
|
version = "2021-01-13";
|
|
|
|
rev = "8b4aab62c064010e8e875d2e5a8e63a96fefc87d";
|
2016-06-06 02:28:52 +02:00
|
|
|
|
|
|
|
src = fetchgit {
|
|
|
|
inherit rev;
|
|
|
|
url = "https://go.googlesource.com/tools";
|
2021-01-13 21:24:50 +01:00
|
|
|
sha256 = "1cmnm9fl2a6hiplj8s6x0l3czcw4xh3j3lvzbgccnp1l8kz8q2vm";
|
2016-06-06 02:28:52 +02:00
|
|
|
};
|
|
|
|
|
2020-09-11 11:07:54 +02:00
|
|
|
# The gopls folder contains a Go submodule which causes a build failure.
|
2020-06-02 20:31:54 +02:00
|
|
|
# Given that, we can't have the gopls binary be part of the gotools
|
|
|
|
# derivation.
|
|
|
|
#
|
2020-09-11 11:08:04 +02:00
|
|
|
# The attribute "gopls" provides the gopls binary.
|
2020-06-02 20:31:54 +02:00
|
|
|
#
|
|
|
|
# Related
|
|
|
|
#
|
|
|
|
# * https://github.com/NixOS/nixpkgs/pull/85868
|
|
|
|
# * https://github.com/NixOS/nixpkgs/issues/88716
|
2019-07-05 13:11:13 +02:00
|
|
|
postPatch = ''
|
|
|
|
rm -rf gopls
|
|
|
|
'';
|
|
|
|
|
2020-10-29 04:51:18 +01:00
|
|
|
vendorSha256 = "18qpjmmjpk322fvf81cafkpl3spv7hpdpymhympmld9isgzggfyz";
|
2016-06-06 02:28:52 +02:00
|
|
|
|
2020-08-04 02:26:27 +02:00
|
|
|
doCheck = false;
|
|
|
|
|
2019-03-22 04:40:07 +01:00
|
|
|
postConfigure = ''
|
2016-06-06 02:28:52 +02:00
|
|
|
# Make the builtin tools available here
|
2019-03-09 00:14:33 +01:00
|
|
|
mkdir -p $out/bin
|
2016-06-06 02:28:52 +02:00
|
|
|
eval $(go env | grep GOTOOLDIR)
|
|
|
|
find $GOTOOLDIR -type f | while read x; do
|
2019-03-09 00:14:33 +01:00
|
|
|
ln -sv "$x" "$out/bin"
|
2016-06-06 02:28:52 +02:00
|
|
|
done
|
2019-03-09 00:14:33 +01:00
|
|
|
export GOTOOLDIR=$out/bin
|
2016-06-06 02:28:52 +02:00
|
|
|
'';
|
|
|
|
|
|
|
|
excludedPackages = "\\("
|
2021-01-23 13:26:19 +01:00
|
|
|
+ lib.concatStringsSep "\\|" ([ "testdata" "vet" "cover" ])
|
2016-06-06 02:28:52 +02:00
|
|
|
+ "\\)";
|
|
|
|
|
|
|
|
# Set GOTOOLDIR for derivations adding this to buildInputs
|
|
|
|
postInstall = ''
|
2019-03-09 00:14:33 +01:00
|
|
|
mkdir -p $out/nix-support
|
2020-01-21 06:09:11 +01:00
|
|
|
substitute ${../../go-modules/tools/setup-hook.sh} $out/nix-support/setup-hook \
|
|
|
|
--subst-var-by bin $out
|
2016-06-06 02:28:52 +02:00
|
|
|
'';
|
2019-03-09 00:14:33 +01: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 05:58:04 +02:00
|
|
|
}
|