1
0
Fork 1
mirror of https://github.com/NixOS/nixpkgs.git synced 2024-12-25 03:17:13 +00:00
nixpkgs/pkgs/development/tools/gotools/default.nix

45 lines
1.4 KiB
Nix
Raw Normal View History

2016-06-06 01:28:52 +01:00
{ stdenv, lib, go, buildGoPackage, fetchgit, fetchhg, fetchbzr, fetchsvn }:
buildGoPackage rec {
name = "gotools-${version}";
2017-11-03 20:02:05 +00:00
version = "20170807-${stdenv.lib.strings.substring 0 7 rev}";
rev = "5d2fd3ccab986d52112bf301d47a819783339d0e";
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";
2017-11-03 20:02:05 +00:00
sha256 = "0r3fp7na6pg0bc5xfycjvv951f0vma1qfnpw5zy6l75yxm5r47kn";
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
'';
}