Skip to content

Commit cfd715e

Browse files
committed
updates
1 parent 50a5a88 commit cfd715e

File tree

2 files changed

+11
-36
lines changed

2 files changed

+11
-36
lines changed

vagrant/.bin/update-aws-config

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ set -e
77
# Your private Gist ID - Replace this with your actual Gist ID
88
GIST_ID="1bf9c10f2f60a2d83505dd5280f1be0d"
99

10-
# Use custom location to avoid conflicts with home-manager symlinks
11-
AWS_CONFIG_DIR="$HOME/.aws-custom"
10+
# Standard AWS location
11+
AWS_CONFIG_DIR="$HOME/.aws"
1212
AWS_CONFIG_FILE="$AWS_CONFIG_DIR/config"
1313

1414
echo "Fetching AWS config from GitHub Gist..."
@@ -20,12 +20,11 @@ if ! gh auth status &>/dev/null; then
2020
echo "GitHub CLI not authenticated. Running 'gh auth login' first..."
2121
gh auth login
2222
fi
23-
# Fetch the gist content directly to our custom location
23+
# Fetch the gist content directly to our config file
2424
gh gist view $GIST_ID --raw --filename aws-config >"$AWS_CONFIG_FILE"
2525
chmod 600 "$AWS_CONFIG_FILE"
2626

2727
echo "✅ AWS config successfully updated from Gist!"
28-
echo "To use this config, run AWS commands through aws-wrapper or set AWS_CONFIG_FILE=$AWS_CONFIG_FILE"
2928

3029
# Print available profiles
3130
echo "Available AWS profiles:"

vagrant/aws.nix

Lines changed: 8 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -4,43 +4,19 @@
44
# Install AWS CLI and related tools
55
home.packages = with pkgs; [ awscli2 aws-sso-cli ssm-session-manager-plugin ];
66

7-
# Ensure custom AWS directory exists with proper permissions
8-
home.activation.setupAwsDir = lib.hm.dag.entryAfter [ "writeBoundary" ] ''
9-
mkdir -p $HOME/.aws-custom
10-
chmod 700 $HOME/.aws-custom
11-
'';
12-
13-
# Add a wrapper script that sets AWS_CONFIG_FILE before running aws commands
14-
home.file.".bin/aws-wrapper" = {
15-
executable = true;
16-
text = ''
17-
#!/usr/bin/env bash
18-
# Wrapper for AWS CLI that uses custom config location
19-
export AWS_CONFIG_FILE="$HOME/.aws-custom/config"
20-
aws "$@"
21-
'';
22-
};
23-
24-
# Add placeholder AWS config file in our custom location
25-
home.file.".aws-custom/config".text = ''
26-
# This is a placeholder AWS config file.
27-
# To load your actual configuration from your private GitHub Gist, run:
28-
# $ update-aws-config (or simply use the alias: uaws)
29-
#
30-
# This will fetch your AWS configuration securely using your GitHub CLI.
7+
# Explicitly tell home-manager not to manage the AWS config file
8+
xdg.configFile."aws/config".enable = false;
319

32-
# Default fallback configuration
33-
[default]
34-
region = eu-west-2
35-
output = json
10+
home.activation.setupAws = lib.hm.dag.entryAfter [ "writeBoundary" ] ''
11+
# Create AWS directory with proper permissions
12+
mkdir -p $HOME/.aws
13+
chmod 700 $HOME/.aws
3614
'';
3715

3816
# Configure ZSH aliases for AWS-related scripts
3917
programs.zsh.shellAliases = {
4018
"uaws" = "update-aws-config"; # Short alias for update-aws-config
41-
"aws" = "aws-wrapper"; # Use our wrapper for AWS commands
42-
"awssso" = "aws-wrapper sso login"; # Quick login to AWS SSO
43-
"awswho" =
44-
"aws-wrapper sts get-caller-identity"; # Check current AWS identity
19+
"awssso" = "aws sso login"; # Quick login to AWS SSO
20+
"awswho" = "aws sts get-caller-identity"; # Check current AWS identity
4521
};
4622
}

0 commit comments

Comments
 (0)