mirror of
https://github.com/prdlk/dotfiles.git
synced 2026-11-02 11:32:42 +00:00
feat(scripts): automate tool and AUR package installation setup
This commit is contained in:
1 parent
fd1fd0cc16
commit
58b6c10779
4 files changed
+99
-20
No files matched your search
@@ -0,0 +1,58 @@
|
||||
#!/bin/sh
|
||||
# Tools that come from their own installers rather than pacman/Homebrew:
|
||||
# rustup (cargo) and the packages.shared.cargo crates, the
|
||||
# packages.shared.mise tools (omp, opencode, …), and strata on Linux desktop
|
||||
# roles. Runs before 20-gh-extensions, whose fish session sources
|
||||
# ~/.cargo/env.fish (conf.d/rustup.fish) and activates mise.
|
||||
# cargo hash: {{ .packages.shared.cargo | toJson | sha256sum }}
|
||||
# mise hash: {{ .packages.shared.mise | toJson | sha256sum }}
|
||||
set -eu
|
||||
|
||||
# Where rustup puts cargo; chezmoi's environment can predate the shell config
|
||||
# that adds it.
|
||||
PATH="$HOME/.cargo/bin:$PATH"
|
||||
export PATH
|
||||
|
||||
# rustup: -y answers its prompt (no tty under chezmoi); --no-modify-path keeps
|
||||
# it out of the shell rc files, which are symlinks into this repo and already
|
||||
# source ~/.cargo/env (bash, zsh, fish conf.d/rustup.fish).
|
||||
if ! command -v cargo >/dev/null 2>&1; then
|
||||
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --no-modify-path
|
||||
fi
|
||||
|
||||
installed=$(cargo install --list | awk '/^[^ ]/{print $1}')
|
||||
{{ range .packages.shared.cargo -}}
|
||||
echo "$installed" | grep -qx {{ . | quote }} || cargo install --locked {{ . | quote }}
|
||||
{{ end }}
|
||||
|
||||
# Global mise tools. Only tools absent from the global config are added, so a
|
||||
# local pin (node = "22") is never rewritten to latest; `mise install` then
|
||||
# fetches any configured version that is not installed yet.
|
||||
if command -v mise >/dev/null 2>&1; then
|
||||
global=$(mise ls --global --json)
|
||||
missing=''
|
||||
for tool in{{ range .packages.shared.mise }} {{ . | quote }}{{ end }}; do
|
||||
echo "$global" | jq -e --arg t "$tool" 'has($t)' >/dev/null || missing="$missing $tool"
|
||||
done
|
||||
# shellcheck disable=SC2086 # one word per tool
|
||||
[ -z "$missing" ] || mise use -g $missing
|
||||
mise install{{ range .packages.shared.mise }} {{ . | quote }}{{ end }}
|
||||
# omp's own installer (omp.sh/install) put a binary in ~/.local/bin, which
|
||||
# precedes mise's shims on PATH; drop it once mise provides omp.
|
||||
if [ -f "$HOME/.local/bin/omp" ] && [ ! -L "$HOME/.local/bin/omp" ] && mise which omp >/dev/null 2>&1; then
|
||||
rm -f "$HOME/.local/bin/omp"
|
||||
fi
|
||||
else
|
||||
echo "warning: mise not installed — skipping mise tools" >&2
|
||||
fi
|
||||
{{- if and (eq .chezmoi.os "linux") (or (eq .role "desktop") (eq .role "laptop")) }}
|
||||
|
||||
# strata (GUI file manager): binary in ~/.local/bin, desktop entry, and the
|
||||
# FileManager1 D-Bus service for "Open file location". The inode/directory
|
||||
# default is dot_config/mimeapps.list; --with-folder-association is not used
|
||||
# because xdg-mime would replace that symlink with a plain file. Runtime deps
|
||||
# are in packages.arch.desktop.pacman.
|
||||
if [ ! -e "$HOME/.local/bin/strata" ]; then
|
||||
curl -fsSL https://raw.githubusercontent.com/lgse/strata/main/install.sh | bash -s -- --with-desktop-entry --with-file-manager
|
||||
fi
|
||||
{{- end }}
|
||||
Reference in new issue
Block a user