buildGoPackage: introduce extraSrcPaths option
This option adds support for including sources from existing gopaths into the gopath of the package to build.
This commit is contained in:
parent
ff04adf871
commit
2d934fdffb
@ -1,4 +1,4 @@
|
|||||||
{ go, govers, parallel, lib, fetchgit, fetchhg }:
|
{ go, govers, parallel, lib, fetchgit, fetchhg, rsync }:
|
||||||
|
|
||||||
{ name, buildInputs ? [], nativeBuildInputs ? [], passthru ? {}, preFixup ? ""
|
{ name, buildInputs ? [], nativeBuildInputs ? [], passthru ? {}, preFixup ? ""
|
||||||
|
|
||||||
@ -17,6 +17,10 @@
|
|||||||
# Extra sources to include in the gopath
|
# Extra sources to include in the gopath
|
||||||
, extraSrcs ? [ ]
|
, extraSrcs ? [ ]
|
||||||
|
|
||||||
|
# Extra gopaths containing src subfolder
|
||||||
|
# with sources to include in the gopath
|
||||||
|
, extraSrcPaths ? [ ]
|
||||||
|
|
||||||
# go2nix dependency file
|
# go2nix dependency file
|
||||||
, goDeps ? null
|
, goDeps ? null
|
||||||
|
|
||||||
@ -86,6 +90,9 @@ go.stdenv.mkDerivation (
|
|||||||
mv goPath/* "go/src/${goPackagePath}"
|
mv goPath/* "go/src/${goPackagePath}"
|
||||||
rmdir goPath
|
rmdir goPath
|
||||||
|
|
||||||
|
'') + (lib.optionalString (extraSrcPaths != []) ''
|
||||||
|
${rsync}/bin/rsync -a ${lib.concatMapStrings (p: "${p}/src") extraSrcPaths} go
|
||||||
|
|
||||||
'') + ''
|
'') + ''
|
||||||
export GOPATH=$NIX_BUILD_TOP/go:$GOPATH
|
export GOPATH=$NIX_BUILD_TOP/go:$GOPATH
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user