Skip to content

Instantly share code, notes, and snippets.

@colemickens
Last active November 30, 2018 11:01

Revisions

  1. colemickens revised this gist Nov 30, 2018. 1 changed file with 6 additions and 5 deletions.
    11 changes: 6 additions & 5 deletions nix-build-remote
    Original file line number Diff line number Diff line change
    @@ -19,8 +19,9 @@ done

    # sync "cache-store" to local machine
    rsync -hiva --progress "root@kix.cluster.lol:${CACHE_PTH}" "${CACHE_PTH}"

    # import all from our local cache thing
    unset NIX_REMOTE
    nix copy --from "${CACHE_STORE}" --all --no-check-sigs


    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
  2. colemickens created this gist Nov 30, 2018.
    26 changes: 26 additions & 0 deletions nix-build-remote
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,26 @@
    #!/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}"

    # import all from our local cache thing
    unset NIX_REMOTE
    nix copy --from "${CACHE_STORE}" --all --no-check-sigs