From 4943514a0801f1d954b2422264c68104e1b29341 Mon Sep 17 00:00:00 2001 From: Sean Buckley Date: Wed, 15 Dec 2021 01:25:58 -0500 Subject: [PATCH] add jump script --- lib/morph.nix | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/lib/morph.nix b/lib/morph.nix index 975bada..3a8679c 100644 --- a/lib/morph.nix +++ b/lib/morph.nix @@ -1,5 +1,4 @@ -{ nixpkgs -, nixosConfigurations +{ self , extraMorphModules ? [ ] }: @@ -7,6 +6,9 @@ # (builtins.getFlake (toString ./.)).morph-entrypoint builtins.currentSystem let + inherit (self.inputs) nixpkgs; + inherit (self) nixosConfigurations; + helpers = system: let pkgs = nixpkgs.legacyPackages.${system}; @@ -96,6 +98,12 @@ in ssh root@$ip ln -sfn /proc/mounts /mnt/etc/mtab 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" + ''; ssh = sh '' ip="$(nix eval --raw ".#nixosConfigurations.\"$1\".config.sconfig.morph.deployment.targetHost")" shift