move most important config to ansible

This commit is contained in:
Johannes Knopp
2025-09-06 15:44:39 +02:00
parent 7770c4b5e4
commit 14e4d4fe3e
49 changed files with 179 additions and 327 deletions

52
roles/zsh/files/.zshrc Normal file
View File

@ -0,0 +1,52 @@
# If you come from bash you might have to change your $PATH.
# export PATH=$HOME/bin:$HOME/.local/bin:/usr/local/bin:$PATH
# Path to your Oh My Zsh installation.
export ZSH="$HOME/.oh-my-zsh"
ZSH_THEME="bira"
zstyle ':omz:update' mode reminder # just remind me to update when it's time
COMPLETION_WAITING_DOTS="true"
plugins=(
git
zsh-syntax-highlighting
zsh-autosuggestions
fzf-zsh-plugin
)
source $ZSH/oh-my-zsh.sh
# Preferred editor for local and remote sessions
if [[ -n $SSH_CONNECTION ]]; then
export EDITOR='vim'
else
export EDITOR='nvim'
fi
# TODO prettier solution?
DOTFILES_ZSH_DIR="${0:A:h}"
for zsh_file in "$DOTFILES_ZSH_DIR"/*.zsh; do
[[ -r "$zsh_file" ]] && source "$zsh_file"
done
# TODO source all files with .zsh suffix
# source ./aliases.zsh
# source ./dev_env.zsh
# source ./tools.zsh
# TODO
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion
if [[ -n "$MACHINE_TYPE" && -f "$HOME/dotfiles/zsh/hosts/$MACHINE_TYPE.zsh" ]]; then
source "$HOME/dotfiles/zsh/hosts/$MACHINE_TYPE.zsh"
fi
alias drun='docker run -it --network=host --device=/dev/kfd --device=/dev/dri --group-add=video --ipc=host --cap-add=SYS_PTRACE --security-opt seccomp=unconfined'

View File

@ -0,0 +1,14 @@
alias vim='nvim'
alias tp='trash-put'
alias tl='trash-list'
alias szrc='source ~/.zshrc'
alias dotf='vim ~/dotfiles/'
rm() {
print " Consider using trash-put instead of rm"
print "➡️ Running: trash-put $*"
print "⚠️ To use real rm, use /bin/rm"
trash-put "$@"
}

View File

@ -0,0 +1,8 @@
# export DJANGO_SETTINGS_MODULE=config.settings.dev
export DATABASE_HOST=127.0.0.1
export DATABASE_NAME=cerenim
export DATABASE_USER=brainhero
export DATABASE_PORT=5432
export DATABASE_DJANGO_SCHEMA=django
export SECRET_KEY=abasdjkasd
export DATABASE_PASSWORD=abcdefghijk

View File

@ -0,0 +1,7 @@
eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"
export ANDROID_HOME=/home/johannes/Android/Sdk
export PATH=$HOME/.local/bin:$PATH
export PATH=$PATH:$ANDROID_HOME/emulator
export PATH=$PATH:$ANDROID_HOME/platform-tools

View File

@ -0,0 +1 @@
. "$HOME/.local/bin/env"

View File

@ -0,0 +1 @@
source /usr/share/autojump/autojump.zsh

24
roles/zsh/tasks/main.yaml Normal file
View File

@ -0,0 +1,24 @@
---
- name: Install zsh
package:
name: zsh
state: present
- name: Install oh-my-zsh
shell: |
sh -c "$(curl -fsSL https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh)" --unattended
args:
creates: "{{ ansible_env.HOME }}/.oh-my-zsh"
- name: Check for custom zshrc
stat:
path: "{{ role_path }}/files/.zshrc"
register: custom_zshrc
- name: Symlink custom zshrc
file:
src: "{{ role_path }}/files/.zshrc"
dest: "{{ ansible_env.HOME }}/.zshrc"
state: link
force: yes
when: custom_zshrc.stat.exists