From 9de962a802fe1ed36ce6fb9a9ada2cb41779556e Mon Sep 17 00:00:00 2001 From: Sean Buckley Date: Tue, 21 Dec 2021 01:41:01 -0500 Subject: [PATCH] morph: move jump command --- lib/morph.nix | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/lib/morph.nix b/lib/morph.nix index 99d82aa..8dfd138 100644 --- a/lib/morph.nix +++ b/lib/morph.nix @@ -42,8 +42,16 @@ let ${scriptBody} ''; + jump = pkgs.writeShellScript "jump" '' + set -eu + echo ${self} + ip="$(nix eval --raw ".#nixosConfigurations.\"$1\".config.sconfig.morph.deployment.targetHost")" + NIX_SSHOPTS="-F${sshConfig}" nix copy --to ssh://root@$ip ${self} + exec ssh -oForwardAgent=yes -F"${sshConfig}" "root@$ip" -t "cd ${self}; nix develop" + ''; + in - { inherit pkgs sh sshConfig; }; + { inherit jump pkgs sh sshConfig; }; in { @@ -53,6 +61,7 @@ in shellHook = '' export SSH_CONFIG_FILE=${sshConfig} alias ssh='ssh -F${sshConfig}' + alias jump=${jump} ''; }; @@ -105,11 +114,5 @@ in ssh root@$ip NIXOS_INSTALL_BOOTLOADER=1 nixos-enter \ --root /mnt -- /run/current-system/bin/switch-to-configuration boot ''; - jump = sh '' - echo ${self} - ip="$(nix eval --raw ".#nixosConfigurations.\"$1\".config.sconfig.morph.deployment.targetHost")" - NIX_SSHOPTS="-F${sshConfig}" nix copy --to ssh://root@$ip ${self} - exec ssh -oForwardAgent=yes -F"${sshConfig}" "$ip" -t "cd ${self}; nix develop" - ''; }; }