Skip to content

Commit

Permalink
feat(zsh): Resolve issues with ZSH + runner
Browse files Browse the repository at this point in the history
  • Loading branch information
sylus committed Feb 23, 2024
1 parent 95d80f5 commit 44a4fe3
Show file tree
Hide file tree
Showing 7 changed files with 17 additions and 19 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/github.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ jobs:
- name: Switch to ZSH
if: runner.os == 'macOS'
shell: /opt/homebrew/bin/zsh {0}
shell: /usr/local/bin/zsh {0}
run: |
source ~/.zshenv
~/.local/bin/check-dotfiles
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,21 @@
# Install XCode
xcode-select -p >/dev/null 2>&1 || xcode-select --install

{{- if .host.headless }}
# Install Visual Studio Code
curl -fsSL -o vscode.zip https://code.visualstudio.com/sha/download?build=stable\&os=darwin-universal
unzip -q vscode.zip
rm vscode.zip
mv "Visual Studio Code.app" /Applications/
ln -s "/Applications/Visual Studio Code.app/Contents/Resources/app/bin/code" /usr/local/bin/code
{{- end }}

if ! command -v brew >/dev/null 2>&1; then
echo "Installing Homebrew..."
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
fi

{{ if eq .host.arch "arm64" -}}
{{- if eq .host.arch "arm64" }}
eval $(/opt/homebrew/bin/brew shellenv)
{{- else }}
eval $(/usr/local/bin/brew shellenv)
Expand Down
1 change: 1 addition & 0 deletions home/.chezmoitemplates/darwin/brewfile
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@
"qlstephen"
"slack"
"spectacle"
"visual-studio-code"
-}}

{{- range ($taps | sortAlpha | uniq) }}
Expand Down
1 change: 1 addition & 0 deletions home/.chezmoitemplates/universal/packages
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{{- $packages := list
"ack"
"age"
"awk"
"bash"
"bat"
"cmake"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,13 +81,6 @@ setup() {
assert_success
}

{{ if eq .host.distro.family "darwin" }}
@test "mas" {
run mas
assert_success
}
{{ end }}

{{ if .toolchains.docker }}
@test "docker" {
run docker --help
Expand Down
4 changes: 4 additions & 0 deletions home/private_dot_config/shell/dot_bash_exports.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -75,15 +75,19 @@ export ZSH_EVALCACHE_DIR="$XDG_CACHE_HOME/zsh-evalcache"

# GPG
# https://stackoverflow.com/a/42265848/96656
{{- if not .host.headless }}
export GPG_TTY=$(tty);
{{- end }}

# Hyper
{{- if eq .host.distro.family "darwin" }}
{{- if not .host.headless }}
launchctl setenv XDG_CONFIG_HOME "$XDG_CONFIG_HOME"
launchctl setenv XDG_DATA_HOME "$XDG_DATA_HOME"
launchctl setenv XDG_CACHE_HOME "$XDG_CACHE_HOME"
launchctl setenv PATH "$PATH"
{{- end }}
{{- end }}

# NodeJS
export NODE_REPL_HISTORY_SIZE='32768';
Expand Down
17 changes: 7 additions & 10 deletions home/private_dot_config/zsh/dot_zshrc.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,12 @@ export HOMEBREW_NO_AUTO_UPDATE=1
eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"
{{- end }}

{{ if eq .chezmoi.os "darwin" -}}
{{- if eq .chezmoi.os "darwin" }}
{{- if eq .host.arch "arm64" }}
eval "$(/opt/homebrew/bin/brew shellenv)"
{{- else }}
eval "$(/usr/local/bin/brew shellenv)"
{{- end }}
{{- end }}

# Powerlevel10k Configuration
Expand Down Expand Up @@ -131,21 +135,12 @@ setopt rm_star_silent
# -----------------------------------------------------------------------------

export NVM_DIR="$HOME/.nvm"
[ -s "/opt/homebrew/opt/nvm/nvm.sh" ] && \. "/opt/homebrew/opt/nvm/nvm.sh"
[ -s "/opt/homebrew/opt/nvm/etc/bash_completion.d/nvm" ] && \. "/opt/homebrew/opt/nvm/etc/bash_completion.d/nvm"

# Python Configuration
# -----------------------------------------------------------------------------

ln -sf "$(brew --prefix)/bin/python"{3,}

{{ if eq .chezmoi.os "darwin" -}}
# Visual Studio Code Configuration
# -----------------------------------------------------------------------------

# Add Visual Studio Code (code)
export PATH="\$PATH:/Applications/Visual Studio Code.app/Contents/Resources/app/bin"
{{- end }}

# Includes
# -----------------------------------------------------------------------------
Expand All @@ -165,6 +160,7 @@ if [ -f "$HOME"/.config/shell/.bash_functions ]; then
\. "$HOME"/.config/shell/.bash_functions
fi

{{- if eq .chezmoi.os "linux" }}
{{- if .toolchains.kubernetes }}
# Load cross-compatible Kubernetes alias definitions from separate file.
if [ -f "$HOME"/.config/kubernetes/.kube_aliases ]; then
Expand All @@ -176,3 +172,4 @@ if [ -f "$HOME"/.config/kubernetes/.kube_functions ]; then
\. "$HOME"/.config/kubernetes/.kube_functions
fi
{{- end }}
{{- end }}

0 comments on commit 44a4fe3

Please sign in to comment.