diff options
| author | Paul Buetow <paul@buetow.org> | 2026-01-30 10:28:38 +0200 |
|---|---|---|
| committer | Paul Buetow <paul@buetow.org> | 2026-01-30 10:28:38 +0200 |
| commit | 8af094546362c71ec416940837c0f85c77103050 (patch) | |
| tree | fd70e8110bb86c88ecc738cb5dfde33d845927b2 | |
| parent | 73b30f425b46ffb1e3da3c382963e6f11212b60d (diff) | |
Add ZSH configuration with Darwin-specific deployment
- Add home_zsh Rex task that deploys .zshrc only on macOS
- Include .zshrc with time-based .nofish cleanup logic
- Use stat -f %m for macOS compatibility when checking file age
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
| -rw-r--r-- | dotfiles/Rexfile | 10 | ||||
| -rw-r--r-- | dotfiles/zsh/.zshrc | 22 |
2 files changed, 32 insertions, 0 deletions
diff --git a/dotfiles/Rexfile b/dotfiles/Rexfile index c89fd12..f6a3a39 100644 --- a/dotfiles/Rexfile +++ b/dotfiles/Rexfile @@ -157,6 +157,16 @@ task 'home_bash', sub { ensure "$DOT/bash/bashrc" => "$HOME/.bashrc"; }; +desc 'Install ZSH configuration'; +task 'home_zsh', sub { + if ( $^O eq 'darwin' ) { + ensure "$DOT/zsh/.zshrc" => "$HOME/.zshrc"; + } + else { + Rex::Logger::info('Skipping ZSH configuration (not on macOS)', 'warn'); + } +}; + desc 'Install fish configuration'; task 'home_fish', sub { diff --git a/dotfiles/zsh/.zshrc b/dotfiles/zsh/.zshrc new file mode 100644 index 0000000..f1241af --- /dev/null +++ b/dotfiles/zsh/.zshrc @@ -0,0 +1,22 @@ +if [ -f $HOME/.nofish ]; then + current_time=$(date +%s) + file_time=$(stat -f %m $HOME/.nofish) + time_diff=$((current_time - file_time)) + if [ $time_diff -gt 3600 ]; then + rm -vf $HOME/.nofish + fi +fi +if [ ! -f $HOME/.nofish ]; then + if [ -e /opt/homebrew/bin/fish ]; then + exec /opt/homebrew/bin/fish + elif [ -e /bin/fish ]; then + exec /bin/fish + elif [ -e /usr/bin/fish ]; then + exec /usr/bin/fish + elif [ -e /data/data/com.termux/files/usr/bin/fish ]; then + exec /data/data/com.termux/files/usr/bin/fish + fi + echo 'I might want to install fish on this host' +fi + +alias f=fish |
