2021-12-30 20:25:03 +01:00
|
|
|
{ depot, pkgs, ... }:
|
2021-12-16 00:40:44 +01:00
|
|
|
|
|
|
|
let systemFor = sys: (depot.ops.nixos.nixosFor sys).system;
|
|
|
|
in {
|
|
|
|
marcusSystem = systemFor depot.users.wpcarro.nixos.marcus;
|
2021-12-30 20:25:03 +01:00
|
|
|
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
|
|
|
|
'';
|
2021-12-17 00:29:59 +01:00
|
|
|
|
2021-12-30 06:15:27 +01:00
|
|
|
meta.targets = [ "marcusSystem" ];
|
2021-12-16 00:40:44 +01:00
|
|
|
}
|