1
0
Fork 0

Copy source tree to non-nix-builder build directory and cd to the right spot

master
Michael Raitza 2021-02-17 14:06:04 +01:00
parent 034aa74e81
commit e6729e269f
1 changed files with 6 additions and 2 deletions

View File

@ -23,12 +23,16 @@ let
then imported.value
else {
src = filterSource
(path: type: type != "directory" || (baseNameOf path != ".git" && (all (x: path != x) filter)))
(path: type: baseNameOf path != ".git" && baseNameOf path != ".envrc" && (all (x: path != x) filter))
(/. + root);
builder = ''
builder = let
relPath = dirOf (removePrefix (root + "/") builder);
in ''
#!/bin/sh
set -e
pout=$(mktemp -u -p $PWD)
cp -r --reflink=auto --no-preserve=mode "$src/" src
cd src/${relPath}
${/. + builder} $d1 $d2 $out >$pout
if [ -e $out -a -s $pout ]; then
printf "Error: %s wrote to stdout and created \$3\n" "$d1" >&2