From 77c698fa4b3081b6019ad77d1bfedf06dbbde0db Mon Sep 17 00:00:00 2001 From: MayNiklas Date: Thu, 7 Dec 2023 16:33:11 +0100 Subject: [PATCH] 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 --- modules/programs/zsh.nix | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/modules/programs/zsh.nix b/modules/programs/zsh.nix index 851fb47ac..53972759b 100644 --- a/modules/programs/zsh.nix +++ b/modules/programs/zsh.nix @@ -356,6 +356,13 @@ in description = "Enable zsh autosuggestions"; }; + zproof.enable = mkOption { + default = false; + description = '' + Enable zproof in your zshrc. + ''; + }; + syntaxHighlighting = mkOption { type = syntaxHighlightingModule; default = {}; @@ -534,6 +541,12 @@ in ++ optional cfg.oh-my-zsh.enable cfg.oh-my-zsh.package; 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 "typeset -U path cdpath fpath manpath" @@ -657,6 +670,11 @@ in (lib.toList cfg.historySubstringSearch.searchDownKey) } '') + + (optionalString cfg.zproof.enable + '' + zprof + '') ]); }