diff options
| author | lassulus <lassulus@lassul.us> | 2021-03-27 20:25:31 +0100 | 
|---|---|---|
| committer | lassulus <lassulus@lassul.us> | 2021-10-26 13:51:18 +0200 | 
| commit | d80cb74c7400962b08e77ff06153ace419693505 (patch) | |
| tree | 85fec82204487da81f34c94cc62f4bce0403318e | |
| parent | c1b24328c42adc64983c18a718fd0a4cb0b9aeee (diff) | |
runShell/writeCommand: add allocateTTY argument
| -rw-r--r-- | README.md | 4 | ||||
| -rw-r--r-- | pkgs/krops/default.nix | 11 | 
2 files changed, 11 insertions, 4 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 d773052..d092307 100644 --- a/pkgs/krops/default.nix +++ b/pkgs/krops/default.nix @@ -5,11 +5,13 @@ in  { nix, openssh, populate, writers }: rec {    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 @@ -20,7 +22,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'])} @@ -30,6 +32,7 @@ in      command ? (targetPath: "echo ${targetPath}"),      backup ? false,      force ? false, +    allocateTTY ? false,      source,      target    }: let @@ -38,7 +41,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: {  | 
