3
0
Fork 0
forked from mirrors/nixpkgs
nixpkgs/pkgs/development/tools/gotools/default.nix

45 lines
1.3 KiB
Nix
Raw Normal View History

{ stdenv, go, buildGoPackage, fetchgit }:
2016-06-06 01:28:52 +01:00
buildGoPackage rec {
2018-07-21 11:30:02 +01:00
name = "gotools-unstable-${version}";
2018-09-16 17:21:05 +01:00
version = "2018-09-11";
rev = "677d2ff680c188ddb7dcd2bfa6bc7d3f2f2f75b2";
2016-06-06 01:28:52 +01:00
goPackagePath = "golang.org/x/tools";
goPackageAliases = [ "code.google.com/p/go.tools" ];
src = fetchgit {
inherit rev;
url = "https://go.googlesource.com/tools";
2018-09-16 17:21:05 +01:00
sha256 = "0vp1w1haqcjd82dxd6x9xrllbfwvm957rxwkpji96cgvhsli2bq5";
2016-06-06 01:28:52 +01:00
};
goDeps = ./deps.nix;
2016-06-06 01:28:52 +01:00
preConfigure = ''
# Make the builtin tools available here
mkdir -p $bin/bin
eval $(go env | grep GOTOOLDIR)
find $GOTOOLDIR -type f | while read x; do
ln -sv "$x" "$bin/bin"
done
export GOTOOLDIR=$bin/bin
'';
excludedPackages = "\\("
+ stdenv.lib.concatStringsSep "\\|" ([ "testdata" ] ++ stdenv.lib.optionals (stdenv.lib.versionAtLeast go.meta.branch "1.5") [ "vet" "cover" ])
+ "\\)";
# 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;
# Set GOTOOLDIR for derivations adding this to buildInputs
postInstall = ''
mkdir -p $bin/nix-support
substituteAll ${../../go-modules/tools/setup-hook.sh} $bin/nix-support/setup-hook.tmp
cat $bin/nix-support/setup-hook.tmp >> $bin/nix-support/setup-hook
rm $bin/nix-support/setup-hook.tmp
'';
}