summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorlassulus <lassulus@lassul.us>2019-10-23 16:01:29 +0200
committerlassulus <lassulus@lassul.us>2019-10-23 20:26:33 +0200
commit3d59510ac286731d3c8ae60be6922cb3a15f1f3c (patch)
tree592528142f5d800c19b9252e96fb678ed11cd2e0
parent6d1c35ea2cd594db580918fedc8124f4786875af (diff)
krops: add remoteCommand, use in build & rebuild
-rw-r--r--pkgs/krops/default.nix34
1 files 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,34 +5,28 @@ in
{ exec, nix, openssh, populate, writeDash }: rec {
build = target:
- exec "build.${target.host}" rec {
- filename = "${openssh}/bin/ssh";
- argv = [
- filename
- "-l" target.user
- "-p" target.port
- "-t"
- target.host
- (lib.concatStringsSep " " [
- "nix build"
- "-I ${lib.escapeShellArg target.path}"
- "--no-link -f '<nixpkgs/nixos>'"
- "config.system.build.toplevel"
- ])
- ];
- };
+ remoteCommand target (lib.concatStringsSep " " [
+ "nix build"
+ "-I ${lib.escapeShellArg target.path}"
+ "--no-link -f '<nixpkgs/nixos>'"
+ "config.system.build.toplevel"
+ ]);
rebuild = args: target:
- exec "rebuild.${target.host}" rec {
+ 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 = [
filename
"-l" target.user
"-p" target.port
+ "-t"
target.host
- "nixos-rebuild -I ${lib.escapeShellArg target.path} ${
- lib.concatMapStringsSep " " lib.escapeShellArg args
- }"
+ command
];
};