about summary refs log blame commit diff
path: root/users/wpcarro/nixos/default.nix
blob: e7ae5490b9b68e589e41aabf0fc563cdd12b7375 (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.targets = [ "marcusSystem" ];
}