diff options
author | tv <tv@krebsco.de> | 2018-07-10 10:15:39 +0200 |
---|---|---|
committer | tv <tv@krebsco.de> | 2018-07-10 10:15:39 +0200 |
commit | 9677846bf5770f17dcc87a3fa9855343dc9248ca (patch) | |
tree | 9ac4be680112288f10cc44e44a5a37d21e46f52d /pkgs | |
parent | 4e466eaf05861b47365c5ef46a31a188b70f3615 (diff) |
krops: add writePopulatev1.1.0
Diffstat (limited to 'pkgs')
-rw-r--r-- | pkgs/krops/default.nix | 30 |
1 files changed, 19 insertions, 11 deletions
diff --git a/pkgs/krops/default.nix b/pkgs/krops/default.nix index fc52327..496b8d3 100644 --- a/pkgs/krops/default.nix +++ b/pkgs/krops/default.nix @@ -8,34 +8,42 @@ let }; in -{ nix, openssh, populate, writeDash, writeJSON }: { +{ nix, openssh, populate, writeDash, writeJSON }: let + + populate' = name: { source, target }: + writeDash "${name}-populate" '' + set -efu + source=${writeJSON "${name}-source.json" source} + target=${target.user}@${target.host}:${target.port}${target.path} + exec ${populate}/bin/populate "$target" < "$source" + ''; + +in { writeDeploy = name: { source, target }: let target' = lib.mkTarget target; in writeDash name '' set -efu - - ${populate}/bin/populate \ - ${target'.user}@${target'.host}:${target'.port}${target'.path} \ - < ${writeJSON "${name}-source.json" source} - + ${populate' name { inherit source; target = target'; }} ${openssh}/bin/ssh \ ${target'.user}@${target'.host} -p ${target'.port} \ nixos-rebuild switch -I ${target'.path} ''; + writePopulate = name: { source, target }: + populate' name { + inherit source; + target = lib.mkTarget target; + }; + writeTest = name: { source, target }: let target' = lib.mkTarget target; in assert lib.isLocalTarget target'; writeDash name '' set -efu - - ${populate}/bin/populate --force \ - ${target'.path} \ - < ${writeJSON "${name}-source.json" source} - + ${populate' name { inherit source; target = target'; }} ${nix}/bin/nix-build \ -A config.system.build.toplevel \ -I ${target'.path} \ |