aboutsummaryrefslogtreecommitdiffstats
path: root/pkgs/krops/default.nix
blob: 98d7e17910903f11f2b665deca203eb668b217ba (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
let
  lib = import ../../lib;
in

{ nix, openssh, populate, writeDash, writeJSON }: {

  writeDeploy = name: { source, target }: let
    target' = lib.mkTarget target;
  in
    writeDash name ''
      set -efu
      ${populate { inherit source; target = target'; }}
      ${openssh}/bin/ssh \
          ${target'.user}@${target'.host} -p ${target'.port} \
          nixos-rebuild switch -I ${target'.path}
    '';

  writeTest = name: { source, target }: let
    target' = lib.mkTarget target;
  in
    assert lib.isLocalTarget target';
    writeDash name ''
      set -efu
      ${populate { inherit source; target = target'; }}
      ${nix}/bin/nix-build \
          -A system \
          -I ${target'.path} \
          --no-out-link \
          --show-trace \
          '<nixpkgs/nixos>'
    '';

}