Migrate zsh configuration

Use zsh with old configuration.
Ensure i3 will start st terminal with zsh from path (nix / home-manager)
instead of system shell (zsh by Ubuntu).
This commit is contained in:
Daniel Siepmann 2022-02-07 13:04:58 +01:00
parent f4c7cbead1
commit 2ab2fb414a
Signed by: Daniel Siepmann
GPG key ID: 33D6629915560EF4
4 changed files with 131 additions and 2 deletions

View file

@ -59,6 +59,10 @@
};
tmux = import ./home/programs/tmux.nix {
};
zsh = import ./home/programs/zsh.nix {
inherit config;
inherit pkgs;
};
# Media
cmus.enable = true;

View file

@ -51,7 +51,7 @@ hide_edge_borders both
workspace_layout tabbed
# start a terminal
bindsym $mod+Return exec st
bindsym $mod+Return exec st zsh
# kill focused window
bindsym $mod+Shift+q kill

125
home/programs/zsh.nix Normal file
View file

@ -0,0 +1,125 @@
{ config, pkgs }:
{
enable = true;
autocd = true;
enableSyntaxHighlighting = true;
defaultKeymap = "viins";
sessionVariables = {
LC_ALL = "en_US.UTF-8";
LANG = "en_US.UTF-8";
LANGUAGE = "en_US";
EDITOR = "nvim";
SHELL = pkgs.zsh;
LESS = "-R -J -W -i -M";
LSCOLORS = "HxGxDxDxbxDxDxababcxcx";
LS_COLORS = "di=1;37:ln=1;36:so=1;33:pi=1;33:ex=31:bd=1;33:cd=1;33:su=30;41:sg=30;41:tw=32:ow=32 # I use this";
JQ_COLORS = "1;35:0;35:0;35:0;32:0;33:1;37:1;37";
GREP_COLOR = "0;30;44";
TYPO3_CONTEXT = "Development/dsiepmann";
PHAN_COLOR_SCHEME = "code";
# Reduce timeout after <ESC> (vi keybindings)
KEYTIMEOUT = 1;
};
shellAliases = {
ll = "ls -laph --color=auto";
# Open in main view with all references.
tigr = "tig refs";
# Open in main view with ALL commits, not only current branch tree.
tiga = "tig --all --show-signature";
# Tmux outside tmux.
ta = "tmux attach";
tc = "tmux new-session -s ";
# TYPO3 contribution specific commands
t3Push = "git push origin HEAD:refs/for/master";
t3Pull = "git pull --rebase origin master; git checkout master";
t3Rollback = "git checkout master; git reset --hard origin/master";
t3Clean = "t3Rollback && t3Pull";
# GREP // TODO: Check if this can be configured, e.g. environment variable
grep = "grep --color=always";
# Create borg backup
createBackup = "mkdir -p ~/backup-etc && sudo cp -r /etc/* ~/backup-etc && sudo cp -r /etc/.* ~/backup-etc && sudo chown daniels:daniels -R ~/backup-etc/ && borg create -v --progress --stats --exclude-from ~/.borg-exclude /media/daniels/Backup::$(date +%F-%R) ~/; sudo rm -rf ~/backup-etc";
};
history = {
size = 10000;
save = 10000;
ignoreDups = true;
ignoreSpace = true;
extended = true;
share = false;
};
initExtraBeforeCompInit = ''
if [[ -z $SSH_AGENT_PID ]]; then
hash ssh-agent 2> /dev/null && eval $(ssh-agent) > /dev/null
fi
# Global composer installed packages.
export PATH=~/.composer/vendor/bin:$PATH
# Own "binaries" / executables, local to this machine
export PATH=~/bin:$PATH
# "install" nix
if [ -e /home/daniels/.nix-profile/etc/profile.d/nix.sh ]; then . /home/daniels/.nix-profile/etc/profile.d/nix.sh; fi # added by Nix installer
export LOCALE_ARCHIVE="$(readlink ~/.nix-profile/lib/locale)/locale-archive"
export NIX_PATH=$HOME/.nix-defexpr/channels
'';
initExtra = ''
autoload -U colors && colors
autoload -U promptinit
autoload -U complist
# Set vim mode
set -o vi
# Allow editing of current line in $EDITOR using command mode V
autoload -U edit-command-line
zle -N edit-command-line
bindkey -M vicmd v edit-command-line
# ctrl-r starts searching history backward
bindkey '^r' history-incremental-search-backward
zstyle ':completion:*:descriptions' format '%U%B%d%b%u'
zstyle ':completion:*:warnings' format '%BSorry, no matches for: %d%b'
zstyle ':completion:*' menu select
zstyle ':completion:*' use-cache on
zstyle ':completion:*' list-colors ''${(s.:.)LS_COLORS}
zstyle ':completion:*' cache-path ${config.xdg.cacheHome}/zsh-completion/
zstyle ':completion:*' group-name '''
zstyle ':completion::complete:git-checkout:argument-rest:' group-order heads-local heads-remote commit-tags
zstyle ':completion::complete:git-checkout:argument-rest:commits' command 'echo'
zstyle ':completion::complete:git-checkout:argument-rest:valid-ref-names' command 'echo'
zstyle ':completion::complete:git-checkout:argument-rest:remote-branch-refs-noprefix' command 'echo'
# also complete defined alias
setopt completealiases
# Correct mistyped commands
setopt correctall
# Try to make the completion list smaller (occupying less lines) by printing the matches in columns with different widths.
setopt list_packed
# When listing files that are possible completions, show the type of each file with a trailing identifying mark.
setopt list_types
# Allow for functions in the prompt.
setopt PROMPT_SUBST
PROMPT=$'%{$fg[blue]%}%1~ > %{$reset_color%}'
'';
}

View file

@ -93,7 +93,7 @@ No particular order:
* Migrate mailhog (manually installed right now)
* Migrate zsh
* Migrate neovim
* Migrate ssh config (I don't really like to expose customer server names and configs to outer world, how to handle?)