Skip to content

Instantly share code, notes, and snippets.

@benley
Last active September 11, 2015 22:05
Show Gist options
  • Save benley/f1ce058a2f913674c408 to your computer and use it in GitHub Desktop.
Save benley/f1ce058a2f913674c408 to your computer and use it in GitHub Desktop.
#!/bin/bash
# Build, export, and publish the Nix dependencies of an Aurora job.
# Then use the aurora commandline utility to launch it.
#
# This should really be an Aurora client hook, or at least a
# better-integrated wrapper script.
set -e
attr=${1:?USAGE: $0 <attribute>}
shift
pushdir=./nar
s3cache="s3://your-s3-bucket/nar"
derivation=$(nix-instantiate -A "$attr")
store_path=$(nix-store --realize "$derivation")
echo "STORE PATH: $store_path"
echo "EXPORTING TO $pushdir"
nix-push --dest "$pushdir" "$store_path"
echo "SYNCING TO $s3cache"
aws s3 sync "$pushdir" "$s3cache"
echo "STORE PATH FOR AURORA: $store_path"
aurora "$@" --bind store_path="$store_path"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment