From c1f6f9a630e01df08b9e1773e3813a4d95725946 Mon Sep 17 00:00:00 2001 From: aleidk Date: Wed, 20 Mar 2024 13:50:11 -0300 Subject: [PATCH] Final updates to merge chezmoi into main --- chezmoi/.chezmoi.toml.tmpl | 1 + chezmoi/.chezmoidata/packages.yaml | 1 + .../run_once_after_setup_wol.sh.tmpl | 6 +- chezmoi/dot_config/zsh/executable_zshrc | 117 ------------------ chezmoi/executable_dot_zprofile | 44 ------- ..._zprofile => executable_dot_zprofile.tmpl} | 14 +-- 6 files changed, 12 insertions(+), 171 deletions(-) rename setup/wol => chezmoi/.chezmoiscripts/run_once_after_setup_wol.sh.tmpl (85%) mode change 100755 => 100644 delete mode 100644 chezmoi/dot_config/zsh/executable_zshrc delete mode 100644 chezmoi/executable_dot_zprofile rename chezmoi/{dot_config/zsh/executable_zprofile => executable_dot_zprofile.tmpl} (73%) diff --git a/chezmoi/.chezmoi.toml.tmpl b/chezmoi/.chezmoi.toml.tmpl index f64b23f..b6c4679 100644 --- a/chezmoi/.chezmoi.toml.tmpl +++ b/chezmoi/.chezmoi.toml.tmpl @@ -6,3 +6,4 @@ [data] osid = {{ $osid | quote }} hasGui = {{ promptBoolOnce . "hasGui" "Does this machine needs gui configs/apps?" }} + hasWOL = {{ promptBoolOnce . "hasWOL" "Does this machine WOL?" }} diff --git a/chezmoi/.chezmoidata/packages.yaml b/chezmoi/.chezmoidata/packages.yaml index c22d657..41dca92 100644 --- a/chezmoi/.chezmoidata/packages.yaml +++ b/chezmoi/.chezmoidata/packages.yaml @@ -2,6 +2,7 @@ packages: cargo: - mise - yazi-fm + - rbw dnf: copr: - atim/lazygit diff --git a/setup/wol b/chezmoi/.chezmoiscripts/run_once_after_setup_wol.sh.tmpl old mode 100755 new mode 100644 similarity index 85% rename from setup/wol rename to chezmoi/.chezmoiscripts/run_once_after_setup_wol.sh.tmpl index a19436a..e543e79 --- a/setup/wol +++ b/chezmoi/.chezmoiscripts/run_once_after_setup_wol.sh.tmpl @@ -1,7 +1,10 @@ +{{- if eq .hasWOL true -}} #!/usr/bin/env bash +set -e + # run as sudo so it ask for the password here and not inside FZF -echo -e "\n${BLD}${SUL}${GRN}Setting up wol...${RST}\n" +sudo echo -e "\nSetting up wol...\n" interface="$( nmcli --fields name --terse con show | @@ -17,3 +20,4 @@ if [[ -z "$interface" ]]; then fi nmcli c modify "$interface" 802-3-ethernet.wake-on-lan magic nmcli c modify "$interface" 802-3-ethernet.auto-negotiate yes +{{ end }} diff --git a/chezmoi/dot_config/zsh/executable_zshrc b/chezmoi/dot_config/zsh/executable_zshrc deleted file mode 100644 index c9f6a25..0000000 --- a/chezmoi/dot_config/zsh/executable_zshrc +++ /dev/null @@ -1,117 +0,0 @@ -# Start measuring bottlenecks -if [[ "$ZPROF" = true ]]; then - zmodload zsh/zprof -fi - -#--------------------------------------------------------------------# -# ZSH Config # -#--------------------------------------------------------------------# - -# Set VIM keybindings -bindkey -v -export KEYTIMEOUT=1 -autoload -Uz edit-command-line -zle -N edit-command-line -bindkey -M vicmd V edit-command-line # Edits files in vim, hit Shift+v in normal mode - -# Add vim text objects -autoload -Uz select-bracketed select-quoted -zle -N select-quoted -zle -N select-bracketed -for km in viopp visual; do - bindkey -M $km -- '-' vi-up-line-or-history - for c in {a,i}${(s..)^:-\'\"\`\|,./:;=+@}; do - bindkey -M $km $c select-quoted - done - for c in {a,i}${(s..)^:-'()[]{}<>bB'}; do - bindkey -M $km $c select-bracketed - done -done - -# History -export HISTFILE="$HOME/.zsh_history" # History filepath -export HISTSIZE=10000 # Maximum events for internal history -export SAVEHIST=10000 # Maximum events in history file -setopt EXTENDED_HISTORY - -# Navigation -setopt AUTO_CD -setopt AUTO_PUSHD -setopt CDABLE_VARS -setopt PUSHD_SILENT - -# Completion -setopt AUTO_LIST # Automatically list choices on ambiguous completion. -# setopt CORRECT # Turn on spelling correction for command. -setopt COMPLETE_IN_WORD # Complete from both ends of a word. -setopt GLOB_COMPLETE # Show autocompletion menu with globs -setopt MENU_COMPLETE # Automatically highlight first element of completion menu - -fpath+=${ZSH_CUSTOM:-${ZSH:-$XDG_DATA_HOME/oh-my-zsh}/custom}/plugins/zsh-completions/src -fpath+=${XDG_CONFIG_HOME:-$DOTS/config}/zsh/completions - -zstyle ':completion:*:descriptions' format '%U%B%d%b%u' -zstyle ':completion:*:warnings' format '%F{cyan}%BSorry, no matches for: %d%b%f' -zstyle ':completion:*' rehash true -zstyle ':completion:*' use-cache on - -# Autocomplete: https://github.com/marlonrichert/zsh-autocomplete/blob/main/.zshrc -zstyle ':autocomplete:*' fzf-completion yes -zstyle ':autocomplete:*' min-input 1 -zstyle ':autocomplete:*' widget-style menu-select # Tab select instead of autocomplete - -setopt autocd beep extendedglob notify - -zstyle ':completion:*' group-name '' -zstyle :compinstall filename '/home/aleidk/.zshrc' - -zmodload zsh/complist -bindkey -M menuselect 'h' vi-backward-char -bindkey -M menuselect 'k' vi-up-line-or-history -bindkey -M menuselect 'l' vi-forward-char -bindkey -M menuselect 'j' vi-down-line-or-history - -# FZF config -source /usr/share/fzf/shell/key-bindings.zsh - -autoload -U compinit -compinit - -setopt GLOB_DOTS - -# If not running interactively, don't do anything -[[ $- != *i* ]] && return - -#--------------------------------------------------------------------# -# Start Stuff # -#--------------------------------------------------------------------# - -# File directories that are needed to source -files=( - # zsh - $DOTS/config/zsh/**/*.zsh - # fzf scripts that need to be sourced - $DOTS/scripts/fzf-flatpak - # fzf config file - $DOOTS/config/fzf/fzfrc -) - -for file in $files; do - if [[ -f $file ]]; then - emulate -L zsh - source $file - fi -done - -if [[ "$ZPROF" = true ]]; then - zprof -fi - -eval "$(starship init zsh)" -# eval "$(zellij setup --generate-auto-start zsh)" -eval "$(zoxide init zsh)" -eval "$(mise activate zsh)" - -# Load syntax highlight at the end so other configurations can use it -# Color scheme for syntax highlighting -source ~/.config/zsh/themes/catppuccin_macchiato-zsh-syntax-highlighting.zsh diff --git a/chezmoi/executable_dot_zprofile b/chezmoi/executable_dot_zprofile deleted file mode 100644 index 54bedb7..0000000 --- a/chezmoi/executable_dot_zprofile +++ /dev/null @@ -1,44 +0,0 @@ -#!/usr/bin/zsh - -update_path() { - export PATH="$PATH:$1" -} - -# Set manually -export DOTS="$HOME/Repos/Private/dots" -export EDITOR=nvim -export VISUAL="$EDITOR" -export QT_STYLE_OVERRIDE=kvantum -export MOZ_ENABLE_WAYLAND=1 - -# Dev Stuff -export NPM_PACKAGES="$HOME/.npm-packages" -export NODE_PATH="$NPM_PACKAGES/lib/node_modules${NODE_PATH:+:$NODE_PATH}" -export PNPM_HOME="$HOME/.local/share/pnpm" -. "$HOME/.cargo/env" - -# Unset manpath so we can inherit from /etc/manpath via the `manpath` -# command -unset MANPATH # delete if you already modified MANPATH elsewhere in your config -export MANPATH="$NPM_PACKAGES/share/man:$(manpath)" - -# PATH -update_path "/usr/local/bin" -update_path "$HOME/.local/bin" -update_path "$HOME/.cargo/bin/" -update_path "$HOME/.spicetify" -update_path "$DOTS/scripts" -update_path "$HOME/bin" -update_path "$NPM_PACKAGES/bin" -update_path "$PNPM_HOME" -update_path "$HOME/.local/share/rtx/shims" -update_path "$HOME/.spicetify" - - -if [[ -e "$DOTS/config/zsh/zprofile.local" ]]; then - source "$DOTS/config/zsh/zprofile.local" -fi - -if [[ $OSTYPE =~ 'darwin' ]]; then - eval "$(/opt/homebrew/bin/brew shellenv)" -fi diff --git a/chezmoi/dot_config/zsh/executable_zprofile b/chezmoi/executable_dot_zprofile.tmpl similarity index 73% rename from chezmoi/dot_config/zsh/executable_zprofile rename to chezmoi/executable_dot_zprofile.tmpl index 54bedb7..a363a77 100644 --- a/chezmoi/dot_config/zsh/executable_zprofile +++ b/chezmoi/executable_dot_zprofile.tmpl @@ -1,15 +1,16 @@ #!/usr/bin/zsh update_path() { - export PATH="$PATH:$1" + export PATH="$PATH:$1" } # Set manually -export DOTS="$HOME/Repos/Private/dots" +export DOTS="$(dirname $(chezmoi source-path))" export EDITOR=nvim export VISUAL="$EDITOR" export QT_STYLE_OVERRIDE=kvantum export MOZ_ENABLE_WAYLAND=1 +export OPENAI_API_KEY="{{ (rbwFields "OpenAI").api_key.value }}" # Dev Stuff export NPM_PACKAGES="$HOME/.npm-packages" @@ -19,7 +20,7 @@ export PNPM_HOME="$HOME/.local/share/pnpm" # Unset manpath so we can inherit from /etc/manpath via the `manpath` # command -unset MANPATH # delete if you already modified MANPATH elsewhere in your config +unset MANPATH # delete if you already modified MANPATH elsewhere in your config export MANPATH="$NPM_PACKAGES/share/man:$(manpath)" # PATH @@ -34,11 +35,6 @@ update_path "$PNPM_HOME" update_path "$HOME/.local/share/rtx/shims" update_path "$HOME/.spicetify" - -if [[ -e "$DOTS/config/zsh/zprofile.local" ]]; then - source "$DOTS/config/zsh/zprofile.local" -fi - if [[ $OSTYPE =~ 'darwin' ]]; then - eval "$(/opt/homebrew/bin/brew shellenv)" + eval "$(/opt/homebrew/bin/brew shellenv)" fi