[CODE] essentials: install pip, customizable zshrc

This commit is contained in:
Jannik Beyerstedt 2020-03-19 18:17:57 +01:00 committed by Jannik Beyerstedt
parent 5fb94b33b3
commit 44558263b0
10 changed files with 153 additions and 7 deletions

View file

@ -25,6 +25,7 @@ The User Setup will change the user shell and global gitconfig. This can be disa
- `usersetup_gitconfig`: Boolean to disable overriding the global gitconfig (default: true)
* `gitconfig_name`: User's name in .gitconfig file (default: n.a.)
* `gitconfig_email`: User's email in .gitconfig file (default: n.a.)
- `usersetup_virtualenvwrapper`: Boolean to enable the virtualenvwrapper plugin in oh-my-zsh (default: false)
The development environment for different programming languages can be setup automatically.
To enable, that Visual Studio Code will be installed and configured, set `user_vscode` to true, otherwise only the bare development toolchain will be installed.

View file

@ -10,6 +10,9 @@ usersetup_chsh: true
# override global gitconfig
usersetup_gitconfig: true
# enable virtualenvwrapper plugin in oh-my-zsh
usersetup_virtualenvwrapper: false
# install VS Code and selectively activate different programming languages
user_vscode: false
user_lang_cpp: false

@ -1 +1 @@
Subproject commit f311d13eeaccdeab4dec4977c24b9dd4c3e8e92f
Subproject commit 4f8802334f8793e056dfe842657c67765d1fae9f

View file

@ -1,5 +1,5 @@
---
# Common/Essentials: Essential Utilities (git, curl; vim, tmux, zsh) - ArchLinux Version
# Common/Essentials: Essential Utilities (git, curl; vim, tmux, zsh, pip) - ArchLinux Version
- name: essentials - Install essential utilities
become: yes
@ -14,3 +14,4 @@
- zsh
- vim
- tmux
- python-pip

View file

@ -1,5 +1,5 @@
---
# Common/Essentials: Essential Utilities (git, curl; vim, tmux, zsh) - CentOS Version
# Common/Essentials: Essential Utilities (git, curl; vim, tmux, zsh, pip) - CentOS Version
- name: essentials - Install essential utilities
become: yes
@ -13,3 +13,14 @@
- zsh
- vim
- tmux
- name: essentials - Install pip - Activate EPEL
become: yes
yum:
name: epel-release
state: present
- name: essentials - Install pip - Install
become: yes
yum:
name: python-pip
state: present

View file

@ -1,5 +1,5 @@
---
# Common/Essentials: Essential Utilities (git, curl; vim, tmux, zsh) - macOS Version
# Common/Essentials: Essential Utilities (git, curl; vim, tmux, zsh, pip) - macOS Version
- name: essentials - Install essential utilities
package:
@ -12,3 +12,4 @@
- zsh
- vim
- tmux
- python # includes pip

View file

@ -1,5 +1,5 @@
---
# Common/Essentials: Essential Utilities (git, curl; vim, tmux, zsh) - Debian Version
# Common/Essentials: Essential Utilities (git, curl; vim, tmux, zsh, pip) - Debian Version
- name: essentials - Install essential utilities
become: yes
@ -14,3 +14,5 @@
- zsh
- vim
- tmux
- python-pip
- python3-pip

View file

@ -1,5 +1,5 @@
---
# Common/Essentials: Essential Utilities (git, curl; vim, tmux, zsh)
# Common/Essentials: Essential Utilities (git, curl; vim, tmux, zsh, pip)
- name: essentials - Install essential utilities
include_tasks: "{{ item }}"

View file

@ -16,6 +16,27 @@
when:
- fzf_git.after != fzf_git.before
- name: usersettings - Install pip virtualenvwrapper
block:
- name: usersettings - Install pip virtualenvwrapper (Debian)
become: yes
pip:
name: virtualenvwrapper
extra_args: --system
when: (override_os_family is defined) | ternary(override_os_family,ansible_os_family) == "Debian"
- name: usersettings - Install pip virtualenvwrapper (macOS)
environment:
PATH: "/usr/local/bin:{{ ansible_env.PATH }}"
pip:
name: virtualenvwrapper
when: (override_os_family is defined) | ternary(override_os_family,ansible_os_family) == "Darwin"
- name: usersettings - Install pip virtualenvwrapper (CentOS, ArchLinux)
become: yes
pip:
name: virtualenvwrapper
when: (override_os_family is defined) | ternary(override_os_family,ansible_os_family) == "Centos" or
(override_os_family is defined) | ternary(override_os_family,ansible_os_family) == "Archlinux"
when: usersetup_virtualenvwrapper
- name: usersettings - Copy dotfiles
copy:
src: "{{ item.src }}"
@ -24,9 +45,13 @@
- { src: "{{ role_path }}/files/dotfiles/_gitignore_global", dest: ".gitignore_global" }
- { src: "{{ role_path }}/files/dotfiles/_tmux.conf", dest: ".tmux.conf" }
- { src: "{{ role_path }}/files/dotfiles/_vimrc", dest: ".vimrc" }
- { src: "{{ role_path }}/files/dotfiles/_zshrc", dest: ".zshrc" }
- { src: "{{ role_path }}/files/dotfiles/_oh-my-zsh/custom/themes/agnoster.zsh-theme", dest: ".oh-my-zsh/custom/themes/agnoster.zsh-theme" }
- { src: "{{ role_path }}/files/dotfiles/_oh-my-zsh/custom/themes/jtbx.zsh-theme", dest: ".oh-my-zsh/custom/themes/jtbx.zsh-theme" }
- name: usersettings - Set zshrc
template:
src: "{{ role_path }}/templates/_zshrc.j2"
dest: "{{ ansible_user_dir }}/.zshrc"
when: usersetup_gitconfig == true
- name: usersettings - Set global gitconfig
template:
src: "{{ role_path }}/templates/_gitconfig.j2"

102
templates/_zshrc.j2 Normal file
View file

@ -0,0 +1,102 @@
# Unified zshrc of Jannik Beyerstedt
export TERM=xterm-256color
{% if usersetup_virtualenvwrapper|default(false)|bool %}
VIRTUALENVWRAPPER_PYTHON=$(which python3)
{% endif %}
DEFAULT_USER="jannik"
DISABLE_UPDATE_PROMPT=true
# If you come from bash you might have to change your $PATH.
# export PATH=$HOME/bin:/usr/local/bin:$PATH
# Path to your oh-my-zsh installation.
export ZSH=$HOME/.oh-my-zsh
# Set name of the theme to load.
ZSH_THEME="jtbx"
# Uncomment the following line to use case-sensitive completion.
# CASE_SENSITIVE="true"
# Case sensitive completion must be off. _ and - will be interchangeable.
# HYPHEN_INSENSITIVE="true"
# Oh-my-zsh Update settings
DISABLE_AUTO_UPDATE="true"
# export UPDATE_ZSH_DAYS=13
# Uncomment the following line to disable colors in ls.
# DISABLE_LS_COLORS="true"
# Uncomment the following line to disable auto-setting terminal title.
# DISABLE_AUTO_TITLE="true"
# Uncomment the following line to enable command auto-correction.
ENABLE_CORRECTION="true"
# Uncomment the following line to display red dots whilst waiting for completion.
# COMPLETION_WAITING_DOTS="true"
# This makes repository status check for large repositories much, much faster.
DISABLE_UNTRACKED_FILES_DIRTY="true"
# The optional three formats: "mm/dd/yyyy"|"dd.mm.yyyy"|"yyyy-mm-dd"
HIST_STAMPS="yyyy-mm-dd"
# Example format: plugins=(rails git textmate ruby lighthouse)
plugins=(
git
docker
docker-compose
fzf
pip
{% if usersetup_virtualenvwrapper|default(false)|bool %}
virtualenvwrapper
{% endif %}
)
source $ZSH/oh-my-zsh.sh
# User configuration
if [ "$(uname)" != "Darwin" ]; then
export LANG="en_US.UTF-8"
export LC_CTYPE="en_US.UTF-8"
export LC_NUMERIC="de_DE.UTF-8"
export LC_TIME="de_DE.UTF-8"
export LC_COLLATE="de_DE.UTF-8"
export LC_MONETARY="de_DE.UTF-8"
export LC_MESSAGES="en_US.UTF-8"
export LC_PAPER="de_DE.UTF-8"
export LC_NAME="de_DE.UTF-8"
export LC_ADDRESS="de_DE.UTF-8"
export LC_TELEPHONE="de_DE.UTF-8"
export LC_MEASUREMENT="de_DE.UTF-8"
else
export LANG="en_US.UTF-8"
fi
# load host specific settings
[[ -f "$HOME/.zshrc-host" ]] && source $HOME/.zshrc-host
# Preferred editor for local and remote sessions
# if [[ -n $SSH_CONNECTION ]]; then
# export EDITOR='vim'
# else
# export EDITOR='mvim'
# fi
# Set personal aliases, overriding those provided by oh-my-zsh libs,
# plugins, and themes. Aliases can be placed here, though oh-my-zsh
# users are encouraged to define aliases within the ZSH_CUSTOM folder.
# For a full list of active aliases, run `alias`.
alias pip3-upgrade="pip3 list --outdated --format=freeze | grep -v '^\-e' | cut -d = -f 1 | xargs -n1 pip3 install -U"
alias pip3-list-updates="pip3 list --outdated"
alias rsync-copy="rsync -avz --progress -h"
alias rsync-move="rsync -avz --progress -h --remove-source-files"
alias rsync-update="rsync -avzu --progress -h"
alias rsync-synchronize="rsync -avzu --delete --progress -h"
# stolen from: https://eldritch.cafe/@lexi/103707492979358755
alias doch='sudo sh -c "$(fc -n -l -- -1)"'