From 98e88e3d0a47be50201ab9c6ff3c4fed899b3f36 Mon Sep 17 00:00:00 2001 From: "Marc T. Henry de Frahan" Date: Tue, 17 Sep 2024 10:09:01 -0600 Subject: [PATCH] Merge z files (#5) --- .../zinit/plugins/hpc/hpc.plugin.zsh.tmpl | 34 +++---- dot_zlogin | 4 - dot_zshenv.tmpl | 88 ------------------- dot_zshrc => dot_zshrc.tmpl | 80 +++++++++++++++++ 4 files changed, 97 insertions(+), 109 deletions(-) delete mode 100644 dot_zlogin delete mode 100644 dot_zshenv.tmpl rename dot_zshrc => dot_zshrc.tmpl (70%) diff --git a/dot_local/share/zinit/plugins/hpc/hpc.plugin.zsh.tmpl b/dot_local/share/zinit/plugins/hpc/hpc.plugin.zsh.tmpl index 6a02668..6a41245 100644 --- a/dot_local/share/zinit/plugins/hpc/hpc.plugin.zsh.tmpl +++ b/dot_local/share/zinit/plugins/hpc/hpc.plugin.zsh.tmpl @@ -39,6 +39,23 @@ export TMPDIR=${SCRATCH}/.tmp umask u=rwx,go=rx,o=rx +function pv510server() { + module load paraview/5.10.1-server + srun -n $1 -c 1 --cpu_bind=cores pvserver +} + +function pv510gui() { + module load paraview/5.10.1-gui + vglrun paraview +} + +function pvtunnel() { + ssh -L 11111:$1:11111 mhenryde@$1 +} + +{{ end }} + +{{- if or (.nrel_hpc) (.ornl_hpc) }} function load_custom_modules { { @@ -91,23 +108,6 @@ function load_custom_modules { } &> /dev/null } -function pv510server() { - module load paraview/5.10.1-server - srun -n $1 -c 1 --cpu_bind=cores pvserver -} - -function pv510gui() { - module load paraview/5.10.1-gui - vglrun paraview -} - -function pvtunnel() { - ssh -L 11111:$1:11111 mhenryde@$1 -} - -{{ end }} - -{{- if or (.nrel_hpc) (.ornl_hpc) }} load_custom_modules {{ end }} diff --git a/dot_zlogin b/dot_zlogin deleted file mode 100644 index c792adc..0000000 --- a/dot_zlogin +++ /dev/null @@ -1,4 +0,0 @@ -# Run on login - -# Python virtual environment -export WORKON_HOME=${HOME}/.virtualenvs diff --git a/dot_zshenv.tmpl b/dot_zshenv.tmpl deleted file mode 100644 index c80c6cd..0000000 --- a/dot_zshenv.tmpl +++ /dev/null @@ -1,88 +0,0 @@ -# According to -# http://unix.stackexchange.com/questions/71253/what-should-shouldnt-go-in-zshenv-zshrc-zlogin-zprofile-zlogout -# I should be putting all the paths and things like that in this file - -# User specific environment and startup programs - -# homebrew -if [ -d "/opt/homebrew" ]; then - eval "$(/opt/homebrew/bin/brew shellenv)" -fi - -export PATH="${HOME}/bin:${HOME}/.local/bin:${PATH}" - -# miniconda -MINICONDA_DIR="${HOME}/miniconda3" -if [ -d "${MINICONDA_DIR}" ]; then - # >>> conda initialize >>> - __conda_setup="$('${MINICONDA_DIR}/conda' 'shell.zsh' 'hook' 2> /dev/null)" - if [ $? -eq 0 ]; then - eval "$__conda_setup" - else - if [ -f "${MINICONDA_DIR}/etc/profile.d/conda.sh" ]; then - . "${MINICONDA_DIR}/etc/profile.d/conda.sh" - else - export PATH="${MINICONDA_DIR}/bin:$PATH" - fi - fi - unset __conda_setup - # <<< conda initialize <<< -fi - -# Datathief bin dir -DATATHIEF_DIR="${HOME}/datathief" -if [ -d "${DATATHIEF_DIR}" ]; then - export PATH="${DATATHIEF_DIR}:${PATH}" -fi - -# Spack home directory -if [ -d "${HOME}/spack" ]; then - export SPACK_DIR="${HOME}/spack" -fi - -# combustion directory -export COMBUSTION_DIR="${HOME}/combustion" -export MASA_HOME="${COMBUSTION_DIR}/install/MASA" - -# pyenv -export PYENV_ROOT="${HOME}/.pyenv" -if [ -d "${PYENV_ROOT}" ]; then - command -v pyenv >/dev/null || export PATH="$PYENV_ROOT/bin:$PATH" - eval "$(pyenv init -)" -fi - -# poetry -if [ -d "${HOME}/.poetry" ]; then - export PATH="$HOME/.poetry/bin:$PATH" -fi - -# exawind-manager -if [ -d "${HOME}/exawind/exawind-manager" ]; then - export EXAWIND_MANAGER=${HOME}/exawind/exawind-manager - source ${EXAWIND_MANAGER}/start.sh -fi - -# zoxide -export _ZO_DATA_DIR=$HOME/.local/share - -# hunspell dicts -if [ -d "${HOME}/.local/share/hunspell/dicts" ]; then - export DICPATH="${HOME}/.local/share/hunspell/dicts" -fi - - -{{- if eq .chezmoi.os "darwin" }} - -# paths for Mac OSX - -# github tokens -source "${HOME}/.github_tokens" - -# openmpi fails because tmp dir name is too long -# see: https://www.open-mpi.org/faq/?category=osx -export TMPDIR=/tmp - -# Set vlc for terminal -alias vlc="{HOME}/Applications/VLC.app/Contents/MacOS/VLC" - -{{- end }} diff --git a/dot_zshrc b/dot_zshrc.tmpl similarity index 70% rename from dot_zshrc rename to dot_zshrc.tmpl index 4e3eba2..345accb 100644 --- a/dot_zshrc +++ b/dot_zshrc.tmpl @@ -28,6 +28,86 @@ zinit light-mode for \ ### End of Zinit's installer chunk +# Setup up some paths and environment variables + +# homebrew +if [ -d "/opt/homebrew" ]; then + eval "$(/opt/homebrew/bin/brew shellenv)" +fi + +export PATH="${HOME}/bin:${HOME}/.local/bin:${PATH}" + +# miniconda +MINICONDA_DIR="${HOME}/miniconda3" +if [ -d "${MINICONDA_DIR}" ]; then + # >>> conda initialize >>> + __conda_setup="$('${MINICONDA_DIR}/conda' 'shell.zsh' 'hook' 2> /dev/null)" + if [ $? -eq 0 ]; then + eval "$__conda_setup" + else + if [ -f "${MINICONDA_DIR}/etc/profile.d/conda.sh" ]; then + . "${MINICONDA_DIR}/etc/profile.d/conda.sh" + else + export PATH="${MINICONDA_DIR}/bin:$PATH" + fi + fi + unset __conda_setup + # <<< conda initialize <<< +fi + +# Spack home directory +if [ -d "${HOME}/spack" ]; then + export SPACK_DIR="${HOME}/spack" +fi + +# combustion directory +export COMBUSTION_DIR="${HOME}/combustion" +export MASA_HOME="${COMBUSTION_DIR}/install/MASA" + +# pyenv +export PYENV_ROOT="${HOME}/.pyenv" +if [ -d "${PYENV_ROOT}" ]; then + command -v pyenv >/dev/null || export PATH="$PYENV_ROOT/bin:$PATH" + eval "$(pyenv init -)" +fi + +# poetry +if [ -d "${HOME}/.poetry" ]; then + export PATH="$HOME/.poetry/bin:$PATH" +fi + +# exawind-manager +if [ -d "${HOME}/exawind/exawind-manager" ]; then + export EXAWIND_MANAGER=${HOME}/exawind/exawind-manager + source ${EXAWIND_MANAGER}/start.sh +fi + +# zoxide +export _ZO_DATA_DIR=$HOME/.local/share + +# hunspell dicts +if [ -d "${HOME}/.local/share/hunspell/dicts" ]; then + export DICPATH="${HOME}/.local/share/hunspell/dicts" +fi + +export WORKON_HOME=${HOME}/.virtualenvs + +{{- if eq .chezmoi.os "darwin" }} + +# paths for Mac OSX + +# github tokens +source "${HOME}/.github_tokens" + +# openmpi fails because tmp dir name is too long +# see: https://www.open-mpi.org/faq/?category=osx +export TMPDIR=/tmp + +# Set vlc for terminal +alias vlc="{HOME}/Applications/VLC.app/Contents/MacOS/VLC" + +{{- end }} + # towards the beginning to make sure some software is loaded zinit lucid light-mode for "hpc"