diff --git a/modules/programs/zsh.nix b/modules/programs/zsh.nix
index efe2946c..9e3c517d 100644
--- a/modules/programs/zsh.nix
+++ b/modules/programs/zsh.nix
@@ -302,6 +302,12 @@ in
description = "Extra commands that should be added to .zshrc.";
};
+ initExtraFirst = mkOption {
+ default = "";
+ type = types.lines;
+ description = "Commands that should be added to top of .zshrc.";
+ };
+
envExtra = mkOption {
default = "";
type = types.lines;
@@ -417,6 +423,8 @@ in
++ optional cfg.oh-my-zsh.enable oh-my-zsh;
home.file."${relToDotDir ".zshrc"}".text = ''
+ ${cfg.initExtraFirst}
+
typeset -U path cdpath fpath manpath
${optionalString (cfg.cdpath != []) ''