mirror of
https://github.com/NixOS/nix
synced 2025-06-25 02:21:16 +02:00
parent
1e2b26734b
commit
2e12b58126
20 changed files with 106 additions and 71 deletions
|
@ -1,3 +1,5 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
source common.sh
|
||||
|
||||
file=build-hook.nix
|
||||
|
@ -11,17 +13,17 @@ registerBuildHook () {
|
|||
# Dummy post-build-hook just to ensure that it's executed correctly.
|
||||
# (we can't reuse the one from `$PWD/push-to-store.sh` because of
|
||||
# https://github.com/NixOS/nix/issues/4341)
|
||||
cat <<EOF > $TEST_ROOT/post-build-hook.sh
|
||||
cat <<EOF > "$TEST_ROOT/post-build-hook.sh"
|
||||
#!/bin/sh
|
||||
|
||||
echo "Post hook ran successfully"
|
||||
# Add an empty line to a counter file, just to check that this hook ran properly
|
||||
echo "" >> $TEST_ROOT/post-hook-counter
|
||||
EOF
|
||||
chmod +x $TEST_ROOT/post-build-hook.sh
|
||||
rm -f $TEST_ROOT/post-hook-counter
|
||||
chmod +x "$TEST_ROOT/post-build-hook.sh"
|
||||
rm -f "$TEST_ROOT/post-hook-counter"
|
||||
|
||||
echo "post-build-hook = $TEST_ROOT/post-build-hook.sh" >> $NIX_CONF_DIR/nix.conf
|
||||
echo "post-build-hook = $TEST_ROOT/post-build-hook.sh" >> "$NIX_CONF_DIR/nix.conf"
|
||||
}
|
||||
|
||||
registerBuildHook
|
||||
|
@ -30,4 +32,4 @@ source build-remote.sh
|
|||
# `build-hook.nix` has four derivations to build, and the hook runs twice for
|
||||
# each derivation (once on the builder and once on the host), so the counter
|
||||
# should contain eight lines now
|
||||
[[ $(cat $TEST_ROOT/post-hook-counter | wc -l) -eq 8 ]]
|
||||
[[ $(wc -l < "$TEST_ROOT/post-hook-counter") -eq 8 ]]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue