3
0
Fork 0
forked from mirrors/nixpkgs
nixpkgs/pkgs/development/tools/gotools/default.nix
2019-03-14 10:31:15 -07:00

42 lines
1.3 KiB
Nix

{ stdenv, go, buildGoModule, fetchgit }:
buildGoModule rec {
name = "gotools-unstable-${version}";
version = "2019-03-05";
rev = "00c44ba9c14f88ffdd4fb5bfae57fe8dd6d6afb1";
src = fetchgit {
inherit rev;
url = "https://go.googlesource.com/tools";
sha256 = "04rpdi52j26szx5kiyfmwad1sg7lfplxrkbwkr3b1kfafh1whgw5";
};
modSha256 = "12klgqm2px878lzh05yzj6lr83v7vg0vv2k69pmg6nv1wlsxdlzf";
preConfigure = ''
# Make the builtin tools available here
mkdir -p $out/bin
eval $(go env | grep GOTOOLDIR)
find $GOTOOLDIR -type f | while read x; do
ln -sv "$x" "$out/bin"
done
export GOTOOLDIR=$out/bin
'';
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 = ''
mkdir -p $out/nix-support
substituteAll ${../../go-modules/tools/setup-hook.sh} $out/nix-support/setup-hook.tmp
cat $out/nix-support/setup-hook.tmp >> $out/nix-support/setup-hook
rm $out/nix-support/setup-hook.tmp
'';
# 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;
}