home: zsh: migrate to 'initContent'
All checks were successful
ci/woodpecker/push/check Pipeline was successful

This also fixes a small ordering issue: my alias definitions used to be
defined at the very end of the file, they're now slotted _before_ the
`zshrc.local` import.
This commit is contained in:
Bruno BELANYI 2025-03-24 11:58:56 +00:00
parent 9156a8211d
commit 6fc81e45e9

View file

@ -87,28 +87,26 @@ in
# Modal editing is life, but CLI benefits from emacs gymnastics # Modal editing is life, but CLI benefits from emacs gymnastics
defaultKeymap = "emacs"; defaultKeymap = "emacs";
# Make those happen early to avoid doing double the work initContent = lib.mkMerge [
initExtraFirst = lib.mkBefore '' # Make those happen early to avoid doing double the work
${ (lib.mkBefore (lib.optionalString cfg.launchTmux ''
lib.optionalString cfg.launchTmux '' # Launch tmux unless already inside one
# Launch tmux unless already inside one if [ -z "$TMUX" ]; then
if [ -z "$TMUX" ]; then exec tmux new-session
exec tmux new-session fi
fi ''))
''
}
'';
initExtra = lib.mkAfter '' (lib.mkAfter ''
source ${./completion-styles.zsh} source ${./completion-styles.zsh}
source ${./extra-mappings.zsh} source ${./extra-mappings.zsh}
source ${./options.zsh} source ${./options.zsh}
# Source local configuration # Source local configuration
if [ -f "$ZDOTDIR/zshrc.local" ]; then if [ -f "$ZDOTDIR/zshrc.local" ]; then
source "$ZDOTDIR/zshrc.local" source "$ZDOTDIR/zshrc.local"
fi fi
''; '')
];
localVariables = { localVariables = {
# I like having the full path # I like having the full path
@ -151,7 +149,7 @@ in
}; };
# Use OSC-777 to send the notification through SSH # Use OSC-777 to send the notification through SSH
initExtra = lib.mkIf cfg.notify.ssh.useOsc777 '' initContent = lib.mkIf cfg.notify.ssh.useOsc777 ''
done_send_notification() { done_send_notification() {
local exit_status="$1" local exit_status="$1"
local title="$2" local title="$2"