From f247481b5dc10a25970f4a44b66628166e56f4b9 Mon Sep 17 00:00:00 2001 From: "William A. Kennington III" Date: Wed, 20 May 2015 02:34:00 -0700 Subject: [PATCH] buildGoPackage: Only install files from the goPackagePath --- pkgs/development/go-modules/generic/default.nix | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/pkgs/development/go-modules/generic/default.nix b/pkgs/development/go-modules/generic/default.nix index 353956e4863..f747ade72f2 100644 --- a/pkgs/development/go-modules/generic/default.nix +++ b/pkgs/development/go-modules/generic/default.nix @@ -113,12 +113,12 @@ go.stdenv.mkDerivation ( mkdir -p $out if [ -z "$dontInstallSrc" ]; then - local dir - for d in pkg src; do - mkdir -p $out/share/go - dir="$NIX_BUILD_TOP/go/$d" - [ -e "$dir" ] && cp -r $dir $out/share/go - done + (cd "$NIX_BUILD_TOP/go" + find . -type f | while read f; do + echo "$f" | grep -q '^./\(src\|pkg/[^/]*\)/${goPackagePath}' || continue + mkdir -p "$(dirname "$out/share/go/$f")" + cp $NIX_BUILD_TOP/go/$f $out/share/go/$f + done) fi dir="$NIX_BUILD_TOP/go/bin"