monolith: enable nix cache over ssh
This commit is contained in:
parent
22dc422b63
commit
868496d2b9
5 changed files with 138 additions and 52 deletions
21
system/gitlab-runner/nix-cache-end
Executable file
21
system/gitlab-runner/nix-cache-end
Executable file
|
@ -0,0 +1,21 @@
|
|||
#!/bin/sh
|
||||
|
||||
echo "nix-cache: Storing new store items"
|
||||
NEW_NIX_STORE_CONTENTS_FILE=$(mktemp)
|
||||
find /nix/store/ -maxdepth 1 > $NEW_NIX_STORE_CONTENTS_FILE
|
||||
|
||||
sort $OLD_NIX_STORE_CONTENTS_FILE -o $OLD_NIX_STORE_CONTENTS_FILE
|
||||
sort $NEW_NIX_STORE_CONTENTS_FILE -o $NEW_NIX_STORE_CONTENTS_FILE
|
||||
|
||||
echo "nix-cache: Comparing store paths"
|
||||
FILTERED_NIX_STORE_CONTENTS_FILE=$(mktemp)
|
||||
comm -13 $OLD_NIX_STORE_CONTENTS_FILE $NEW_NIX_STORE_CONTENTS_FILE > $FILTERED_NIX_STORE_CONTENTS_FILE
|
||||
echo "nix-cache: New store paths:"
|
||||
cat $FILTERED_NIX_STORE_CONTENTS_FILE | sed 's/^/ /g'
|
||||
|
||||
if test -n "$(head -n1 $FILTERED_NIX_STORE_CONTENTS_FILE)"; then
|
||||
echo "nix-cache: Sending new paths to cache"
|
||||
nix copy --to "$STORE_URL" $(cat $FILTERED_NIX_STORE_CONTENTS_FILE) || true
|
||||
else
|
||||
echo "nix-cache: Nothing to send"
|
||||
fi
|
Loading…
Add table
Add a link
Reference in a new issue