nixpkgs/pkgs/development/tools/gotools/default.nix

61 lines
1.6 KiB
Nix
Raw Normal View History

{ lib, buildGoModule, fetchgit }:
2016-06-06 00:28:52 +00:00
buildGoModule rec {
pname = "gotools";
version = "0.1.10";
2016-06-06 00:28:52 +00:00
src = fetchgit {
rev = "v${version}";
2016-06-06 00:28:52 +00:00
url = "https://go.googlesource.com/tools";
sha256 = "sha256-r71+//VhayW18uvMl/ls/8KYNbZ7uDZw3SWoqPL3Xqk=";
2016-06-06 00:28:52 +00:00
};
# The gopls folder contains a Go submodule which causes a build failure.
# Given that, we can't have the gopls binary be part of the gotools
# derivation.
#
# The attribute "gopls" provides the gopls binary.
#
# Related
#
# * https://github.com/NixOS/nixpkgs/pull/85868
# * https://github.com/NixOS/nixpkgs/issues/88716
2019-07-05 11:11:13 +00:00
postPatch = ''
rm -rf gopls
'';
vendorSha256 = "sha256-UJIXG8WKzazNTXoqEFlT/umC40F6z2Q5I8RfxnMbsPM=";
2016-06-06 00:28:52 +00:00
doCheck = false;
postConfigure = ''
2016-06-06 00:28:52 +00:00
# Make the builtin tools available here
mkdir -p $out/bin
2016-06-06 00:28:52 +00:00
eval $(go env | grep GOTOOLDIR)
find $GOTOOLDIR -type f | while read x; do
ln -sv "$x" "$out/bin"
2016-06-06 00:28:52 +00:00
done
export GOTOOLDIR=$out/bin
2016-06-06 00:28:52 +00:00
'';
excludedPackages = [ "vet" "cover" ];
2016-06-06 00:28:52 +00:00
# Set GOTOOLDIR for derivations adding this to buildInputs
postInstall = ''
mkdir -p $out/nix-support
substitute ${./setup-hook.sh} $out/nix-support/setup-hook \
--subst-var-by bin $out
2016-06-06 00:28:52 +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;
meta = with lib; {
description = "Additional tools for Go development";
homepage = "http://go.googlesource.com/tools";
license = licenses.bsd3;
maintainers = with maintainers; [ danderson ];
};
}