home: zsh: refactor 'mkIf' block
This commit is contained in:
parent
c259fe87a0
commit
bc56292544
|
@ -7,87 +7,89 @@ in
|
||||||
enable = mkDisableOption "zsh configuration";
|
enable = mkDisableOption "zsh configuration";
|
||||||
};
|
};
|
||||||
|
|
||||||
config.programs.zsh = lib.mkIf cfg.enable {
|
config = lib.mkIf cfg.enable {
|
||||||
enable = true;
|
programs.zsh = {
|
||||||
dotDir = ".config/zsh"; # Don't clutter $HOME
|
enable = true;
|
||||||
enableCompletion = true;
|
dotDir = ".config/zsh"; # Don't clutter $HOME
|
||||||
|
enableCompletion = true;
|
||||||
|
|
||||||
history = {
|
history = {
|
||||||
size = 500000;
|
size = 500000;
|
||||||
save = 500000;
|
save = 500000;
|
||||||
extended = false;
|
extended = false;
|
||||||
ignoreSpace = true;
|
ignoreSpace = true;
|
||||||
ignoreDups = true;
|
ignoreDups = true;
|
||||||
share = false;
|
share = false;
|
||||||
path = "${config.xdg.dataHome}/zsh/zsh_history";
|
path = "${config.xdg.dataHome}/zsh/zsh_history";
|
||||||
};
|
};
|
||||||
|
|
||||||
plugins = with pkgs; [
|
plugins = with pkgs; [
|
||||||
{
|
{
|
||||||
name = "fast-syntax-highlighting";
|
name = "fast-syntax-highlighting";
|
||||||
file = "share/zsh/site-functions/fast-syntax-highlighting.plugin.zsh";
|
file = "share/zsh/site-functions/fast-syntax-highlighting.plugin.zsh";
|
||||||
src = pkgs.zsh-fast-syntax-highlighting;
|
src = pkgs.zsh-fast-syntax-highlighting;
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
name = "agkozak-zsh-prompt";
|
name = "agkozak-zsh-prompt";
|
||||||
src = fetchFromGitHub {
|
src = fetchFromGitHub {
|
||||||
owner = "agkozak";
|
owner = "agkozak";
|
||||||
repo = "agkozak-zsh-prompt";
|
repo = "agkozak-zsh-prompt";
|
||||||
rev = "v3.9.0";
|
rev = "v3.9.0";
|
||||||
sha256 = "sha256-VTRL+8ph2eI7iPht15epkLggAgtLGxB3DORFTW5GrhE=";
|
sha256 = "sha256-VTRL+8ph2eI7iPht15epkLggAgtLGxB3DORFTW5GrhE=";
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
];
|
|
||||||
|
|
||||||
# Modal editing is life, but CLI benefits from emacs gymnastics
|
|
||||||
defaultKeymap = "emacs";
|
|
||||||
|
|
||||||
# Make those happen early to avoid doing double the work
|
|
||||||
initExtraFirst =
|
|
||||||
lib.optionalString config.my.home.tmux.enable ''
|
|
||||||
# Launch tmux unless already inside one
|
|
||||||
if [ -z "$TMUX" ]; then
|
|
||||||
exec tmux new-session
|
|
||||||
fi
|
|
||||||
''
|
|
||||||
;
|
|
||||||
|
|
||||||
initExtra = lib.concatMapStrings builtins.readFile [
|
|
||||||
./completion-styles.zsh
|
|
||||||
./extra-mappings.zsh
|
|
||||||
./options.zsh
|
|
||||||
];
|
|
||||||
|
|
||||||
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;
|
|
||||||
};
|
|
||||||
|
|
||||||
shellAliases = {
|
|
||||||
# Sometime `gpg-agent` errors out...
|
|
||||||
reset-agent = "gpg-connect-agent updatestartuptty /bye";
|
|
||||||
};
|
|
||||||
|
|
||||||
# Enable VTE integration when using one of the affected shells
|
|
||||||
enableVteIntegration =
|
|
||||||
builtins.any (name: config.my.home.terminal.program == name) [
|
|
||||||
"termite"
|
|
||||||
];
|
];
|
||||||
};
|
|
||||||
|
|
||||||
# Fuzzy-wuzzy
|
# Modal editing is life, but CLI benefits from emacs gymnastics
|
||||||
config.programs.fzf = lib.mkIf cfg.enable {
|
defaultKeymap = "emacs";
|
||||||
enable = true;
|
|
||||||
enableZshIntegration = true;
|
|
||||||
};
|
|
||||||
|
|
||||||
config.programs.dircolors = lib.mkIf cfg.enable {
|
# Make those happen early to avoid doing double the work
|
||||||
enable = true;
|
initExtraFirst =
|
||||||
|
lib.optionalString config.my.home.tmux.enable ''
|
||||||
|
# Launch tmux unless already inside one
|
||||||
|
if [ -z "$TMUX" ]; then
|
||||||
|
exec tmux new-session
|
||||||
|
fi
|
||||||
|
''
|
||||||
|
;
|
||||||
|
|
||||||
|
initExtra = lib.concatMapStrings builtins.readFile [
|
||||||
|
./completion-styles.zsh
|
||||||
|
./extra-mappings.zsh
|
||||||
|
./options.zsh
|
||||||
|
];
|
||||||
|
|
||||||
|
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;
|
||||||
|
};
|
||||||
|
|
||||||
|
shellAliases = {
|
||||||
|
# Sometime `gpg-agent` errors out...
|
||||||
|
reset-agent = "gpg-connect-agent updatestartuptty /bye";
|
||||||
|
};
|
||||||
|
|
||||||
|
# Enable VTE integration when using one of the affected shells
|
||||||
|
enableVteIntegration =
|
||||||
|
builtins.any (name: config.my.home.terminal.program == name) [
|
||||||
|
"termite"
|
||||||
|
];
|
||||||
|
};
|
||||||
|
|
||||||
|
# Fuzzy-wuzzy
|
||||||
|
programs.fzf = {
|
||||||
|
enable = true;
|
||||||
|
enableZshIntegration = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
programs.dircolors = {
|
||||||
|
enable = true;
|
||||||
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue