home: zsh: use 'mkMerge'
This will make adding modular configuration easier.
This commit is contained in:
parent
c9969775da
commit
521522e4e9
|
@ -17,79 +17,81 @@ in
|
||||||
launchTmux = mkEnableOption "auto launch tmux at shell start";
|
launchTmux = mkEnableOption "auto launch tmux at shell start";
|
||||||
};
|
};
|
||||||
|
|
||||||
config = lib.mkIf cfg.enable {
|
config = lib.mkIf cfg.enable (lib.mkMerge [
|
||||||
home.packages = with pkgs; [
|
{
|
||||||
zsh-completions
|
home.packages = with pkgs; [
|
||||||
];
|
zsh-completions
|
||||||
|
|
||||||
programs.zsh = {
|
|
||||||
enable = true;
|
|
||||||
dotDir = "${relativeXdgConfig}/zsh"; # Don't clutter $HOME
|
|
||||||
enableCompletion = true;
|
|
||||||
|
|
||||||
history = {
|
|
||||||
size = 500000;
|
|
||||||
save = 500000;
|
|
||||||
extended = true;
|
|
||||||
expireDuplicatesFirst = true;
|
|
||||||
ignoreSpace = true;
|
|
||||||
ignoreDups = true;
|
|
||||||
share = false;
|
|
||||||
path = "${config.xdg.dataHome}/zsh/zsh_history";
|
|
||||||
};
|
|
||||||
|
|
||||||
plugins = [
|
|
||||||
{
|
|
||||||
name = "fast-syntax-highlighting";
|
|
||||||
file = "share/zsh/site-functions/fast-syntax-highlighting.plugin.zsh";
|
|
||||||
src = pkgs.zsh-fast-syntax-highlighting;
|
|
||||||
}
|
|
||||||
{
|
|
||||||
name = "agkozak-zsh-prompt";
|
|
||||||
file = "share/zsh/site-functions/agkozak-zsh-prompt.plugin.zsh";
|
|
||||||
src = pkgs.agkozak-zsh-prompt;
|
|
||||||
}
|
|
||||||
];
|
];
|
||||||
|
|
||||||
# Modal editing is life, but CLI benefits from emacs gymnastics
|
programs.zsh = {
|
||||||
defaultKeymap = "emacs";
|
enable = true;
|
||||||
|
dotDir = "${relativeXdgConfig}/zsh"; # Don't clutter $HOME
|
||||||
|
enableCompletion = true;
|
||||||
|
|
||||||
# Make those happen early to avoid doing double the work
|
history = {
|
||||||
initExtraFirst = ''
|
size = 500000;
|
||||||
${
|
save = 500000;
|
||||||
lib.optionalString cfg.launchTmux ''
|
extended = true;
|
||||||
# Launch tmux unless already inside one
|
expireDuplicatesFirst = true;
|
||||||
if [ -z "$TMUX" ]; then
|
ignoreSpace = true;
|
||||||
exec tmux new-session
|
ignoreDups = true;
|
||||||
fi
|
share = false;
|
||||||
''
|
path = "${config.xdg.dataHome}/zsh/zsh_history";
|
||||||
}
|
};
|
||||||
'';
|
|
||||||
|
|
||||||
initExtra = ''
|
plugins = [
|
||||||
source ${./completion-styles.zsh}
|
{
|
||||||
source ${./extra-mappings.zsh}
|
name = "fast-syntax-highlighting";
|
||||||
source ${./options.zsh}
|
file = "share/zsh/site-functions/fast-syntax-highlighting.plugin.zsh";
|
||||||
|
src = pkgs.zsh-fast-syntax-highlighting;
|
||||||
|
}
|
||||||
|
{
|
||||||
|
name = "agkozak-zsh-prompt";
|
||||||
|
file = "share/zsh/site-functions/agkozak-zsh-prompt.plugin.zsh";
|
||||||
|
src = pkgs.agkozak-zsh-prompt;
|
||||||
|
}
|
||||||
|
];
|
||||||
|
|
||||||
# Source local configuration
|
# Modal editing is life, but CLI benefits from emacs gymnastics
|
||||||
if [ -f "$ZDOTDIR/zshrc.local" ]; then
|
defaultKeymap = "emacs";
|
||||||
source "$ZDOTDIR/zshrc.local"
|
|
||||||
fi
|
|
||||||
'';
|
|
||||||
|
|
||||||
localVariables = {
|
# Make those happen early to avoid doing double the work
|
||||||
# I like having the full path
|
initExtraFirst = ''
|
||||||
AGKOZAK_PROMPT_DIRTRIM = 0;
|
${
|
||||||
# Because I *am* from EPITA
|
lib.optionalString cfg.launchTmux ''
|
||||||
AGKOZAK_PROMPT_CHAR = [ "42sh$" "42sh#" ":" ];
|
# Launch tmux unless already inside one
|
||||||
# Easy on the eyes
|
if [ -z "$TMUX" ]; then
|
||||||
AGKOZAK_COLORS_BRANCH_STATUS = "magenta";
|
exec tmux new-session
|
||||||
# I don't like moving my eyes
|
fi
|
||||||
AGKOZAK_LEFT_PROMPT_ONLY = 1;
|
''
|
||||||
|
}
|
||||||
|
'';
|
||||||
|
|
||||||
|
initExtra = ''
|
||||||
|
source ${./completion-styles.zsh}
|
||||||
|
source ${./extra-mappings.zsh}
|
||||||
|
source ${./options.zsh}
|
||||||
|
|
||||||
|
# Source local configuration
|
||||||
|
if [ -f "$ZDOTDIR/zshrc.local" ]; then
|
||||||
|
source "$ZDOTDIR/zshrc.local"
|
||||||
|
fi
|
||||||
|
'';
|
||||||
|
|
||||||
|
localVariables = {
|
||||||
|
# I like having the full path
|
||||||
|
AGKOZAK_PROMPT_DIRTRIM = 0;
|
||||||
|
# Because I *am* from EPITA
|
||||||
|
AGKOZAK_PROMPT_CHAR = [ "42sh$" "42sh#" ":" ];
|
||||||
|
# Easy on the eyes
|
||||||
|
AGKOZAK_COLORS_BRANCH_STATUS = "magenta";
|
||||||
|
# I don't like moving my eyes
|
||||||
|
AGKOZAK_LEFT_PROMPT_ONLY = 1;
|
||||||
|
};
|
||||||
|
|
||||||
|
# Enable VTE integration
|
||||||
|
enableVteIntegration = true;
|
||||||
};
|
};
|
||||||
|
}
|
||||||
# Enable VTE integration
|
]);
|
||||||
enableVteIntegration = true;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue