3
0
Fork 0
forked from mirrors/nixpkgs

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:
Franz Pletz 2016-10-29 05:18:16 +02:00
parent ff04adf871
commit 2d934fdffb
No known key found for this signature in database
GPG key ID: 846FDED7792617B4

View file

@ -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