about summary refs log tree commit diff
path: root/ops/buildkite/default.nix
diff options
context:
space:
mode:
Diffstat (limited to 'ops/buildkite/default.nix')
-rw-r--r--ops/buildkite/default.nix25
1 files changed, 25 insertions, 0 deletions
diff --git a/ops/buildkite/default.nix b/ops/buildkite/default.nix
new file mode 100644
index 0000000..7daf7c2
--- /dev/null
+++ b/ops/buildkite/default.nix
@@ -0,0 +1,25 @@
+{ pkgs }:
+let
+  terraform = pkgs.terraform.withPlugins (p: [
+    p.buildkite
+    p.google
+  ]);
+in
+pkgs.stdenv.mkDerivation rec {
+  name = "tf-buildkite";
+  src = ./.;
+
+  upload = pkgs.writeShellScriptBin "tf-buildkite-upload" ''
+    set -ueo pipefail
+
+    cd $(git rev-parse --show-toplevel)/ops/buildkite
+    pass gcloud/terraform/fcuny-homelab > /dev/shm/tf-fcuny-homelab
+
+    export BUILDKITE_API_TOKEN=$(pass api/buildkite-terraform-token)
+    export GOOGLE_APPLICATION_CREDENTIALS=/dev/shm/tf-fcuny-homelab
+
+    ${terraform}/bin/terraform init
+    ${terraform}/bin/terraform plan
+    ${terraform}/bin/terraform apply
+  '';
+}