Merge pull request #2995 from tweag/post-build-hook

Add a post build hook
This commit is contained in:
Eelco Dolstra 2019-08-07 15:02:29 +02:00 committed by GitHub
commit 56df30cd3f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
13 changed files with 337 additions and 4 deletions

View file

@ -17,6 +17,7 @@ let {
builder = ./dependencies.builder0.sh + "/FOOBAR/../.";
input1 = input1 + "/.";
input2 = "${input2}/.";
input1_drv = input1;
meta.description = "Random test package";
};

View file

@ -28,7 +28,8 @@ nix_tests = \
check.sh \
plugins.sh \
search.sh \
nix-copy-ssh.sh
nix-copy-ssh.sh \
post-hook.sh
# parallel.sh
install-tests += $(foreach x, $(nix_tests), tests/$(x))

15
tests/post-hook.sh Normal file
View file

@ -0,0 +1,15 @@
source common.sh
clearStore
export REMOTE_STORE=$TEST_ROOT/remote_store
# Build the dependencies and push them to the remote store
nix-build dependencies.nix --post-build-hook $PWD/push_to_store.sh
clearStore
# Ensure that we the remote store contains both the runtime and buildtime
# closure of what we've just built
nix copy --from "$REMOTE_STORE" --no-require-sigs -f dependencies.nix
nix copy --from "$REMOTE_STORE" --no-require-sigs -f dependencies.nix input1_drv

4
tests/push_to_store.sh Executable file
View file

@ -0,0 +1,4 @@
#!/bin/sh
echo Pushing "$@" to "$REMOTE_STORE"
echo -n "$OUT_PATHS" | xargs -d: nix copy --to "$REMOTE_STORE" --no-require-sigs