1
0
Fork 0
mirror of https://github.com/nix-community/home-manager.git synced 2025-12-09 10:31:06 +01:00
home-manager/tests/modules/programs/zsh/prezto.nix
Thiago Kenji Okada 5f36563a5c 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.
2025-05-13 19:59:12 -05:00

41 lines
1.3 KiB
Nix

{
programs.zsh = {
enable = true;
envExtra = "envExtra";
profileExtra = "profileExtra";
loginExtra = "loginExtra";
logoutExtra = "logoutExtra";
sessionVariables.FOO = "bar";
prezto = {
enable = true;
extraConfig = "configExtra";
};
};
test.stubs = {
zsh-prezto = {
outPath = null;
buildScript = ''
mkdir -p $out/share/zsh-prezto/runcoms
echo '# zprofile' > $out/share/zsh-prezto/runcoms/zprofile
echo '# zlogin' > $out/share/zsh-prezto/runcoms/zlogin
echo '# zlogout' > $out/share/zsh-prezto/runcoms/zlogout
echo '# zshenv' > $out/share/zsh-prezto/runcoms/zshenv
echo '# zshrc' > $out/share/zsh-prezto/runcoms/zshrc
'';
};
};
nmt.script = ''
assertFileContains home-files/.zpreztorc 'configExtra'
assertFileContains home-files/.zprofile 'profileExtra'
assertFileContains home-files/.zlogin 'loginExtra'
assertFileContains home-files/.zlogout 'logoutExtra'
assertFileContains home-files/.zshenv 'envExtra'
# make sure we are loading the environment variables
assertFileContains home-files/.zshenv \
'. "/home/hm-user/.nix-profile/etc/profile.d/hm-session-vars.sh"'
assertFileContains home-files/.zshenv \
'export FOO="bar"'
'';
}