nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{ lib, buildGoModule, fetchgit }:
2
3buildGoModule rec {
4 pname = "gotools";
5 version = "0.1.10";
6
7 src = fetchgit {
8 rev = "v${version}";
9 url = "https://go.googlesource.com/tools";
10 sha256 = "sha256-r71+//VhayW18uvMl/ls/8KYNbZ7uDZw3SWoqPL3Xqk=";
11 };
12
13 # The gopls folder contains a Go submodule which causes a build failure.
14 # Given that, we can't have the gopls binary be part of the gotools
15 # derivation.
16 #
17 # The attribute "gopls" provides the gopls binary.
18 #
19 # Related
20 #
21 # * https://github.com/NixOS/nixpkgs/pull/85868
22 # * https://github.com/NixOS/nixpkgs/issues/88716
23 postPatch = ''
24 rm -rf gopls
25 '';
26
27 vendorSha256 = "sha256-UJIXG8WKzazNTXoqEFlT/umC40F6z2Q5I8RfxnMbsPM=";
28
29 doCheck = false;
30
31 postConfigure = ''
32 # Make the builtin tools available here
33 mkdir -p $out/bin
34 eval $(go env | grep GOTOOLDIR)
35 find $GOTOOLDIR -type f | while read x; do
36 ln -sv "$x" "$out/bin"
37 done
38 export GOTOOLDIR=$out/bin
39 '';
40
41 excludedPackages = [ "vet" "cover" ];
42
43 # Set GOTOOLDIR for derivations adding this to buildInputs
44 postInstall = ''
45 mkdir -p $out/nix-support
46 substitute ${../../go-modules/tools/setup-hook.sh} $out/nix-support/setup-hook \
47 --subst-var-by bin $out
48 '';
49
50 # Do not copy this without a good reason for enabling
51 # In this case tools is heavily coupled with go itself and embeds paths.
52 allowGoReference = true;
53
54 meta = with lib; {
55 description = "Additional tools for Go development";
56 homepage = "http://go.googlesource.com/tools";
57 license = licenses.bsd3;
58 maintainers = with maintainers; [ danderson ];
59 };
60}