diff options
-rw-r--r-- | README.md | 4 | ||||
-rw-r--r-- | pkgs/krops/default.nix | 13 |
2 files changed, 12 insertions, 5 deletions
@@ -185,6 +185,10 @@ pkgs.krops.writeCommand "deploy-with-swap" { [see `writeDeploy`](#writeDeploy) +### `allocateTTY` (optional, defaults to false) + +whether the ssh session should do a pseudo-terminal allocation. +sets `-t` on the ssh command. ## Source Types diff --git a/pkgs/krops/default.nix b/pkgs/krops/default.nix index 8336b51..e94b68f 100644 --- a/pkgs/krops/default.nix +++ b/pkgs/krops/default.nix @@ -5,7 +5,7 @@ in { nix, openssh, populate, writers }: rec { build = target: - runShell target (lib.concatStringsSep " " [ + runShell target {} (lib.concatStringsSep " " [ "nix build" "-I ${lib.escapeShellArg target.path}" "--no-link -f '<nixpkgs/nixos>'" @@ -13,11 +13,13 @@ in ]); rebuild = args: target: - runShell target "nixos-rebuild -I ${lib.escapeShellArg target.path} ${ + runShell target {} "nixos-rebuild -I ${lib.escapeShellArg target.path} ${ lib.concatMapStringsSep " " lib.escapeShellArg args }"; - runShell = target: command: + runShell = target: { + allocateTTY ? false + }: command: let command' = if target.sudo then "sudo ${command}" else command; in @@ -28,7 +30,7 @@ in exec ${openssh}/bin/ssh ${lib.escapeShellArgs (lib.flatten [ (lib.optionals (target.user != "") ["-l" target.user]) "-p" target.port - "-T" + (if allocateTTY then "-t" else "-T") target.extraOptions target.host command'])} @@ -38,6 +40,7 @@ in command ? (targetPath: "echo ${targetPath}"), backup ? false, force ? false, + allocateTTY ? false, source, target }: let @@ -46,7 +49,7 @@ in writers.writeDash name '' set -efu ${populate { inherit backup force source; target = target'; }} - ${runShell target' (command target'.path)} + ${runShell target' { inherit allocateTTY; } (command target'.path)} ''; writeDeploy = name: { |