Skip to content

Instantly share code, notes, and snippets.

@matthiasbeyer
Created October 13, 2020 09:14
Show Gist options
  • Save matthiasbeyer/1208e86b25c5d32240f3e950aedd3ef4 to your computer and use it in GitHub Desktop.
Save matthiasbeyer/1208e86b25c5d32240f3e950aedd3ef4 to your computer and use it in GitHub Desktop.
execute nix-build remote
#!/usr/bin/env bash
host="$1"
branch="$2"
pkg="$3"
remote_dir="$$"
[[ -z "$host" ]] && { echo "no HOST"; exit 1; }
[[ -z "$branch" ]] && { echo "no branch"; exit 1; }
[[ -z "$pkg" ]] && { echo "no pkg"; exit 1; }
ssh "$host" -- "mkdir /tmp/$remote_dir"
git archive --format=tgz "$branch" | ssh "$host" "tar -C /tmp/$remote_dir -xvzf -"
ssh "$host" -- "cd /tmp/$remote_dir && nix-build -A $pkg"
echo ready
echo "See: /tmp/$remote_dir"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment