aboutsummaryrefslogtreecommitdiff
path: root/nix/users/fcuny/work.nix
diff options
context:
space:
mode:
Diffstat (limited to 'nix/users/fcuny/work.nix')
-rw-r--r--nix/users/fcuny/work.nix26
1 files changed, 26 insertions, 0 deletions
diff --git a/nix/users/fcuny/work.nix b/nix/users/fcuny/work.nix
index b3b6325..34da876 100644
--- a/nix/users/fcuny/work.nix
+++ b/nix/users/fcuny/work.nix
@@ -1,4 +1,27 @@
{ pkgs, ... }:
+let
+ nomad-prod = pkgs.writeShellScriptBin "nomad-prod" ''
+ #!${pkgs.runtimeShell}
+ set -e
+
+ if [ $# -ne 1 ]; then
+ echo "Usage: nomad-ui CELL_ID"
+ exit 1
+ fi
+
+ CELL_ID=$1
+
+ echo ">> Login to chi1 vault using Okta"
+ export VAULT_ADDR="https://chi1-vault.simulprod.com:8200"
+ export VAULT_TOKEN=$(${pkgs.vault}/bin/vault login -field=token -method=oidc username=$USER)
+
+ echo ">> Accessing cell $CELL_ID"
+ export NOMAD_ADDR="https://$CELL_ID-nomad.simulprod.com"
+ export NOMAD_TOKEN=$(${pkgs.vault}/bin/vault read -field secret_id ''${CELL_ID}_nomad/creds/management)
+
+ nomad ui --authenticate
+ '';
+in
{
imports = [ ./k8s.nix ];
@@ -14,6 +37,9 @@
# for tokens
customPackages.hashi
+
+ # for nomad
+ nomad-prod
];
programs.fish = {