work setup sync
This commit is contained in:
@@ -70,6 +70,8 @@ dotfiles/
|
|||||||
|
|
||||||
### Extras
|
### Extras
|
||||||
|
|
||||||
|
- podman
|
||||||
|
- wl-clipboard (Debian only)
|
||||||
- secret-tool (Debian only)
|
- secret-tool (Debian only)
|
||||||
- fzf
|
- fzf
|
||||||
- tree-sitter-cli
|
- tree-sitter-cli
|
||||||
@@ -125,10 +127,10 @@ sudo apt update && sudo apt install terraform
|
|||||||
|
|
||||||
```bash
|
```bash
|
||||||
# System packages
|
# System packages
|
||||||
sudo apt install alacritty zsh tmux stow zsh-syntax-highlighting less python3-libtmux cbonsai shfmt shellcheck lua-check secret-tool
|
sudo apt install alacritty zsh tmux stow zsh-syntax-highlighting less python3-libtmux cbonsai shfmt shellcheck lua-check secret-tool wl-clipboard
|
||||||
|
|
||||||
# Homebrew packages
|
# Homebrew packages
|
||||||
brew install neovim stylua lua-language-server bash-language-server prettier terraform-ls tflint ruff markdownlint-cli2 fzf tree-sitter-cli
|
brew install neovim stylua lua-language-server bash-language-server prettier terraform-ls tflint ruff markdownlint-cli2 fzf tree-sitter-cli podman
|
||||||
|
|
||||||
# Node packages
|
# Node packages
|
||||||
npm install --save-dev prettier prettier-plugin-go-template
|
npm install --save-dev prettier prettier-plugin-go-template
|
||||||
@@ -144,7 +146,7 @@ brew unlink python3
|
|||||||
brew install curl git alacritty zsh tmux stow zsh-syntax-highlighting lesspipe cbonsai reattach-to-user-namespace
|
brew install curl git alacritty zsh tmux stow zsh-syntax-highlighting lesspipe cbonsai reattach-to-user-namespace
|
||||||
|
|
||||||
# Development tools
|
# Development tools
|
||||||
brew install neovim stylua lua-language-server bash-language-server prettier terraform-ls tflint ruff
|
brew install neovim stylua lua-language-server bash-language-server prettier terraform-ls tflint ruff fzf tree-sitter-cli podman
|
||||||
|
|
||||||
# Node packages
|
# Node packages
|
||||||
npm install --save-dev prettier prettier-plugin-go-template
|
npm install --save-dev prettier prettier-plugin-go-template
|
||||||
|
|||||||
70
scripts/hcf/podman_setup
Executable file
70
scripts/hcf/podman_setup
Executable file
@@ -0,0 +1,70 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# Script to configure podman for the local environment
|
||||||
|
#
|
||||||
|
# ./podman_setup
|
||||||
|
|
||||||
|
set -euo pipefail
|
||||||
|
|
||||||
|
if ! command -v podman &>/dev/null; then
|
||||||
|
echo "Error: podman is not installed"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
case "$(uname -s)" in
|
||||||
|
Darwin*) memory=12288 ;;
|
||||||
|
Linux*) memory=8192 ;;
|
||||||
|
*)
|
||||||
|
echo "Unsupported platform"
|
||||||
|
exit 1
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
if [[ "$(uname -s)" == Darwin* ]]; then
|
||||||
|
helper_plist="/Library/LaunchDaemons/com.github.containers.podman.helper-$(whoami).plist"
|
||||||
|
if [[ ! -f "$helper_plist" ]]; then
|
||||||
|
echo "Installing podman-mac-helper (requires sudo)..."
|
||||||
|
sudo podman-mac-helper install
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
if ! podman machine inspect &>/dev/null; then
|
||||||
|
echo "Initializing podman machine with 4 CPUs and $((memory / 1024))GB RAM..."
|
||||||
|
podman machine init --rootful --cpus 4 --memory "$memory"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ "$(uname -s)" == Darwin* ]]; then
|
||||||
|
rosetta=$(podman machine inspect --format '{{.Rosetta}}')
|
||||||
|
if [[ "$rosetta" != "true" ]]; then
|
||||||
|
echo "Warning: Rosetta translation is not enabled on this podman machine."
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
state=$(podman machine inspect --format '{{.State}}')
|
||||||
|
case "$state" in
|
||||||
|
running)
|
||||||
|
echo "Podman machine is already running."
|
||||||
|
;;
|
||||||
|
stopped)
|
||||||
|
echo "Starting podman machine..."
|
||||||
|
podman machine start
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
echo "Error: podman machine is in unexpected state: $state"
|
||||||
|
exit 1
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
case "$(uname -s)" in
|
||||||
|
Darwin*) resolved_ip=$(dscacheutil -q host -a name host.docker.internal 2>/dev/null | awk '/^ip_address:/{print $2; exit}') ;;
|
||||||
|
*) resolved_ip=$(getent hosts host.docker.internal 2>/dev/null | awk '{print $1}') ;;
|
||||||
|
esac
|
||||||
|
if [[ -z "$resolved_ip" ]] || ! echo "$resolved_ip" | grep -qE '^(127\.|::1$)'; then
|
||||||
|
echo "Adding host.docker.internal to /etc/hosts (requires sudo)..."
|
||||||
|
echo "127.0.0.1 host.docker.internal" | sudo tee -a /etc/hosts >/dev/null
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ ! -e /usr/local/bin/docker ]]; then
|
||||||
|
echo "Creating docker symlink to avoid issues with projects that do not inherit aliases (requires sudo)..."
|
||||||
|
sudo ln -s "$(command -v podman)" /usr/local/bin/docker
|
||||||
|
fi
|
||||||
@@ -25,7 +25,7 @@ bind '"' split-window -v -c "#{pane_current_path}"
|
|||||||
bind % split-window -h -c "#{pane_current_path}"
|
bind % split-window -h -c "#{pane_current_path}"
|
||||||
|
|
||||||
### set-environment -g PATH "$HOMEBREW_PREFIX/bin:$PATH"
|
### set-environment -g PATH "$HOMEBREW_PREFIX/bin:$PATH"
|
||||||
bind C-o popup -E -E -d "#{pane_current_path}" -w 90% -h 90% "opencode"
|
bind o popup -E -E -d "#{pane_current_path}" -w 66% -h 66%
|
||||||
|
|
||||||
bind-key -n C-S-Down next-window
|
bind-key -n C-S-Down next-window
|
||||||
bind-key -n C-S-Up previous-window
|
bind-key -n C-S-Up previous-window
|
||||||
|
|||||||
@@ -7,14 +7,13 @@ alias tmux_secondary_win='tmux new-session -t main -s secondary'
|
|||||||
# enable color support of ls and also add handy aliases
|
# enable color support of ls and also add handy aliases
|
||||||
alias ls='ls --color=auto'
|
alias ls='ls --color=auto'
|
||||||
alias grep='grep --color=auto'
|
alias grep='grep --color=auto'
|
||||||
alias fgrep='fgrep --color=auto'
|
alias fgrep='grep -F --color=auto'
|
||||||
alias egrep='egrep --color=auto'
|
alias egrep='grep -E --color=auto'
|
||||||
|
|
||||||
|
alias docker=podman
|
||||||
|
|
||||||
alias d='dirs -v'
|
alias d='dirs -v'
|
||||||
# shfmt needs to ignore this because it is a zsh specific syntax
|
for index in 1 2 3 4 5 6 7 8 9; do alias "c$index"="cd +${index}"; done; unset index
|
||||||
# shfmt:ignore:start
|
|
||||||
for index ({1..9}) alias "c$index"="cd +${index}"; unset index
|
|
||||||
# shfmt:ignore:end
|
|
||||||
|
|
||||||
alias kpget="keepassxc-cli show -a Password ${KEEPASS_DB}"
|
alias kpget="keepassxc-cli show -a Password ${KEEPASS_DB}"
|
||||||
alias kptotp="keepassxc-cli show -t ${KEEPASS_DB}"
|
alias kptotp="keepassxc-cli show -t ${KEEPASS_DB}"
|
||||||
@@ -26,7 +25,7 @@ _KP_KEYCHAIN_SVC="keepassxc-cli-cache"
|
|||||||
_KP_KEYCHAIN_ACCT="master-password"
|
_KP_KEYCHAIN_ACCT="master-password"
|
||||||
|
|
||||||
_kp_pw_store() {
|
_kp_pw_store() {
|
||||||
case "$(uname -s)" in
|
case "$UNAME_STRING" in
|
||||||
Darwin)
|
Darwin)
|
||||||
security add-generic-password -U \
|
security add-generic-password -U \
|
||||||
-s "$_KP_KEYCHAIN_SVC" -a "$_KP_KEYCHAIN_ACCT" -w "$1"
|
-s "$_KP_KEYCHAIN_SVC" -a "$_KP_KEYCHAIN_ACCT" -w "$1"
|
||||||
@@ -39,7 +38,7 @@ _kp_pw_store() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
_kp_pw_get() {
|
_kp_pw_get() {
|
||||||
case "$(uname -s)" in
|
case "$UNAME_STRING" in
|
||||||
Darwin)
|
Darwin)
|
||||||
security find-generic-password \
|
security find-generic-password \
|
||||||
-s "$_KP_KEYCHAIN_SVC" -a "$_KP_KEYCHAIN_ACCT" -w 2>/dev/null
|
-s "$_KP_KEYCHAIN_SVC" -a "$_KP_KEYCHAIN_ACCT" -w 2>/dev/null
|
||||||
@@ -52,7 +51,7 @@ _kp_pw_get() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
_kp_pw_clear() {
|
_kp_pw_clear() {
|
||||||
case "$(uname -s)" in
|
case "$UNAME_STRING" in
|
||||||
Darwin)
|
Darwin)
|
||||||
security delete-generic-password \
|
security delete-generic-password \
|
||||||
-s "$_KP_KEYCHAIN_SVC" -a "$_KP_KEYCHAIN_ACCT" &>/dev/null
|
-s "$_KP_KEYCHAIN_SVC" -a "$_KP_KEYCHAIN_ACCT" &>/dev/null
|
||||||
@@ -87,12 +86,30 @@ function load_gemini() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function totp() {
|
function totp() {
|
||||||
|
local clip=false
|
||||||
|
[[ "$1" == "-c" ]] && clip=true && shift
|
||||||
|
|
||||||
|
local code
|
||||||
case "$1" in
|
case "$1" in
|
||||||
hcf) kptotps "personal/Dev/AWS Console" ;;
|
hcf) code=$(kptotps "personal/Dev/AWS Console") ;;
|
||||||
aws) kptotps "work/Own/AWS console" ;;
|
aws) code=$(kptotps "work/Own/AWS console") ;;
|
||||||
pci) kptotps "work/Own/PCI/AWS Workspaces" ;;
|
pci) code=$(kptotps "work/Own/PCI/AWS Workspaces") ;;
|
||||||
*) echo "Usage: totp {hcf|aws|pci}" >&2; return 1 ;;
|
*) echo "Usage: totp [-c] {hcf|aws|pci}" >&2; return 1 ;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
|
echo "$code"
|
||||||
|
if $clip; then
|
||||||
|
case "$UNAME_STRING" in
|
||||||
|
Darwin) echo -n "$code" | pbcopy ;;
|
||||||
|
Linux) if [[ "$XDG_SESSION_TYPE" == "wayland" ]]; then
|
||||||
|
echo -n "$code" | wl-copy
|
||||||
|
else
|
||||||
|
echo -n "$code" | xclip -selection clipboard
|
||||||
|
fi ;;
|
||||||
|
|
||||||
|
esac
|
||||||
|
echo "(copied to clipboard)"
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
_get_aws_config_path() {
|
_get_aws_config_path() {
|
||||||
@@ -147,16 +164,23 @@ _awsume_cmd() {
|
|||||||
|
|
||||||
alias asm="_awsume_cmd"
|
alias asm="_awsume_cmd"
|
||||||
|
|
||||||
alias tf="terraform"
|
_ensure_awsume() {
|
||||||
alias tfi="tf init"
|
if [[ -z "$AWSUME_PROFILE" ]]; then
|
||||||
alias tfp="tf plan -lock=false"
|
echo "No awsume session found. Starting one..."
|
||||||
alias tfa="tf apply"
|
_awsume_cmd || return 1
|
||||||
alias tfu="tf get -update"
|
fi
|
||||||
alias tg="terragrunt"
|
}
|
||||||
alias tgi="tg init"
|
|
||||||
alias tgp="tg plan -lock=false"
|
tf() { _ensure_awsume && terraform "$@"; }
|
||||||
alias tga="tg apply"
|
tfi() { _ensure_awsume && terraform init "$@"; }
|
||||||
alias tgu="tg get -update"
|
tfp() { _ensure_awsume && terraform plan -lock=false "$@"; }
|
||||||
|
tfa() { _ensure_awsume && terraform apply "$@"; }
|
||||||
|
tfu() { _ensure_awsume && terraform get -update "$@"; }
|
||||||
|
tg() { _ensure_awsume && terragrunt "$@"; }
|
||||||
|
tgi() { _ensure_awsume && terragrunt init "$@"; }
|
||||||
|
tgp() { _ensure_awsume && terragrunt plan -lock=false "$@"; }
|
||||||
|
tga() { _ensure_awsume && terragrunt apply "$@"; }
|
||||||
|
tgu() { _ensure_awsume && terragrunt get -update "$@"; }
|
||||||
|
|
||||||
alias curltime="curl -w \"@$HOME/.curl-format.txt\" -o /dev/null -s "
|
alias curltime="curl -w \"@$HOME/.curl-format.txt\" -o /dev/null -s "
|
||||||
|
|
||||||
@@ -196,7 +220,7 @@ git_push() {
|
|||||||
local branch
|
local branch
|
||||||
branch=$(git branch --show-current)
|
branch=$(git branch --show-current)
|
||||||
|
|
||||||
git push origin "$branch" $@
|
git push origin "$branch" "$@"
|
||||||
}
|
}
|
||||||
|
|
||||||
alias gpush="git_push"
|
alias gpush="git_push"
|
||||||
@@ -204,7 +228,7 @@ alias gpush="git_push"
|
|||||||
passgen() {
|
passgen() {
|
||||||
length=${1:-"12"}
|
length=${1:-"12"}
|
||||||
if [[ "$length" == <-> ]]; then
|
if [[ "$length" == <-> ]]; then
|
||||||
echo $(cat /dev/urandom| base64 | head -c "$length")
|
echo $(cat /dev/urandom| base64 -w0 | head -c "$length")
|
||||||
else
|
else
|
||||||
echo "passgen() takes a positive integer as first argument"
|
echo "passgen() takes a positive integer as first argument"
|
||||||
echo "got $length"
|
echo "got $length"
|
||||||
|
|||||||
@@ -22,6 +22,8 @@ export SSH_ENV="$HOME/.ssh/agent-environment"
|
|||||||
|
|
||||||
export GOPRIVATE="gitlab.feedzai.com,git.hcf.zone"
|
export GOPRIVATE="gitlab.feedzai.com,git.hcf.zone"
|
||||||
|
|
||||||
|
export UNAME_STRING=$(uname -s)
|
||||||
|
|
||||||
. "$HOME/.cargo/env"
|
. "$HOME/.cargo/env"
|
||||||
|
|
||||||
# Interactive shells (e.g. new tmux windows): set PATH so we don't need a login shell.
|
# Interactive shells (e.g. new tmux windows): set PATH so we don't need a login shell.
|
||||||
@@ -30,7 +32,7 @@ if [[ -t 0 ]]; then
|
|||||||
export PATH=~/.local/bin:$PATH
|
export PATH=~/.local/bin:$PATH
|
||||||
export PATH=~/.dotnet:$PATH
|
export PATH=~/.dotnet:$PATH
|
||||||
export PATH=$DOTFILES/scripts/hcf/:$PATH
|
export PATH=$DOTFILES/scripts/hcf/:$PATH
|
||||||
case "$(uname -s)" in
|
case "$UNAME_STRING" in
|
||||||
Linux*) eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)" ;;
|
Linux*) eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)" ;;
|
||||||
Darwin*)
|
Darwin*)
|
||||||
eval "$(/opt/homebrew/bin/brew shellenv)"
|
eval "$(/opt/homebrew/bin/brew shellenv)"
|
||||||
|
|||||||
15
zsh/.zshrc
15
zsh/.zshrc
@@ -1,11 +1,8 @@
|
|||||||
setopt INC_APPEND_HISTORY
|
|
||||||
setopt EXTENDED_HISTORY # Write the history file in the ':start:elapsed;command' format.
|
setopt EXTENDED_HISTORY # Write the history file in the ':start:elapsed;command' format.
|
||||||
setopt HIST_EXPIRE_DUPS_FIRST # Expire a duplicate event first when trimming history.
|
setopt HIST_EXPIRE_DUPS_FIRST # Expire a duplicate event first when trimming history.
|
||||||
setopt HIST_FIND_NO_DUPS # Do not display a previously found event.
|
setopt HIST_FIND_NO_DUPS # Do not display a previously found event.
|
||||||
setopt HIST_IGNORE_ALL_DUPS # Delete an old recorded event if a new event is a duplicate.
|
setopt HIST_IGNORE_ALL_DUPS # Delete an old recorded event if a new event is a duplicate.
|
||||||
setopt HIST_IGNORE_DUPS # Do not record an event that was just recorded again.
|
|
||||||
setopt HIST_IGNORE_SPACE # Do not record an event starting with a space.
|
setopt HIST_IGNORE_SPACE # Do not record an event starting with a space.
|
||||||
unsetopt HIST_SAVE_NO_DUPS # Do not write a duplicate event to the history file.
|
|
||||||
setopt SHARE_HISTORY # Share history between all sessions.
|
setopt SHARE_HISTORY # Share history between all sessions.
|
||||||
|
|
||||||
bindkey -e
|
bindkey -e
|
||||||
@@ -25,15 +22,11 @@ setopt PUSHD_SILENT # Do not print the directory stack after pushd or popd.
|
|||||||
DISABLE_AUTO_TITLE="true"
|
DISABLE_AUTO_TITLE="true"
|
||||||
|
|
||||||
# install zsh-syntax-highlighting
|
# install zsh-syntax-highlighting
|
||||||
case "$(uname -s)" in
|
case "$UNAME_STRING" in
|
||||||
Linux*) {
|
Linux*) {
|
||||||
source /usr/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh
|
source /usr/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh
|
||||||
# make less more friendly for non-text input files, see lesspipe(1)
|
|
||||||
local lesspipe_bin_location
|
local lesspipe_bin_location
|
||||||
lesspipe_bin_location=$(which lesspipe)
|
(($+commands[lesspipe])) && eval "$(lesspipe)"
|
||||||
if [ $? -eq 0 ]; then
|
|
||||||
[ -x $lesspipe_bin_location ] && eval "$(lesspipe)"
|
|
||||||
fi
|
|
||||||
} ;;
|
} ;;
|
||||||
Darwin*) {
|
Darwin*) {
|
||||||
# Use HOMEBREW_PREFIX (set in .zshenv) to avoid slow brew --prefix subprocess on every new shell
|
# Use HOMEBREW_PREFIX (set in .zshenv) to avoid slow brew --prefix subprocess on every new shell
|
||||||
@@ -137,7 +130,3 @@ function +vi-git-extra() {
|
|||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
### MANAGED BY RANCHER DESKTOP START (DO NOT EDIT)
|
|
||||||
export PATH="/Users/inaki.dominguez/.rd/bin:$PATH"
|
|
||||||
### MANAGED BY RANCHER DESKTOP END (DO NOT EDIT)
|
|
||||||
|
|||||||
Submodule zsh/zsh-completions updated: 922abfe707...8b97eaf521
Reference in New Issue
Block a user