Skip to content

Commit

Permalink
buildGoPackage: introduce extraSrcPaths option
Browse files Browse the repository at this point in the history
This option adds support for including sources from existing gopaths into
the gopath of the package to build.
  • Loading branch information
fpletz committed Oct 29, 2016
1 parent ff04adf commit 2d934fd
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion pkgs/development/go-modules/generic/default.nix
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{ go, govers, parallel, lib, fetchgit, fetchhg }:
{ go, govers, parallel, lib, fetchgit, fetchhg, rsync }:

{ name, buildInputs ? [], nativeBuildInputs ? [], passthru ? {}, preFixup ? ""

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

Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 2d934fd

Please sign in to comment.