Skip to content

Commit

Permalink
Merge pull request #94 from nix-community/rsync-vendor
Browse files Browse the repository at this point in the history
builder: Use rsync for copying vendor environment
  • Loading branch information
adisbladis authored Sep 6, 2022
2 parents cc75990 + 3b40762 commit 89cd067
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions builder/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
, runtimeShell
, writeScript
, gomod2nix
, rsync
}:
let

Expand Down Expand Up @@ -181,6 +182,8 @@ let

CGO_ENABLED = attrs.CGO_ENABLED or go.CGO_ENABLED;

nativeBuildInputs = [ rsync ];

propagatedBuildInputs = [ go ];

GO_NO_VENDOR_CHECKS = "1";
Expand All @@ -204,7 +207,8 @@ let
cp ${pwd + "/go.sum"} source/go.sum
cp ${pwd + "/tools.go"} source/tools.go
cd source
cp -rL ${vendorEnv} vendor
rsync -a -K --ignore-errors ${vendorEnv}/ vendor
${internal.install}
'';
Expand Down Expand Up @@ -259,7 +263,7 @@ let
} // optionalAttrs (hasAttr "subPackages" modulesStruct) {
subPackages = modulesStruct.subPackages;
} // attrs // {
nativeBuildInputs = [ go ] ++ nativeBuildInputs;
nativeBuildInputs = [ rsync go ] ++ nativeBuildInputs;

inherit (go) GOOS GOARCH;

Expand All @@ -281,7 +285,7 @@ let
${optionalString (modulesStruct != { }) ''
if [ -n "${vendorEnv}" ]; then
rm -rf vendor
cp -rL ${vendorEnv} vendor
rsync -a -K --ignore-errors ${vendorEnv}/ vendor
fi
''}
Expand Down

0 comments on commit 89cd067

Please sign in to comment.