zsh: move zprof to separate file

zsh is incredibly bloated, moving zprof to separate file

Signed-off-by: Austin Horstman <khaneliman12@gmail.com>
This commit is contained in:
Austin Horstman 2025-07-11 22:14:01 -05:00
parent 9b76feafd0
commit 3d95ab3cdc
2 changed files with 38 additions and 19 deletions

View file

@ -31,6 +31,7 @@ in
imports = [
./oh-my-zsh.nix
./prezto.nix
./zprof.nix
./zsh-abbr.nix
(lib.mkRenamedOptionModule
[ "programs" "zsh" "enableAutosuggestions" ]
@ -40,7 +41,6 @@ in
[ "programs" "zsh" "enableSyntaxHighlighting" ]
[ "programs" "zsh" "syntaxHighlighting" "enable" ]
)
(lib.mkRenamedOptionModule [ "programs" "zsh" "zproof" ] [ "programs" "zsh" "zprof" ])
];
options =
@ -370,14 +370,6 @@ in
type = types.lines;
};
zprof.enable = mkOption {
type = types.bool;
default = false;
description = ''
Enable zprof in your zshrc.
'';
};
syntaxHighlighting = mkOption {
type = syntaxHighlightingModule;
default = { };
@ -684,14 +676,6 @@ in
home.packages = [ cfg.package ] ++ lib.optional cfg.enableCompletion pkgs.nix-zsh-completions;
programs.zsh.initContent = lib.mkMerge [
# zprof must be loaded before everything else, since it
# benchmarks the shell initialization.
(lib.mkIf cfg.zprof.enable (
mkOrder 400 ''
zmodload zsh/zprof
''
))
(lib.mkIf (cfg.initExtraFirst != "") (lib.mkBefore cfg.initExtraFirst))
(mkOrder 510 "typeset -U path cdpath fpath manpath")
@ -864,8 +848,6 @@ in
)}
''
))
(lib.mkIf cfg.zprof.enable (mkOrder 1450 "zprof"))
];
home.file."${relToDotDir ".zshrc"}".text = cfg.initContent;

View file

@ -0,0 +1,37 @@
{
config,
lib,
...
}:
let
inherit (lib) mkOption types;
cfg = config.programs.zsh;
in
{
imports = [
(lib.mkRenamedOptionModule [ "programs" "zsh" "zproof" ] [ "programs" "zsh" "zprof" ])
];
options.programs.zsh.zprof = {
enable = mkOption {
type = types.bool;
default = false;
description = ''
Enable zprof in your zshrc.
'';
};
};
config = lib.mkIf cfg.zprof.enable {
programs.zsh.initContent = lib.mkMerge [
# zprof must be loaded before everything else, since it
# benchmarks the shell initialization.
(lib.mkOrder 400 ''
zmodload zsh/zprof
'')
(lib.mkOrder 1450 "zprof")
];
};
}