From 1dd1ac18e5a27b9798c43cff51afca4391cfb8a0 Mon Sep 17 00:00:00 2001 From: ndwarshuis Date: Wed, 20 Jul 2022 23:11:57 -0400 Subject: [PATCH] ENH use config switches to control bootstrap scripts --- .chezmoi.yaml.tmpl | 40 +++++++++++++------ .chezmoiexternal.yaml | 14 ++++--- ..._build => executable_bootstrap_build.tmpl} | 4 +- ...ap_pkgs => executable_bootstrap_pkgs.tmpl} | 35 ++++++++-------- dot_bin/executable_bootstrap_repos | 23 ----------- dot_pam_environment.tmpl | 8 ++-- 6 files changed, 60 insertions(+), 64 deletions(-) rename dot_bin/{executable_bootstrap_build => executable_bootstrap_build.tmpl} (85%) rename dot_bin/{executable_bootstrap_pkgs => executable_bootstrap_pkgs.tmpl} (75%) delete mode 100644 dot_bin/executable_bootstrap_repos diff --git a/.chezmoi.yaml.tmpl b/.chezmoi.yaml.tmpl index 78973a3..4d973d5 100644 --- a/.chezmoi.yaml.tmpl +++ b/.chezmoi.yaml.tmpl @@ -2,9 +2,15 @@ diff: args: --color pager: less -r -{{- $desktop := promptBool "desktop" false }} -{{- $laptop := and $desktop (promptBool "laptop" false) }} -{{- $emacs := and $desktop (promptBool "emacs" true) }} +{{ $desktop := promptBool "desktop" false -}} +{{- $laptop := and $desktop (promptBool "laptop" false) -}} +{{- $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: desktop: {{ $desktop }} laptop: {{ $laptop }} @@ -17,15 +23,23 @@ data: f5vpn: {{ and $desktop (promptBool "f5vpn" false) }} seafile: {{ and $desktop (promptBool "seafile" false) }} development: -{{- /* emacs implies that most development options are true */}} + + {{- /* emacs implies that most development options are true */}} emacs: {{ $emacs }} - ruby: {{ or $emacs promptBool "ruby development" true }} - python: {{ or $emacs promptBool "python development" true }} - rust: {{ or $emacs promptBool "rust development" true }} - clojure: {{ or $emacs promptBool "clojure development" true }} - latex: {{ or $emacs promptBool "LaTeX development" true }} - r: {{ or $emacs promptBool "R development" true }} + ruby: {{ or $emacs promptBool "ruby" true }} + python: {{ or $emacs promptBool "python" true }} + rust: {{ or $emacs promptBool "rust" true }} + clojure: {{ or $emacs promptBool "clojure" true }} + latex: {{ or $emacs promptBool "LaTeX" true }} + r: {{ or $emacs promptBool "R" true }} conda: {{ or $emacs promptBool "conda" true }} -{{- /* these aren't implied by emacs */}} - matlab: {{ or $emacs promptBool "MATLAB development" true }} - github: {{ promptBool "GitHub development" true }} + + {{- /* these aren't implied by emacs */}} + 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 diff --git a/.chezmoiexternal.yaml b/.chezmoiexternal.yaml index 6634541..cf34fd1 100644 --- a/.chezmoiexternal.yaml +++ b/.chezmoiexternal.yaml @@ -1,18 +1,22 @@ -{{- if eq .chezmoi.hostname "petrucci4prez" }} +{{- if .development.emacs }} .config/emacs: type: git-repo url: https://github.com/ndwarshuis/.emacs.d.git +{{- end }} +{{- if .desktop }} .config/rofi-extras: type: git-repo url: https://github.com/ndwarshuis/rofi-extras.git -.config/xman: - type: git-repo - url: https://github.com/ndwarshuis/xman.git .config/xmonad: type: git-repo url: https://github.com/ndwarshuis/xmonad-config.git .config/conky: type: git-repo - url: https://github.com/ndwarshuis/conky.git + url: https://github.com/ndwarshuis/universal-conky.git clone-args: --recurse-submodules {{- end }} +{{- if .features.virtualbox }} +.config/xman: + type: git-repo + url: https://github.com/ndwarshuis/xman.git +{{- end }} diff --git a/dot_bin/executable_bootstrap_build b/dot_bin/executable_bootstrap_build.tmpl similarity index 85% rename from dot_bin/executable_bootstrap_build rename to dot_bin/executable_bootstrap_build.tmpl index 5be452f..f8f3da3 100644 --- a/dot_bin/executable_bootstrap_build +++ b/dot_bin/executable_bootstrap_build.tmpl @@ -14,8 +14,10 @@ run_stack_in_dir () { 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/xmonad +{{ if .features.virtualbox -}} run_stack_in_dir ~/.config/xman +{{- end }} diff --git a/dot_bin/executable_bootstrap_pkgs b/dot_bin/executable_bootstrap_pkgs.tmpl similarity index 75% rename from dot_bin/executable_bootstrap_pkgs rename to dot_bin/executable_bootstrap_pkgs.tmpl index f54fd31..4c1c8ba 100644 --- a/dot_bin/executable_bootstrap_pkgs +++ b/dot_bin/executable_bootstrap_pkgs.tmpl @@ -46,33 +46,32 @@ run_install_scripts() { } run_yay() { - dunst_pkgs=(dunst) - gtk_pkgs=(zuki-themes) - redshift_pkgs=(redshift) - seafile_pkgs=(seafile-client) - urxvt_pkgs=(rxvt-unicode urxvt-perls) - zsh_pkgs=(zsh zsh-completions zsh-syntax-highlighting) + # notifications + pkgs=(dunst) + # gtk + pkgs+=(zuki-themes) + # sleep enhancement + 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 - spotify_pkgs=(gconf) - - yay --needed --noconfirm --norebuild --removemake -S \ - "${dunst_pkgs[@]}" \ - "${gtk_pkgs[@]}" \ - "${redshift_pkgs[@]}" \ - "${seafile_pkgs[@]}" \ - "${urxvt_pkgs[@]}" \ - "${zsh_pkgs[@]}" \ - "${spotify_pkgs[@]}" + yay --needed --noconfirm --norebuild --removemake -S "${pkgs[@]}" } run_makepkg() { ## these are all packages that have some personal customizations and/or are ## not in the AUR ## TODO the clevo thingy requires a systemd file to turn on/off + {{ if .features.clevo -}} call_makepkg "clevo-xsm-wmi-dkms" + {{- end }} call_makepkg "conky-lua" - call_makepkg "spotify" call_makepkg "xkb-hypermode" } diff --git a/dot_bin/executable_bootstrap_repos b/dot_bin/executable_bootstrap_repos deleted file mode 100644 index 619d4b3..0000000 --- a/dot_bin/executable_bootstrap_repos +++ /dev/null @@ -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 diff --git a/dot_pam_environment.tmpl b/dot_pam_environment.tmpl index e49bbb7..b70e934 100644 --- a/dot_pam_environment.tmpl +++ b/dot_pam_environment.tmpl @@ -2,10 +2,10 @@ PATH OVERRIDE={{ .chezmoi.homeDir }}/.bin:{{ .chezmoi.homeDir }}/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/bin:/bin # default directories -XDG_CONFIG_HOME DEFAULT={{ .chezmoi.homeDir }}/.config -XDG_CACHE_HOME DEFAULT={{ .chezmoi.homeDir }}/.cache -XDG_DATA_HOME DEFAULT={{ .chezmoi.homeDir }}/.local/share -XDG_RUNTIME_DIR DEFAULT=/run/user/{{ output "id" "-u" | trim }} +XDG_CONFIG_HOME DEFAULT={{ .paths.config }} +XDG_CACHE_HOME DEFAULT={{ .paths.cache }} +XDG_DATA_HOME DEFAULT={{ .paths.data }} +XDG_RUNTIME_DIR DEFAULT={{ .paths.runtime }} # super common tools PAGER DEFAULT=less