Skip to content

Instantly share code, notes, and snippets.

@colemickens
Last active November 30, 2018 11:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save colemickens/a4f366e65a25b479e322f92a95be794a to your computer and use it in GitHub Desktop.
Save colemickens/a4f366e65a25b479e322f92a95be794a to your computer and use it in GitHub Desktop.
#!/usr/bin/env bash
set -euo pipefail
set -x
CACHE_PTH="/tmp/localstore/"
CACHE_STORE="file://${CACHE_PTH}"
mkdir -p ${CACHE_PTH}
export NIX_REMOTE="ssh-ng://root@kix.cluster.lol"
# capture all the built paths
builtPaths="/nix/store/7ca2vsy9s7qqbimj5a6bblqw7p1jml0x-chromium-dev-72.0.3608.4" #builtPaths="$(nix-build "${@}")"
# foreach built path, copy it to the "cache-store" on remote
echo "${builtPaths}" | while read -r pth1; do
ssh root@kix.cluster.lol \
nix copy "${pth1}" --to "${CACHE_STORE}"
done
# sync "cache-store" to local machine
rsync -hiva --progress "root@kix.cluster.lol:${CACHE_PTH}" "${CACHE_PTH}"
cd "${CACHE_PTH}"
for f1 in *.narinfo; do
f2="$(cat "${f1}" | grep StorePath | cut -d' ' -f2)"
nix copy --from "${CACHE_STORE}" ${f2} --no-check-sigs
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment