exports
1 #!/bin/zsh 2 3 # vi: ft=sh 4 5 # ----------------------------------------------------------------------------- 6 # Handlers and core OS stuff 7 # ----------------------------------------------------------------------------- 8 9 # Locale - ensure UTF-8 in all environments (SSH, tmux, Nexterm) 10 # LOCALE_ARCHIVE is needed for Nix-provided glibc to find locale data 11 if [ -z "$LOCALE_ARCHIVE" ]; then 12 for _la in /nix/store/*-glibc-locales-*/lib/locale/locale-archive; do 13 [ -f "$_la" ] && export LOCALE_ARCHIVE="$_la" && break 14 done 15 unset _la 16 fi 17 export LANG="${LANG:-en_US.UTF-8}" 18 export LC_ALL="${LC_ALL:-en_US.UTF-8}" 19 20 # Dotfile scripts when available 21 [ -d "${DOTFILES_SCRIPTS}" ] && export PATH="$PATH:${DOTFILES_SCRIPTS}::" 22 23 # GpG settings 24 export GPG_TTY="$(tty)" 25 26 # Man pages path 27 export MANPATH="/usr/local/man:$MANPATH" 28 29 # Format time output just like bash would 30 export TIMEFMT=$'real\t%E\nuser\t%U\nsys\t%S' 31 32 # don't put duplicate lines or lines starting with space in bash history 33 export HISTCONTROL="ignoredups:erasedups" 34 35 # Make some commands not show up in history 36 export HISTIGNORE="&:ls:cd -:cd:date:* --help:exit:pwd:history:clear:mount:umount:[ \t]*" 37 38 # for setting history length see HISTSIZE and HISTFILESIZE in bash(1) 39 export HISTSIZE=50000000 40 export HISTFILESIZE="$HISTSIZE" 41 export SAVEHIST=$HISTSIZE 42 43 # Tmux Profile display 44 export DISABLE_AUTO_TITLE='true' 45 46 # Preferred editor for local and remote sessions 47 if [[ -n $SSH_CONNECTION ]]; then 48 export EDITOR='vi' 49 export VISUAL='vi' 50 else 51 export EDITOR='nvim' 52 export VISUAL='nvim' 53 fi 54 55 # ----------------------------------------------------------------------------- 56 # Terminal colors & display 57 # ----------------------------------------------------------------------------- 58 59 # Color settings 60 export COLORTERM=truecolor 61 62 # get some colors on commands with grc when installed 63 [[ -s "/etc/grc.zsh" ]] && source "/etc/grc.zsh" 64 65 # Syntax highlight for LESS command 66 if command -v source-highlight &>/dev/null 2>&0; then 67 export PAGER="less" 68 export LESS="-R" 69 [ -f "${DOTFILES_SCRIPTS}/src-hilite-lesspipe.sh" ] && 70 export LESSOPEN="| ${DOTFILES_SCRIPTS}/src-hilite-lesspipe.sh %s" 71 fi 72 73 # make less more friendly for non-text input files, see lesspipe(1) 74 [ -f /usr/bin/lesspipe ] && eval "$(SHELL=/bin/sh lesspipe)" 75 76 export FONTCONFIG_PATH=/etc/fonts 77 # ----------------------------------------------------------------------------- 78 # Coding stuff 79 # ----------------------------------------------------------------------------- 80 81 # Golang 82 export GO111MODULE="on" 83 export GOPATH="${HOME}/go" 84 export TINYGOPATH="${HOME}/tinygo" 85 export TINYGOBIN="${TINYGOPATH}/bin" 86 export GOBIN="${GOPATH}/bin" 87 export PATH="${PATH}:/usr/local/go/bin:${GOBIN}:${TINYGOBIN}:${GOROOT}/bin" 88 89 # Lua 90 export LUA_PATH="${HOME}/.dotfiles/lua_modules/share/lua/5.4/?.lua;${HOME}/.dotfiles/lua_modules/share/lua/5.4/?/init.lua;;" 91 export LUA_CPATH="${HOME}/.dotfiles/lua_modules/lib/lua/5.4/?.so;;" 92 export PATH="${HOME}/.dotfiles/lua_modules/bin:${PATH}" 93 eval "$(luarocks path --bin)" 94 95 # Ruby 96 PATH="${PATH}:${HOME}/.gem/ruby/2.7.0/bin" 97 98 # Zig 99 export ZIGPATH="${HOME}/zig" 100 export ZIGBIN="${ZIGPATH}/bin" 101 export PATH="${PATH}:${ZIGBIN}" 102 103 # ----------------------------------------------------------------------------- 104 # Tools & Utils 105 # ----------------------------------------------------------------------------- 106 107 # Common exports for both Linux and MacOS 108 export PATH="${PATH}:${HOME}" 109 export PATH="${PATH}:${HOME}/.local/share/nvim/mason/bin" 110 export PATH="${PATH}:${HOME}/bin" 111 export PATH="${PATH}:/opt/bin" 112 export PATH="${PATH}:/opt/local/bin" 113 export PATH="${PATH}:/opt/nvim/bin" 114 export PATH="${HOME}/.local/bin:$PATH" 115 export PATH="${HOME}/.cargo/bin:$PATH" 116 export PATH="$PATH:${HOME}/.opencode/bin" 117 export PATH="${KREW_ROOT:-$HOME/.krew}/bin:$PATH" 118 119 # Git 120 export PATH="${PATH}:/usr/local/git/bin" 121 export LG_CONFIG_FILE="${HOME}/.config/lazygit/lazy.yaml" 122 123 # Enable Docker build kit by default 124 export DOCKER_BUILDKIT=1 125 export BUILDKIT_COLORS=run=green:warning=yellow:error=red:cancel=255,165,0 126 export BUILDKIT_PROGRESS=plain 127 export KUBE_EDITOR=nvim 128 export DOCKER_DEFAULT_PLATFORM=linux/amd64 129 130 # atuil shell history 131 if test -f "$HOME/.atuin/bin/env" &>/dev/null 2>&0; then 132 . "$HOME/.atuin/bin/env" 133 eval "$(atuin init zsh --disable-up-arrow)" 134 fi 135 136 # Terraform Env 137 if command -v terraform &>/dev/null 2>&0; then 138 mkdir -p "${HOME}/.tfenv" 139 export PATH="${PATH}:${HOME}/.tfenv/bin" 140 fi 141 142 # Linux-only exports 143 if [[ "$(uname)" == "Linux" ]]; then 144 # D-Bus session 145 export DBUS_SESSION_BUS_ADDRESS="unix:path=/run/user/$(id -u)/bus" 146 147 # Display settings for KeePassXC (running with AppImage) 148 export QT_AUTO_SCREEN_SCALE_FACTOR=0 149 export QT_SCREEN_SCALE_FACTORS=DP1=1.5 #;DP1=1.5;DP2=1.5;HDMI1=1.5;HDMI2=1.5;VIRTUAL1=1.5; 150 fi 151 152 # MacOS-only exports 153 if [[ "$(uname)" == "Darwin" ]]; then 154 export PATH="${PATH}:/Applications/WezTerm.app/Contents/MacOS" 155 export PATH="${PATH}:${HOME}/AppImage" 156 157 # Homebrew basic settings 158 export PATH="${PATH}:/opt/homebrew/bin" 159 export PATH="${PATH}:/opt/homebrew/opt/socket_vmnet/bin" 160 export PATH="${PATH}:/opt/homebrew/sbin" 161 162 # Homebrew setttings for compilers to find zlib 163 export LDFLAGS="-L/opt/homebrew/opt/zlib/lib" 164 export CPPFLAGS="-I/opt/homebrew/opt/zlib/include" 165 166 # Homebrew pkg-config to find zlib 167 export PKG_CONFIG_PATH="/opt/homebrew/opt/zlib/lib/pkgconfig" 168 169 # Homebrew openssl and DYLD library path 170 export PATH="/opt/homebrew/opt/openssl@3.0/bin:$PATH" 171 export DYLD_LIBRARY_PATH="$(brew --prefix)/lib:$DYLD_LIBRARY_PATH" 172 eval "$(/opt/homebrew/bin/brew shellenv)" 173 174 # Prefer gnu-sed as default 175 export PATH="${HOMEBREW_PREFIX}/opt/gnu-sed/libexec/gnubin:${PATH}" 176 177 # Rancher 178 export PATH="${PATH}:/Applications/Rancher Desktop.app/Contents/Resources/resources/darwin/lima/bin" 179 export LIMA_HOME="${HOME}/Library/Application Support/rancher-desktop/lima" 180 export PATH="${PATH}:${HOME}/.rd/bin" 181 fi 182 183 # ----------------------------------------------------------------------------- 184 # EOF 185 # -----------------------------------------------------------------------------