From 3d59510ac286731d3c8ae60be6922cb3a15f1f3c Mon Sep 17 00:00:00 2001 From: lassulus Date: Wed, 23 Oct 2019 16:01:29 +0200 Subject: [PATCH] krops: add remoteCommand, use in build & rebuild --- pkgs/krops/default.nix | 34 ++++++++++++++-------------------- 1 file changed, 14 insertions(+), 20 deletions(-) diff --git a/pkgs/krops/default.nix b/pkgs/krops/default.nix index a83e88c..85bf88c 100644 --- a/pkgs/krops/default.nix +++ b/pkgs/krops/default.nix @@ -5,6 +5,19 @@ in { exec, nix, openssh, populate, writeDash }: rec { build = target: + remoteCommand target (lib.concatStringsSep " " [ + "nix build" + "-I ${lib.escapeShellArg target.path}" + "--no-link -f ''" + "config.system.build.toplevel" + ]); + + rebuild = args: target: + remoteCommand target "nixos-rebuild -I ${lib.escapeShellArg target.path} ${ + lib.concatMapStringsSep " " lib.escapeShellArg args + }"; + + remoteCommand = target: command: exec "build.${target.host}" rec { filename = "${openssh}/bin/ssh"; argv = [ @@ -13,26 +26,7 @@ in "-p" target.port "-t" target.host - (lib.concatStringsSep " " [ - "nix build" - "-I ${lib.escapeShellArg target.path}" - "--no-link -f ''" - "config.system.build.toplevel" - ]) - ]; - }; - - rebuild = args: target: - exec "rebuild.${target.host}" rec { - filename = "${openssh}/bin/ssh"; - argv = [ - filename - "-l" target.user - "-p" target.port - target.host - "nixos-rebuild -I ${lib.escapeShellArg target.path} ${ - lib.concatMapStringsSep " " lib.escapeShellArg args - }" + command ]; };