ENH use config switches to control bootstrap scripts

This commit is contained in:
Nathan Dwarshuis 2022-07-20 23:11:57 -04:00
parent bb98297669
commit 1dd1ac18e5
6 changed files with 60 additions and 64 deletions

View File

@ -2,9 +2,15 @@ diff:
args: --color args: --color
pager: less -r pager: less -r
{{- $desktop := promptBool "desktop" false }} {{ $desktop := promptBool "desktop" false -}}
{{- $laptop := and $desktop (promptBool "laptop" false) }} {{- $laptop := and $desktop (promptBool "laptop" false) -}}
{{- $emacs := and $desktop (promptBool "emacs" true) }} {{- $emacs := and $desktop (promptBool "emacs" true) -}}
{{- $xdg_config_home := .chezmoi.homeDir | printf "%s/.config" -}}
{{- $xdg_cache_home := .chezmoi.homeDir | printf "%s/.cache" -}}
{{- $xdg_data_home := .chezmoi.homeDir | printf "%s/.local/share" -}}
{{- $xdg_runtime_dir := output "id" "-u" | trim | printf "/run/user/%s" -}}
data: data:
desktop: {{ $desktop }} desktop: {{ $desktop }}
laptop: {{ $laptop }} laptop: {{ $laptop }}
@ -17,15 +23,23 @@ data:
f5vpn: {{ and $desktop (promptBool "f5vpn" false) }} f5vpn: {{ and $desktop (promptBool "f5vpn" false) }}
seafile: {{ and $desktop (promptBool "seafile" false) }} seafile: {{ and $desktop (promptBool "seafile" false) }}
development: development:
{{- /* emacs implies that most development options are true */}}
{{- /* emacs implies that most development options are true */}}
emacs: {{ $emacs }} emacs: {{ $emacs }}
ruby: {{ or $emacs promptBool "ruby development" true }} ruby: {{ or $emacs promptBool "ruby" true }}
python: {{ or $emacs promptBool "python development" true }} python: {{ or $emacs promptBool "python" true }}
rust: {{ or $emacs promptBool "rust development" true }} rust: {{ or $emacs promptBool "rust" true }}
clojure: {{ or $emacs promptBool "clojure development" true }} clojure: {{ or $emacs promptBool "clojure" true }}
latex: {{ or $emacs promptBool "LaTeX development" true }} latex: {{ or $emacs promptBool "LaTeX" true }}
r: {{ or $emacs promptBool "R development" true }} r: {{ or $emacs promptBool "R" true }}
conda: {{ or $emacs promptBool "conda" true }} conda: {{ or $emacs promptBool "conda" true }}
{{- /* these aren't implied by emacs */}}
matlab: {{ or $emacs promptBool "MATLAB development" true }} {{- /* these aren't implied by emacs */}}
github: {{ promptBool "GitHub development" true }} matlab: {{ or $emacs promptBool "MATLAB" true }}
github: {{ promptBool "GitHub" true }}
paths:
config: {{ $xdg_config_home }}
cache: {{ $xdg_cache_home }}
data: {{ $xdg_data_home }}
runtime: {{ $xdg_runtime_dir }}
stack: {{ $xdg_data_home }}/stack

View File

@ -1,18 +1,22 @@
{{- if eq .chezmoi.hostname "petrucci4prez" }} {{- if .development.emacs }}
.config/emacs: .config/emacs:
type: git-repo type: git-repo
url: https://github.com/ndwarshuis/.emacs.d.git url: https://github.com/ndwarshuis/.emacs.d.git
{{- end }}
{{- if .desktop }}
.config/rofi-extras: .config/rofi-extras:
type: git-repo type: git-repo
url: https://github.com/ndwarshuis/rofi-extras.git url: https://github.com/ndwarshuis/rofi-extras.git
.config/xman:
type: git-repo
url: https://github.com/ndwarshuis/xman.git
.config/xmonad: .config/xmonad:
type: git-repo type: git-repo
url: https://github.com/ndwarshuis/xmonad-config.git url: https://github.com/ndwarshuis/xmonad-config.git
.config/conky: .config/conky:
type: git-repo type: git-repo
url: https://github.com/ndwarshuis/conky.git url: https://github.com/ndwarshuis/universal-conky.git
clone-args: --recurse-submodules clone-args: --recurse-submodules
{{- end }} {{- end }}
{{- if .features.virtualbox }}
.config/xman:
type: git-repo
url: https://github.com/ndwarshuis/xman.git
{{- end }}

View File

@ -14,8 +14,10 @@ run_stack_in_dir () {
cd "$cur" || return 1 cd "$cur" || return 1
} }
export STACK_ROOT=~/.local/share/stack export STACK_ROOT={{ .paths.stack }}
run_stack_in_dir ~/.config/rofi-extras run_stack_in_dir ~/.config/rofi-extras
run_stack_in_dir ~/.config/xmonad run_stack_in_dir ~/.config/xmonad
{{ if .features.virtualbox -}}
run_stack_in_dir ~/.config/xman run_stack_in_dir ~/.config/xman
{{- end }}

View File

@ -46,33 +46,32 @@ run_install_scripts() {
} }
run_yay() { run_yay() {
dunst_pkgs=(dunst) # notifications
gtk_pkgs=(zuki-themes) pkgs=(dunst)
redshift_pkgs=(redshift) # gtk
seafile_pkgs=(seafile-client) pkgs+=(zuki-themes)
urxvt_pkgs=(rxvt-unicode urxvt-perls) # sleep enhancement
zsh_pkgs=(zsh zsh-completions zsh-syntax-highlighting) pkgs+=(redshift)
{{ if .features.seafile -}}
# seafile
pkgs+=(seafile-client)
{{- end }}
# elegant terminal
pkgs+=(rxvt-unicode urxvt-perls)
# shell
pkgs+=(zsh zsh-completions zsh-syntax-highlighting)
## AUR pkgs needed for spotify yay --needed --noconfirm --norebuild --removemake -S "${pkgs[@]}"
spotify_pkgs=(gconf)
yay --needed --noconfirm --norebuild --removemake -S \
"${dunst_pkgs[@]}" \
"${gtk_pkgs[@]}" \
"${redshift_pkgs[@]}" \
"${seafile_pkgs[@]}" \
"${urxvt_pkgs[@]}" \
"${zsh_pkgs[@]}" \
"${spotify_pkgs[@]}"
} }
run_makepkg() { run_makepkg() {
## these are all packages that have some personal customizations and/or are ## these are all packages that have some personal customizations and/or are
## not in the AUR ## not in the AUR
## TODO the clevo thingy requires a systemd file to turn on/off ## TODO the clevo thingy requires a systemd file to turn on/off
{{ if .features.clevo -}}
call_makepkg "clevo-xsm-wmi-dkms" call_makepkg "clevo-xsm-wmi-dkms"
{{- end }}
call_makepkg "conky-lua" call_makepkg "conky-lua"
call_makepkg "spotify"
call_makepkg "xkb-hypermode" call_makepkg "xkb-hypermode"
} }

View File

@ -1,23 +0,0 @@
#! /bin/bash
# This script pulls all my git repos that I use in my config and builds whatever
# is in them as necessary. It will only pull them if they don't exist. Rather
# than use the import approach suggested in the chezmoi howto, this doesn't
# require me to keep 'syncing' changes when I work in these repos directly. The
# tradeoff is that it will only pull the latest master, which is totally fine
# with me.
clone_maybe () {
if [ ! -d "$2" ]; then
echo cloning git repo: "$1"
git clone --recurse-submodules "$1" "$2"
else
echo git repo already exists: "$1"
fi
}
clone_maybe https://github.com/ndwarshuis/.emacs.d.git ~/.config/emacs
clone_maybe https://github.com/ndwarshuis/rofi-extras.git ~/.config/rofi-extras
clone_maybe https://github.com/ndwarshuis/xman.git ~/.config/xman
clone_maybe https://github.com/ndwarshuis/xmonad-config.git ~/.config/xmonad
clone_maybe https://github.com/ndwarshuis/conky.git ~/.config/conky

View File

@ -2,10 +2,10 @@
PATH OVERRIDE={{ .chezmoi.homeDir }}/.bin:{{ .chezmoi.homeDir }}/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/bin:/bin PATH OVERRIDE={{ .chezmoi.homeDir }}/.bin:{{ .chezmoi.homeDir }}/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/bin:/bin
# default directories # default directories
XDG_CONFIG_HOME DEFAULT={{ .chezmoi.homeDir }}/.config XDG_CONFIG_HOME DEFAULT={{ .paths.config }}
XDG_CACHE_HOME DEFAULT={{ .chezmoi.homeDir }}/.cache XDG_CACHE_HOME DEFAULT={{ .paths.cache }}
XDG_DATA_HOME DEFAULT={{ .chezmoi.homeDir }}/.local/share XDG_DATA_HOME DEFAULT={{ .paths.data }}
XDG_RUNTIME_DIR DEFAULT=/run/user/{{ output "id" "-u" | trim }} XDG_RUNTIME_DIR DEFAULT={{ .paths.runtime }}
# super common tools # super common tools
PAGER DEFAULT=less PAGER DEFAULT=less