1
0
Fork 0
mirror of https://github.com/nix-community/home-manager synced 2024-11-10 21:29:48 +01:00

zsh: add support for zproof

Using zproof allows benchmarking the shell initialization. It must be
called as the first & last line of `~/.zshrc`.

PR #4745
This commit is contained in:
MayNiklas 2023-12-07 16:33:11 +01:00 committed by Mikilio
parent a7c92eece7
commit b1ed121009
No known key found for this signature in database
GPG key ID: 5B2F1A890CF33F3F

View file

@ -356,6 +356,13 @@ in
description = "Enable zsh autosuggestions"; description = "Enable zsh autosuggestions";
}; };
zproof.enable = mkOption {
default = false;
description = ''
Enable zproof in your zshrc.
'';
};
syntaxHighlighting = mkOption { syntaxHighlighting = mkOption {
type = syntaxHighlightingModule; type = syntaxHighlightingModule;
default = {}; default = {};
@ -534,6 +541,12 @@ in
++ optional cfg.oh-my-zsh.enable cfg.oh-my-zsh.package; ++ optional cfg.oh-my-zsh.enable cfg.oh-my-zsh.package;
home.file."${relToDotDir ".zshrc"}".text = concatStringsSep "\n" ([ home.file."${relToDotDir ".zshrc"}".text = concatStringsSep "\n" ([
# zproof must be loaded before everything else, since it
# benchmarks the shell initialization.
(optionalString cfg.zproof.enable ''
zmodload zsh/zprof
'')
cfg.initExtraFirst cfg.initExtraFirst
"typeset -U path cdpath fpath manpath" "typeset -U path cdpath fpath manpath"
@ -657,6 +670,11 @@ in
(lib.toList cfg.historySubstringSearch.searchDownKey) (lib.toList cfg.historySubstringSearch.searchDownKey)
} }
'') '')
(optionalString cfg.zproof.enable
''
zprof
'')
]); ]);
} }