about summary refs log tree commit diff
path: root/pkgs
diff options
context:
space:
mode:
authorNick Cao <nickcao@nichi.co>2024-01-14 11:14:20 -0500
committerGitHub <noreply@github.com>2024-01-14 11:14:20 -0500
commit1e481992643f8cbb6de9d8ab220bbbfbca00e3f9 (patch)
tree19fc514dd1e1a498a280c0830dd2988f66cdd937 /pkgs
parent5dd94ac2d7d685497611bb7d00bb149d525216a3 (diff)
parentea633d632d542c4f5a2c56bb9c80d864c8e80fdc (diff)
Merge pull request #279620 from SuperSandro2000/go-licenses-fix
go-licenses: fix returning empty output when GOROOT differs from built environment
Diffstat (limited to 'pkgs')
-rw-r--r--pkgs/development/tools/misc/go-licenses/default.nix12
1 files changed, 12 insertions, 0 deletions
diff --git a/pkgs/development/tools/misc/go-licenses/default.nix b/pkgs/development/tools/misc/go-licenses/default.nix
index c9bc25973a4e3..d6bea02c05bd1 100644
--- a/pkgs/development/tools/misc/go-licenses/default.nix
+++ b/pkgs/development/tools/misc/go-licenses/default.nix
@@ -1,7 +1,9 @@
 { lib
 , buildGoModule
 , fetchFromGitHub
+, go
 , installShellFiles
+, makeWrapper
 }:
 
 buildGoModule rec {
@@ -26,13 +28,23 @@ buildGoModule rec {
 
   nativeBuildInputs = [
     installShellFiles
+    makeWrapper
   ];
 
+  subPackages = [ "." ];
+
+  allowGoReference = true;
+
   postInstall = ''
     installShellCompletion --cmd go-licenses \
       --bash <("$out/bin/go-licenses" completion bash) \
       --fish <("$out/bin/go-licenses" completion fish) \
       --zsh  <("$out/bin/go-licenses" completion zsh)
+
+    # workaround empty output when GOROOT differs from built environment
+    # see https://github.com/google/go-licenses/issues/149
+    wrapProgram "$out/bin/go-licenses" \
+      --set GOROOT '${go}/share/go'
   '';
 
   # Tests require internet connection