-
Notifications
You must be signed in to change notification settings - Fork 0
/
dot_profile
236 lines (187 loc) · 5.83 KB
/
dot_profile
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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
prepend_envvar() {
eval "val=\"\$$1\""
delim="${3:-:}"
case "$delim$val$delim" in
*"$delim$2$delim"*)
;;
*)
eval "$1=\"$2\${$1:+$delim\$$1}\""
;;
esac
}
import_env() {
if hash dbus-update-activation-environment 2>/dev/null
then
dbus-update-activation-environment --systemd "$@"
else
systemctl --user import-environment "$@"
fi
}
export XDG_SESSION_ID=1 # TODO: remove this after ly update
# XDG dirs
# Systemwide
prepend_envvar XDG_DATA_DIRS '/usr/share'
prepend_envvar XDG_DATA_DIRS '/usr/local/share'
export XDG_DATA_DIRS
prepend_envvar XDG_CONFIG_DIRS '/etc/xdg'
export XDG_CONFIG_DIRS
# User specific
export XDG_CONFIG_HOME="$HOME/.config"
export XDG_CACHE_HOME="$HOME/.cache"
export XDG_DATA_HOME="$HOME/.local/share"
export XDG_STATE_HOME="$HOME/.local/state"
# Create XDG dirs
mkdir -p "$XDG_CONFIG_HOME" "$XDG_CACHE_HOME" "$XDG_DATA_HOME" "$XDG_STATE_HOME"
# PATH
prepend_envvar PATH "$XDG_CONFIG_HOME/composer/vendor/bin"
prepend_envvar PATH "$HOME/.gem/ruby/3.0.0/bin"
prepend_envvar PATH "$HOME/.yarn/bin"
prepend_envvar PATH "$HOME/Android/Sdk/tools/bin"
prepend_envvar PATH "$HOME/Android/Sdk/emulator"
prepend_envvar PATH "$HOME/go/bin"
prepend_envvar PATH "$HOME/.dotnet/tools"
prepend_envvar PATH "$HOME/Flutter/bin"
prepend_envvar PATH "$HOME/.krew/bin"
prepend_envvar PATH "$XDG_DATA_HOME/npm/bin"
prepend_envvar PATH "$XDG_DATA_HOME/cargo/bin"
prepend_envvar PATH "$HOME/.local/bin"
export PATH
# Editor
export VISUAL=nvim
export EDITOR=nvim
export SUDO_EDITOR=nvim
# Pager
export PAGER=less
# Less syntax highlight
export LESSOPEN="| /usr/bin/src-hilite-lesspipe.sh %s"
export LESS=" -Ri "
# Man pager
export MANPAGER="sh -c 'col -bx | bat -l man -p'"
export MANROFFOPT="-c"
# Terminal
export TERMINAL=alacritty
# Browser
export BROWSER=firefox
# XDG override
export ZDOTDIR=$XDG_CONFIG_HOME/zsh
# GOPATH
prepend_envvar GOPATH "$HOME/go"
prepend_envvar GOPATH "$HOME/Development/go"
export GOPATH
# Firefox
export MOZ_WEBRENDER=1
export MOZ_ACCELERATED=1
export MOZ_USE_XINPUT2=1
# enable hardware acceleration using va-api
# TODO: remove this after https://bugzilla.mozilla.org/show_bug.cgi?id=1751363 lands
export MOZ_DISABLE_RDD_SANDBOX=1
# Qt
export QT_QPA_PLATFORMTHEME=qt5ct
# export QT_STYLE_OVERRIDE=kvantum
# Java
if [ -e /etc/alternatives/java_sdk ]
then
# Fedora
export JAVA_HOME=/etc/alternatives/java_sdk
elif [ -e /usr/lib/jvm/default ]
then
# Arch Linux
export JAVA_HOME=/usr/lib/jvm/default
fi
# Less history file
export LESSHISTFILE="$XDG_CACHE_HOME/lesshst"
# Default diff program for pacdiff
export DIFFPROG=delta
# NodeJS
export NODE_REPL_HISTORY="$XDG_CACHE_HOME/node_repl_history"
# NPM
export NPM_CONFIG_USERCONFIG="$XDG_CONFIG_HOME/npm/npmrc"
# Readline
export INPUTRC="$XDG_CONFIG_HOME/readline/inputrc"
# Gtk
export GTK_RC_FILES="$XDG_CONFIG_HOME/gtk-1.0/gtkrc"
export GTK2_RC_FILES="$XDG_CONFIG_HOME/gtk-2.0/gtkrc"
export GTK_THEME=Materia-dark-compact
# ...questionable way to configure gtk settings
gsettings-setup
# Cursor theme
export XCURSOR_THEME=capitaine-cursors
# Gibo git boilerplates
export GIBO_BOILERPLATES="$XDG_CACHE_HOME/gitignore-boilerplates"
# Deepgit
export DEEPGIT_JAVA_HOME=/usr/lib/jvm/java-11-openjdk
# IntelliJ IDEA
export IDEA_JDK=/usr/lib/jvm/jre-jetbrains
# SBT options
export SBT_OPTS="-Xms512M -Xmx4G -Xss2M -XX:MaxMetaspaceSize=4G -XX:+UseConcMarkSweepGC -XX:+CMSClassUnloadingEnabled"
# Rustup
export RUSTUP_HOME="$XDG_DATA_HOME/rustup"
# Cargo
export CARGO_HOME="$XDG_DATA_HOME/cargo"
# Make flags
export MAKEFLAGS="-j$(($(nproc) - 2))"
# Rust compile flags
export RUSTFLAGS="-C target-cpu=native"
# Debuginfod URLs
export DEBUGINFOD_URLS='https://debuginfod.archlinux.org/'
# Xkeyboard keyboard config
export XKB_DEFAULT_LAYOUT='us,kz(ruskaz)'
export XKB_DEFAULT_OPTIONS='grp:alt_caps_toggle,compose:sclk,lv3:ralt_switch'
# OpenAL software sound drivers (Telegram, Minecraft)
export ALSOFT_DRIVERS='pulse,pipewire'
# QMK home
export QMK_HOME="$HOME/Development/github.com/liljaylj/qmk_firmware"
# kube config
KUBECONFIG="$(kube-configs)"
export KUBECONFIG
# sv4git config
export SV4GIT_HOME="$XDG_CONFIG_HOME/sv4git"
# ytt tasks repo
export YTT_HOME="$XDG_DATA_HOME/ytt"
export YTT_REPO='liljaylj/yttasks'
# FZF default arguments
export FZF_DEFAULT_OPTS="$FZF_DEFAULT_OPTS --bind 'ctrl-a:select-all,ctrl-d:deselect-all,ctrl-t:toggle-all'"
# Vagrant
# TODO: install `vagrant plugin install vagrant-libvirt`!
export VAGRANT_DEFAULT_PROVIDER=libvirt
# Libvirt
export LIBVIRT_DEFAULT_URI='qemu:///system'
# psql
mkdir -p "$XDG_CONFIG_HOME/pg"
export PSQLRC="$XDG_CONFIG_HOME/pg/psqlrc"
export PSQL_HISTORY="$XDG_STATE_HOME/psql_history"
export PGPASSFILE="$XDG_CONFIG_HOME/pg/pgpass"
export PGSERVICEFILE="$XDG_CONFIG_HOME/pg/pg_service.conf"
#
# Import from file(s)
set -a
# User dirs
if [ -e "$XDG_CONFIG_HOME/user-dirs.dirs" ]
then
source "$XDG_CONFIG_HOME/user-dirs.dirs"
grep -Eo '^[^#=]+' "$XDG_CONFIG_HOME/user-dirs.dirs" | xargs systemctl --user import-environment
fi
# TODO: divide gui and vconsole options in profile.d
# Source host dependent profile(s)
if [ -d "$XDG_CONFIG_HOME/profile.d" ] && [ -r "$XDG_CONFIG_HOME/profile.d" ]
then
while read -r f
do
source "$f"
done < <(find -L "$XDG_CONFIG_HOME/profile.d" -mindepth 1 -maxdepth 1 -type f)
fi
set +a
# End Import from file(s)
#
# Is running under WSL
grep -iq 'microsoft' /proc/sys/kernel/osrelease && export IS_WSL=1
# Import environment to systemctl user session
import_env PATH XDG_DATA_DIRS XDG_CONFIG_DIRS XDG_CONFIG_HOME XDG_CACHE_HOME XDG_DATA_HOME ZDOTDIR JAVA_HOME \
GTK_RC_FILES GTK2_RC_FILES GTK_THEME QT_QPA_PLATFORMTHEME XCURSOR_THEME LIBVIRT_DEFAULT_URI
# Cleanup
unset -f prepend_envvar
unset -f import_env
# If running from tty1 start sway
#if [ "$(tty)" = "/dev/tty1" ] && [ ! $IS_WSL ]; then
# exec sway
#fi