aboutsummaryrefslogtreecommitdiffstats
path: root/pkgs
diff options
context:
space:
mode:
authorJörg Thalheim <joerg@thalheim.io>2019-12-29 21:43:58 +0000
committertv <tv@krebsco.de>2019-12-30 14:15:08 +0100
commit402c9cac2595f2219efb8bb51becd337bbcb7965 (patch)
treed7d0f3dfbecc04f35c001ff0e241310a0d2b707c /pkgs
parentfce5826802ca36d451978baa83a97bfbc1d2475f (diff)
writeDeploy: add support for build hosts
This allows to evaluate & build the system on the dedicated build host, from which the build artifacts are uploaded onto the target machine.
Diffstat (limited to 'pkgs')
-rw-r--r--pkgs/krops/default.nix18
1 files changed, 15 insertions, 3 deletions
diff --git a/pkgs/krops/default.nix b/pkgs/krops/default.nix
index a3e7745..700066e 100644
--- a/pkgs/krops/default.nix
+++ b/pkgs/krops/default.nix
@@ -47,21 +47,33 @@ in
writeDeploy = name: {
backup ? false,
+ buildTarget ? null,
fast ? false,
force ? false,
source,
target
}: let
+ buildTarget' =
+ if buildTarget == null
+ then target'
+ else lib.mkTarget buildTarget;
target' = lib.mkTarget target;
in
writeDash name ''
set -efu
+ ${lib.optionalString (buildTarget' != target')
+ (populate { inherit backup force source; target = buildTarget'; })}
${populate { inherit backup force source; target = target'; }}
${lib.optionalString (! fast) ''
- ${rebuild ["dry-build"] target'}
- ${build target'}
+ ${rebuild ["dry-build"] buildTarget'}
+ ${build buildTarget'}
''}
- ${rebuild ["switch"] target'}
+ ${rebuild ([
+ "switch"
+ ] ++ lib.optionals (buildTarget' != target') [
+ "--build-host" "${buildTarget'.user}@${buildTarget'.host}"
+ "--target-host" "${target'.user}@${target'.host}"
+ ]) buildTarget'}
'';
writeTest = name: {