2.home-manager/tests/modules/programs/zsh/prezto.nix
Austin Horstman 5176d93c0a lib/zsh: fix shell escaping and integrate formatShellArrayContent
Replace naive string quoting with lib.escapeShellArg for proper shell escaping
of special characters, spaces, and quotes. Integrate with new formatShellArrayContent
for intelligent multi-line array formatting in zsh array definitions.

Signed-off-by: Austin Horstman <khaneliman12@gmail.com>
2025-09-27 13:18:01 -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'
'';
}