From 2d934fdffb66ec60b9cd05d6e67a219e8db319e1 Mon Sep 17 00:00:00 2001 From: Franz Pletz Date: Sat, 29 Oct 2016 05:18:16 +0200 Subject: buildGoPackage: introduce extraSrcPaths option This option adds support for including sources from existing gopaths into the gopath of the package to build. --- pkgs/development/go-modules/generic/default.nix | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'pkgs/development/go-modules/generic') 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 -- cgit 1.4.1