diff --git a/states/zsh/config.sls b/states/zsh/config.sls index b22995c..ee3e00b 100644 --- a/states/zsh/config.sls +++ b/states/zsh/config.sls @@ -24,4 +24,4 @@ zsh-omz-profile: - mode: 0644 - template: jinja - require: - - pkg: zsh-pkg + - pkg: zsh-pkg \ No newline at end of file diff --git a/states/zsh/defaults.yaml b/states/zsh/defaults.yaml index 7aa63cf..0f835ff 100644 --- a/states/zsh/defaults.yaml +++ b/states/zsh/defaults.yaml @@ -1,4 +1,8 @@ --- zsh: enabled: true - config: {} + config: + minimal: false + golang: true + rust: true + android: false \ No newline at end of file diff --git a/states/zsh/map.jinja b/states/zsh/map.jinja new file mode 100644 index 0000000..803a4ec --- /dev/null +++ b/states/zsh/map.jinja @@ -0,0 +1,6 @@ +{%- import_yaml "zsh/defaults.yaml" as default_settings -%} + +{%- set defaults = salt['grains.filter_by'](default_settings, default='zsh') -%} + +{%- set zsh = salt['pillar.get']('zsh', default=defaults, merge=True) -%} +{%- set users = salt['pillar.get']('users', default=defaults, merge=True) -%} \ No newline at end of file diff --git a/states/zsh/users.sls b/states/zsh/users.sls index a527463..faf1e1d 100644 --- a/states/zsh/users.sls +++ b/states/zsh/users.sls @@ -1,5 +1,5 @@ --- -{%- from "users/map.jinja" import users with context -%} +{%- from "zsh/map.jinja" import users with context %} {%- for user in users %} {%- if user.enabled %} zshrc-user-{{ user.name }}: diff --git a/states/zsh/zprofile.j2 b/states/zsh/zprofile.j2 index f8f421f..b926985 100644 --- a/states/zsh/zprofile.j2 +++ b/states/zsh/zprofile.j2 @@ -1,10 +1,11 @@ ## {{ salt['pillar.get']('salt_managed', default='Salt Managed') }} +{%- from "zsh/map.jinja" import zsh with context %} # Main environments variables export EDITOR=vim export JAVA_OPTS='-XX:+IgnoreUnrecognizedVMOptions --add-modules java.se.ee' - +{% if zsh.config.golang -%} # Golang settings if [[ -d /usr/local/apps/go ]] then @@ -12,44 +13,44 @@ then export GOROOT=/usr/local/apps/go export PATH=$PATH:$GOROOT/bin:$GOPATH/bin fi +{%- endif %} - +{% if zsh.config.rust -%} # Rust settings if [[ -d ~/.cargo/bin ]] then export PATH=$PATH:$HOME/.cargo/bin fi +{%- endif %} - +{% if zsh.config.android -%} # Android settings if [[ -d ~/Android ]] then export ANDROID_SDK_ROOT=~/Android fi - +{%- endif %} # Oh my ZSH settings export ZSH=/usr/share/oh-my-zsh ZSH_THEME="jreese" DISABLE_AUTO_UPDATE="true" +{%- if zsh.config.minimal %} +plugins=(common-aliases docker) +{%- else %} plugins=(common-aliases sudo docker salt git ansible command-not-found systemd python nmap zsh-autosuggestions) +{%- endif %} +{# #for example #plugins=(common-aliases sudo docker salt git ansible command-not-found virtualenvwrapper tmux systemd python golang nmap) +#} if [[ -f $ZSH/oh-my-zsh.sh ]] then source $ZSH/oh-my-zsh.sh fi - -# Acme settings -if [[ -f /root/.acme.sh/acme.sh.env ]] -then - . /root/.acme.sh/acme.sh.env -fi - - # Misc settings bindkey -e unsetopt share_history \ No newline at end of file