forked from nhs-england-tools/dotfiles
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdot_path.tmpl
More file actions
60 lines (54 loc) · 2.23 KB
/
dot_path.tmpl
File metadata and controls
60 lines (54 loc) · 2.23 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
# Build PATH with deduplication
# SEE: https://github.com/driesvints/dotfiles (add_to_path pattern)
# Add a directory to PATH only if it exists and is not already present
_add_to_path() {
if [ -d "$1" ] && [[ ":$PATH:" != *":$1:"* ]]; then
export PATH="$1:$PATH"
fi
}
# Start with system defaults
export PATH="/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/sbin"
# asdf version manager
_add_to_path "$HOME/.asdf/bin"
_add_to_path "$HOME/.asdf/shims"
# Docker / Podman CLI plugins
_add_to_path "$HOME/.docker/bin"
{{ if eq .chezmoi.os "darwin" -}}
# Homebrew and GNU tool overrides
# Architecture-specific prefix: /opt/homebrew (Apple Silicon) or /usr/local (Intel)
{{ if eq .chezmoi.arch "arm64" -}}
_add_to_path "/opt/homebrew/bin"
_add_to_path "/opt/homebrew/opt/ruby/bin"
_add_to_path "/opt/homebrew/opt/coreutils/libexec/gnubin"
_add_to_path "/opt/homebrew/opt/curl/bin"
_add_to_path "/opt/homebrew/opt/findutils/libexec/gnubin"
_add_to_path "/opt/homebrew/opt/gnu-getopt/bin"
_add_to_path "/opt/homebrew/opt/gnu-sed/libexec/gnubin"
_add_to_path "/opt/homebrew/opt/gnu-tar/libexec/gnubin"
_add_to_path "/opt/homebrew/opt/grep/libexec/gnubin"
_add_to_path "/opt/homebrew/opt/make/libexec/gnubin"
_add_to_path "/opt/homebrew/opt/openssl/bin"
_add_to_path "/opt/homebrew/opt/gnu-which/libexec/gnubin"
_add_to_path "/opt/homebrew/opt/zip/bin"
# FIXME: Adding binutils to the PATH causes an issue on amd64 architecture
# but not on arm, see https://developer.apple.com/forums/thread/694062
_add_to_path "/opt/homebrew/opt/binutils/bin"
{{- else -}}
_add_to_path "/usr/local/Homebrew/bin"
_add_to_path "/usr/local/opt/coreutils/libexec/gnubin"
_add_to_path "/usr/local/opt/curl/bin"
_add_to_path "/usr/local/opt/findutils/libexec/gnubin"
_add_to_path "/usr/local/opt/gnu-getopt/bin"
_add_to_path "/usr/local/opt/gnu-sed/libexec/gnubin"
_add_to_path "/usr/local/opt/gnu-tar/libexec/gnubin"
_add_to_path "/usr/local/opt/grep/libexec/gnubin"
_add_to_path "/usr/local/opt/make/libexec/gnubin"
_add_to_path "/usr/local/opt/openssl/bin"
_add_to_path "/usr/local/opt/gnu-which/libexec/gnubin"
_add_to_path "/usr/local/opt/zip/bin"
{{- end }}
{{- end }}
# User binaries (highest priority)
_add_to_path "$HOME/.local/bin"
_add_to_path "$HOME/bin"
unset -f _add_to_path