diff options
author | lassulus <lassulus@lassul.us> | 2021-03-27 20:25:31 +0100 |
---|---|---|
committer | lassulus <lassulus@lassul.us> | 2021-03-27 21:16:14 +0100 |
commit | 3eda6b34789f6f1841f2753950f3f11bb1abb27f (patch) | |
tree | 154ea351ec5c13d3e1631458213cefd9d32db214 /pkgs/krops/default.nix | |
parent | cccebf3ff7a53336b3f106cb96dddd5892d427ed (diff) |
runShell/writeCommand: add allocateTTY argumentinteractive
Diffstat (limited to 'pkgs/krops/default.nix')
-rw-r--r-- | pkgs/krops/default.nix | 13 |
1 files changed, 8 insertions, 5 deletions
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: { |