diff options
| author | Mike Vink <mike@pionative.com> | 2024-05-01 10:05:59 +0200 |
|---|---|---|
| committer | Mike Vink <mike@pionative.com> | 2024-05-01 10:05:59 +0200 |
| commit | d91e0da1605e150190b3e452b53cdf10087dba77 (patch) | |
| tree | 71026cff0a8748f30243ae875841b516a3f6b7f4 | |
| parent | de12ff3b1f015830b89e7335b2c23d2a1c09a5f0 (diff) | |
stop committing plans
| -rw-r--r-- | profiles/core/git.nix | 1 | ||||
| -rw-r--r-- | profiles/core/home.nix | 30 | ||||
| -rw-r--r-- | profiles/station/packages.nix | 5 |
3 files changed, 33 insertions, 3 deletions
diff --git a/profiles/core/git.nix b/profiles/core/git.nix index dee2d84..b1d3ea6 100644 --- a/profiles/core/git.nix +++ b/profiles/core/git.nix @@ -20,6 +20,7 @@ "/.env" ".vimsession.vim" "tfplan" + "plan" ]; }; }; diff --git a/profiles/core/home.nix b/profiles/core/home.nix index 571428e..3788da7 100644 --- a/profiles/core/home.nix +++ b/profiles/core/home.nix @@ -151,6 +151,36 @@ } bindkey -s '^o' '^ulfcd\n' + login-to-cloud () { + case $1 in + aws) + export AWS_PROFILE=$(aws configure list-profiles | grep -v default | fzf) + if ! error=$(aws sts get-caller-identity 2>&1); then + if echo "$error" | grep 'SSO session associated with this profile has expired'; then + aws sso login + else + echo "Not sure what to do with error: $error" + fi + fi + ;; + gcp) + gcloud config configurations activate $(gcloud config configurations list --format json | jq '.[] | "\(.name) \(.properties.core.account)"' -r | fzf | awk '{print $1}') + if ! gcloud compute instances list &> /dev/null </dev/null; then + gcloud auth login + fi + ;; + azure) + id=$(az account list --all | jq '.[] | select(.name | test("N/A.*") | not) | "\(.name)\t\(.id)"' -r | fzf | awk -F'\t' '{print $2}') + az account set --subscription $id + if ! az resource list &>/dev/null; then + az login --tenant $(az account show | jq '.tenantId' -r) + fi + ;; + *) echo "Don't know how to switch context for: $1" ;; + esac + } + + export ZLE_REMOVE_SUFFIX_CHARS=$' \t\n;&|/@' export EDITOR="nvim" export TERMINAL="st" ( command -v brew ) &>/dev/null && eval "$(/opt/homebrew/bin/brew shellenv)" diff --git a/profiles/station/packages.nix b/profiles/station/packages.nix index 7a3c0fb..0124979 100644 --- a/profiles/station/packages.nix +++ b/profiles/station/packages.nix @@ -12,9 +12,6 @@ bashInteractive powershell - arduino-ide - arduino-cli - k9s krew azure-cli @@ -24,6 +21,8 @@ ])) imagemagick ] ++ (optionals (!machine.isDarwin) [ + arduino-ide + arduino-cli xdotool pywal dasel |
