about summary refs log tree commit diff
path: root/nix
diff options
context:
space:
mode:
authoredef <edef@edef.eu>2020-08-03T18·38+0000
committeredef <edef@edef.eu>2020-08-04T07·42+0000
commitc3546c5f9c1733e8b7a7b9e6ed811b8aea5a45c9 (patch)
tree994995451e5033b6484a86aa9d443531073e9782 /nix
parentcf35ad4fa96ad9fe5833e571ebb8fec221c7b6e5 (diff)
feat(nix/buildGo): expose gopkg attribute on buildGo.package r/1578
This makes the derivations more uniform, since both third-party
packages generated by buildGo.external and native buildGo.package
expose their libraries as gopkg attributes now.

Change-Id: I547f9860082f36e3300139bf67613eb4fc600d24
Reviewed-on: https://cl.tvl.fyi/c/depot/+/1623
Tested-by: BuildkiteCI
Reviewed-by: tazjin <mail@tazj.in>
Diffstat (limited to 'nix')
-rw-r--r--nix/buildGo/default.nix20
1 files changed, 13 insertions, 7 deletions
diff --git a/nix/buildGo/default.nix b/nix/buildGo/default.nix
index 03c0b2bc4b9d..5346b06ebd73 100644
--- a/nix/buildGo/default.nix
+++ b/nix/buildGo/default.nix
@@ -82,13 +82,19 @@ let
     asmPack = ifAsm ''
       ${go}/bin/go tool pack r $out/${path}.a ./asm.o
     '';
-  in (runCommand "golib-${name}" {} ''
-    mkdir -p $out/${path}
-    ${srcList path (map (s: "${s}") srcs)}
-    ${asmBuild}
-    ${go}/bin/go tool compile -pack ${asmLink} -o $out/${path}.a -trimpath=$PWD -trimpath=${go} -p ${path} ${includeSources uniqueDeps} ${spaceOut srcs}
-    ${asmPack}
-  '') // { goDeps = uniqueDeps; goImportPath = path; };
+
+    gopkg = (runCommand "golib-${name}" {} ''
+      mkdir -p $out/${path}
+      ${srcList path (map (s: "${s}") srcs)}
+      ${asmBuild}
+      ${go}/bin/go tool compile -pack ${asmLink} -o $out/${path}.a -trimpath=$PWD -trimpath=${go} -p ${path} ${includeSources uniqueDeps} ${spaceOut srcs}
+      ${asmPack}
+    '') // {
+      inherit gopkg;
+      goDeps = uniqueDeps;
+      goImportPath = path;
+    };
+  in gopkg;
 
   # Build a tree of Go libraries out of an external Go source
   # directory that follows the standard Go layout and was not built