fix(modules/default.nix): Migrate from initExtra and initExtraFirst to initContent

This commit is contained in:
Jiří Štefka 2025-06-19 17:23:37 +02:00
parent cc2e260254
commit 8c163b6814
Signed by: jiriks74
GPG key ID: 1D5E30D3DB2264DE

View file

@ -83,82 +83,84 @@ in {
]; ];
}; };
initExtraFirst = '' initContent = let
# Basic auto/tab complete: initExtraFirst = lib.mkBefore ''
autoload -U compinit # Basic auto/tab complete:
zstyle ':completion:*' menu select autoload -U compinit
zmodload zsh/complist zstyle ':completion:*' menu select
_comp_options+=(globdots) # Include hidden files. zmodload zsh/complist
_comp_options+=(globdots) # Include hidden files.
if [[ "''${ZSH_PROFILE}" -eq 1 ]]; then if [[ "''${ZSH_PROFILE}" -eq 1 ]]; then
zmodload zsh/zprof # Profiling. Enable `zprof` at the end of initExtra too. zmodload zsh/zprof # Profiling. Enable `zprof` at the end of initExtra too.
fi fi
''; '';
initExtra = '' initExtra = ''
# From antidote (for p10k): # From antidote (for p10k):
# prompts: # prompts:
# with prompt plugins, remember to add this to your .zshrc: # with prompt plugins, remember to add this to your .zshrc:
# To customize prompt, run `p10k configure` or edit ~/.p10k.zsh. # To customize prompt, run `p10k configure` or edit ~/.p10k.zsh.
[[ ! -f ~/.p10k.zsh ]] || source ~/.p10k.zsh [[ ! -f ~/.p10k.zsh ]] || source ~/.p10k.zsh
autoload -Uz promptinit && promptinit && prompt powerlevel10k autoload -Uz promptinit && promptinit && prompt powerlevel10k
# Remove nix from path if we are in a container (distrobox) # Remove nix from path if we are in a container (distrobox)
if [ -v DISTROBOX_ENTER_PATH ]; then if [ -v DISTROBOX_ENTER_PATH ]; then
export PATH=$(echo $PATH | tr ':' '\n' | grep -vE '/nix/|/run/wrappers|\.nix-profile|/etc/profiles/per-user/jirka/bin|/run/current-system/sw/bin' | tr '\n' ':') export PATH=$(echo $PATH | tr ':' '\n' | grep -vE '/nix/|/run/wrappers|\.nix-profile|/etc/profiles/per-user/jirka/bin|/run/current-system/sw/bin' | tr '\n' ':')
export PATH=$(echo $PATH | sed 's/:$//') export PATH=$(echo $PATH | sed 's/:$//')
fi fi
if [ -v ASCIINEMA_REC ]; then if [ -v ASCIINEMA_REC ]; then
_zsh_autosuggest_disable _zsh_autosuggest_disable
fi fi
bindkey '^ ' autosuggest-accept # Bind CTRL + Space bindkey '^ ' autosuggest-accept # Bind CTRL + Space
bindkey '^Y' autosuggest-accept # Bind CTRL + Y bindkey '^Y' autosuggest-accept # Bind CTRL + Y
bindkey "$terminfo[kcuu1]" history-substring-search-up bindkey "$terminfo[kcuu1]" history-substring-search-up
bindkey "$terminfo[kcud1]" history-substring-search-down bindkey "$terminfo[kcud1]" history-substring-search-down
bindkey -M vicmd 'k' history-substring-search-up bindkey -M vicmd 'k' history-substring-search-up
bindkey -M vicmd 'j' history-substring-search-down bindkey -M vicmd 'j' history-substring-search-down
# Extracting # Extracting
ex () ex ()
{ {
if [ -f $1 ] ; then if [ -f $1 ] ; then
case $1 in case $1 in
*.tar.bz2) tar xjf $1 ;; *.tar.bz2) tar xjf $1 ;;
*.tar.gz) tar xzf $1 ;; *.tar.gz) tar xzf $1 ;;
*.tar.xz) tar xJf $1 ;; *.tar.xz) tar xJf $1 ;;
*.bz2) bunzip3 $1 ;; *.bz2) bunzip3 $1 ;;
*.rar) unrar x $1 ;; *.rar) unrar x $1 ;;
*.gz) gunzip $1 ;; *.gz) gunzip $1 ;;
*.tar) tar xf $1 ;; *.tar) tar xf $1 ;;
*.tbz2) tar xjf $1 ;; *.tbz2) tar xjf $1 ;;
*.tgz) tar xzf $1 ;; *.tgz) tar xzf $1 ;;
*.zip) unzip $1 ;; *.zip) unzip $1 ;;
*.Z) uncompress $1;; *.Z) uncompress $1;;
*.7z) 7z x $1 ;; *.7z) 7z x $1 ;;
*) echo "'$1' cannot be extracted via ex()" ;; *) echo "'$1' cannot be extracted via ex()" ;;
esac esac
else else
echo "'$1' is not a valid file" echo "'$1' is not a valid file"
fi fi
} }
# Kitty binds # Kitty binds
if [ "$TERM" = "xterm-kitty" ]; then if [ "$TERM" = "xterm-kitty" ]; then
alias kssh="kitty +kitten ssh" alias kssh="kitty +kitten ssh"
alias icat="kitty +kitten icat" alias icat="kitty +kitten icat"
alias d="kitty +kitten diff" alias d="kitty +kitten diff"
alias get="kitty +kitten transfer" alias get="kitty +kitten transfer"
alias put="kitty +kitten transfer --direction=upload" alias put="kitty +kitten transfer --direction=upload"
alias kclip="kitty +kitten clipboard" alias kclip="kitty +kitten clipboard"
fi fi
if [[ "''${ZSH_PROFILE}" -eq 1 ]]; then if [[ "''${ZSH_PROFILE}" -eq 1 ]]; then
zprof zprof
fi fi
''; '';
in lib.mkMerge [ initExtraFirst initExtra ];
localVariables = { localVariables = {
YSU_MESSAGE_POSITION = "after"; YSU_MESSAGE_POSITION = "after";