diff options
author | tv <tv@krebsco.de> | 2020-02-18 14:34:10 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-02-18 14:34:10 +0100 |
commit | 8161ec736759a7f21d9d6ec6e5ff8189df9ebbe7 (patch) | |
tree | 0a111953df144e407b13c59a5512e87391083931 /pkgs/krops | |
parent | f1b7112ac3cbe090e96f2c82c525b6db69b82034 (diff) | |
parent | d51f353cb3ca667957e05699e4f250c9cd4d0882 (diff) |
Merge pull request #17 from Mic92/no-writers
use writers from nixpkgs
Diffstat (limited to 'pkgs/krops')
-rw-r--r-- | pkgs/krops/default.nix | 20 |
1 files changed, 8 insertions, 12 deletions
diff --git a/pkgs/krops/default.nix b/pkgs/krops/default.nix index 16ef936..07c7395 100644 --- a/pkgs/krops/default.nix +++ b/pkgs/krops/default.nix @@ -2,7 +2,7 @@ let lib = import ../../lib; in -{ exec, nix, openssh, populate, writeDash }: rec { +{ nix, openssh, populate, writers }: rec { build = target: remoteCommand target (lib.concatStringsSep " " [ @@ -18,17 +18,14 @@ in }"; remoteCommand = target: command: - exec "build.${target.host}" rec { - filename = "${openssh}/bin/ssh"; - argv = lib.flatten [ - filename + writers.writeDash "build.${target.host}" '' + exec ${openssh}/bin/ssh ${lib.escapeShellArgs (lib.flatten [ (lib.optionals (target.user != "") ["-l" target.user]) "-p" target.port "-t" target.host - (if target.sudo then "sudo ${command}" else command) - ]; - }; + (if target.sudo then "sudo ${command}" else command)])} + ''; writeCommand = name: { command ? (targetPath: "echo ${targetPath}"), @@ -39,7 +36,7 @@ in }: let target' = lib.mkTarget target; in - writeDash name '' + writers.writeDash name '' set -efu ${populate { inherit backup force source; target = target'; }} ${remoteCommand target' (command target'.path)} @@ -60,7 +57,7 @@ in else lib.mkTarget buildTarget; target' = lib.mkTarget target; in - writeDash name '' + writers.writeDash name '' set -efu ${lib.optionalString (buildTarget' != target') (populate { inherit backup force source; target = buildTarget'; })} @@ -88,7 +85,7 @@ in target' = lib.mkTarget target; in assert lib.isLocalTarget target'; - writeDash name '' + writers.writeDash name '' set -efu ${populate { inherit backup force source; target = target'; }} >&2 NIX_PATH=${lib.escapeShellArg target'.path} \ @@ -99,5 +96,4 @@ in --show-trace \ '<nixpkgs/nixos>' ''; - } |