about summary refs log tree commit diff
path: root/users/wpcarro/nixos/default.nix
blob: aa1dfea55e9207111c6a1748a1c790c0822ac557 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
{ depot, pkgs, ... }:

let systemFor = sys: (depot.ops.nixos.nixosFor sys).system;
in {
  marcusSystem = systemFor depot.users.wpcarro.nixos.marcus;
  deploy-diogenes = pkgs.writeShellScriptBin "deploy-diogenes" ''
    set -euo pipefail
    readonly TF_STATE_DIR=/depot/users/wpcarro/terraform
    rm -f $TF_STATE_DIR/*.json
    readonly STORE_PATH="$(nix-build /depot -A users.wpcarro.nixos.diogenes)"
    cp $STORE_PATH $TF_STATE_DIR

    function cleanup() {
      rm -f "$TF_STATE_DIR/$(basename $STORE_PATH)"
    }

    trap cleanup EXIT
    ${pkgs.terraform}/bin/terraform -chdir="$TF_STATE_DIR" apply
  '';

  meta.ci.targets = [ "marcusSystem" ];
}