about summary refs log blame commit diff
path: root/users/wpcarro/nixos/default.nix
blob: aa1dfea55e9207111c6a1748a1c790c0822ac557 (plain) (tree)
1
2
3
4
5
                     



                                                            













                                                                             
 
                                       
 
{ 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" ];
}