Last active
August 31, 2019 02:15
-
-
Save adrianparvino/a213d71d4a8562d4d2ab5cdbb1902850 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
SEP= | |
for ((i = 3 ; i <= $# ; i++)); do | |
if [ "${!i}" != "--" ]; then continue; fi | |
SEP="$i" | |
break | |
done | |
FLAGs=$((SEP - 2 - 2)) | |
MACHINE=$((SEP - 1)) | |
exec nixops ssh "${@:1:2}" "${!MACHINE}" "${@:3:$FLAGs}" "${@:$SEP}" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Requires mosh/mosh-client in PATH | |
let | |
nixops-mosh = pkgs.writeScriptBin "nixops-mosh" '' | |
#!${pkgs.stdenv.shell} | |
exec ${mosh}/bin/mosh --experimental-remote-ip=remote --ssh="${nixops-mosh-adaptor}/bin/nixops-mosh-adaptor -d $1" $2 | |
''; | |
nixops-mosh-adaptor = pkgs.writeScriptBin "nixops-mosh-adaptor" '' | |
#!${pkgs.stdenv.shell} | |
SEP= | |
for ((i = 3 ; i <= $# ; i++)); do | |
if [ "''${!i}" != "--" ]; then continue; fi | |
SEP="$i" | |
break | |
done | |
FLAGs=$((SEP - 2 - 2)) | |
MACHINE=$((SEP - 1)) | |
exec ${nixops}/bin/nixops ssh "''${@:1:2}" "''${!MACHINE}" "''${@:3:$FLAGs}" "''${@:$SEP}" | |
''; | |
in nixops-mosh | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
mosh --experimental-remote-ip=remote --ssh='./nixops-mosh-adaptor.sh -d deployment' machine | |
nixops-mosh deployment machine |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment