summary refs log tree commit diff
path: root/pkgs/development/go-modules
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/development/go-modules')
-rw-r--r--pkgs/development/go-modules/generic/default.nix9
1 files changed, 8 insertions, 1 deletions
diff --git a/pkgs/development/go-modules/generic/default.nix b/pkgs/development/go-modules/generic/default.nix
index d4d2790b2a3..e076c6ca90e 100644
--- a/pkgs/development/go-modules/generic/default.nix
+++ b/pkgs/development/go-modules/generic/default.nix
@@ -1,4 +1,4 @@
-{ go, govers, parallel, lib, fetchgit, fetchhg }:
+{ go, govers, parallel, lib, fetchgit, fetchhg, rsync }:
 
 { name, buildInputs ? [], nativeBuildInputs ? [], passthru ? {}, preFixup ? ""
 
@@ -17,6 +17,10 @@
 # Extra sources to include in the gopath
 , extraSrcs ? [ ]
 
+# Extra gopaths containing src subfolder
+# with sources to include in the gopath
+, extraSrcPaths ? [ ]
+
 # go2nix dependency file
 , goDeps ? null
 
@@ -86,6 +90,9 @@ go.stdenv.mkDerivation (
     mv goPath/* "go/src/${goPackagePath}"
     rmdir goPath
 
+  '') + (lib.optionalString (extraSrcPaths != []) ''
+    ${rsync}/bin/rsync -a ${lib.concatMapStrings (p: "${p}/src") extraSrcPaths} go
+
   '') + ''
     export GOPATH=$NIX_BUILD_TOP/go:$GOPATH