zsh: consider zsh.{profile,login,logout,env}Extra in prezto

Right now the `zsh.prezto` module ignores the contents of the
`zsh.{profile,login,logout,env}Extra` options, so it means that if you
try to set, e.g., `zsh.profileExtra = "something";` this option will be
(silently) ignored.

This commit fixes another issue: since the main `zsh` module sets
`home.file."${relToDotDir".zshenv"}".text` while `zsh.prezto` set the
same file using `.source`, `zsh.prezto` would have priority so the
environment variables from Home-Manager would not be loaded in non-NixOS
systems. Now that we are using `.text` for both, the issue is fixed.
This commit is contained in:
Thiago Kenji Okada 2025-05-13 23:20:40 +01:00 committed by Austin Horstman
parent b44c39cf46
commit 5f36563a5c
2 changed files with 46 additions and 6 deletions

View file

@ -13,6 +13,7 @@ let
;
cfg = config.programs.zsh.prezto;
cfgZsh = config.programs.zsh;
relToDotDir =
file:
@ -423,12 +424,30 @@ in
config = lib.mkIf cfg.enable (
lib.mkMerge [
{
home.file."${relToDotDir ".zprofile"}".source = "${cfg.package}/share/zsh-prezto/runcoms/zprofile";
home.file."${relToDotDir ".zlogin"}".source = "${cfg.package}/share/zsh-prezto/runcoms/zlogin";
home.file."${relToDotDir ".zlogout"}".source = "${cfg.package}/share/zsh-prezto/runcoms/zlogout";
home.packages = [ cfg.package ];
home.file."${relToDotDir ".zshenv"}".source = "${cfg.package}/share/zsh-prezto/runcoms/zshenv";
home.file."${relToDotDir ".zprofile"}".text = ''
# Generated by Nix
source ${cfg.package}/share/zsh-prezto/runcoms/zprofile
${cfgZsh.profileExtra}
'';
home.file."${relToDotDir ".zlogin"}".text = ''
# Generated by Nix
source ${cfg.package}/share/zsh-prezto/runcoms/zlogin
${cfgZsh.loginExtra}
'';
home.file."${relToDotDir ".zlogout"}".text = ''
# Generated by Nix
source ${cfg.package}/share/zsh-prezto/runcoms/zlogout
${cfgZsh.logoutExtra}
'';
# Using mkAfter to make sure we load Home-Manager's environment
# variables first (see modules/prgrams/zsh.nix)
home.file."${relToDotDir ".zshenv"}".text = lib.mkAfter ''
# Generated by Nix
source ${cfg.package}/share/zsh-prezto/runcoms/zshenv
${cfgZsh.envExtra}
'';
home.file."${relToDotDir ".zpreztorc"}".text = ''
# Generated by Nix
${optionalString (cfg.caseSensitive != null) ''