mirror of
https://github.com/NixOS/nix
synced 2025-06-25 06:31:14 +02:00
* An quick and dirty hack to support distributed builds.
This commit is contained in:
parent
c8d3882cdc
commit
8c0b42f857
9 changed files with 92 additions and 13 deletions
|
@ -16,8 +16,10 @@ simple.sh: simple.nix
|
|||
dependencies.sh: dependencies.nix
|
||||
locking.sh: locking.nix
|
||||
parallel.sh: parallel.nix
|
||||
build-hook.sh: build-hook.nix
|
||||
|
||||
TESTS = init.sh simple.sh dependencies.sh locking.sh parallel.sh
|
||||
TESTS = init.sh simple.sh dependencies.sh locking.sh parallel.sh \
|
||||
build-hook.sh
|
||||
|
||||
XFAIL_TESTS =
|
||||
|
||||
|
@ -27,4 +29,5 @@ EXTRA_DIST = $(TESTS) \
|
|||
simple.nix.in simple.builder.sh \
|
||||
dependencies.nix.in dependencies.builder*.sh \
|
||||
locking.nix.in locking.builder.sh \
|
||||
parallel.nix.in parallel.builder.sh
|
||||
parallel.nix.in parallel.builder.sh \
|
||||
build-hook.nix.in
|
||||
|
|
17
tests/build-hook.hook.sh
Normal file
17
tests/build-hook.hook.sh
Normal file
|
@ -0,0 +1,17 @@
|
|||
set -x
|
||||
|
||||
drv=$1
|
||||
|
||||
echo "HOOK for $drv"
|
||||
|
||||
outPath=$(sed 's/Derive(\[\"\([^\"]*\)\".*/\1/' $drv)
|
||||
|
||||
echo "output path is $outPath"
|
||||
|
||||
if $(echo $outPath | grep -q input-1); then
|
||||
mkdir $outPath
|
||||
echo "BAR" > $outPath/foo
|
||||
exit 100
|
||||
fi
|
||||
|
||||
exit 101
|
25
tests/build-hook.nix.in
Normal file
25
tests/build-hook.nix.in
Normal file
|
@ -0,0 +1,25 @@
|
|||
let {
|
||||
|
||||
input1 = derivation {
|
||||
name = "dependencies-input-1";
|
||||
system = "@system@";
|
||||
builder = "@shell@";
|
||||
args = ["-e" "-x" ./dependencies.builder1.sh];
|
||||
};
|
||||
|
||||
input2 = derivation {
|
||||
name = "dependencies-input-2";
|
||||
system = "@system@";
|
||||
builder = "@shell@";
|
||||
args = ["-e" "-x" ./dependencies.builder2.sh];
|
||||
};
|
||||
|
||||
body = derivation {
|
||||
name = "dependencies";
|
||||
system = "@system@";
|
||||
builder = "@shell@";
|
||||
args = ["-e" "-x" ./dependencies.builder0.sh];
|
||||
inherit input1 input2;
|
||||
};
|
||||
|
||||
}
|
12
tests/build-hook.sh
Normal file
12
tests/build-hook.sh
Normal file
|
@ -0,0 +1,12 @@
|
|||
export NIX_BUILD_HOOK="sh build-hook.hook.sh"
|
||||
|
||||
storeExpr=$($TOP/src/nix-instantiate/nix-instantiate build-hook.nix)
|
||||
|
||||
echo "store expr is $storeExpr"
|
||||
|
||||
outPath=$($TOP/src/nix-store/nix-store -qnfvvvvv "$storeExpr")
|
||||
|
||||
echo "output path is $outPath"
|
||||
|
||||
text=$(cat "$outPath"/foobar)
|
||||
if test "$text" != "BARBAR"; then exit 1; fi
|
Loading…
Add table
Add a link
Reference in a new issue