nix-shell-remote 613 Bytes
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
#!/usr/bin/env sh

export NIX_SSHOPTS="source .profile; source .bash_profile;"

host=$1;shift

echo "remote-nix-shell.sh: creating a derivation in the local store."
drv=$(nix-instantiate $@ --quiet)
echo "the derivation has store path: $drv"

echo "remote-nix-shell.sh: building this derivation's output locally."
nix-store --realize $drv --quiet > /dev/null

echo "remote-nix-shell.sh: copying the derivation and its output to the host."
nix-copy-closure --include-outputs --to $host $drv

echo "remote-nix-shell.sh: entering a remote shell."
ssh -t $host "source .profile; source .bash_profile; nix-shell $drv"