File tree Expand file tree Collapse file tree 3 files changed +35
-7
lines changed
tests/modules/programs/zsh Expand file tree Collapse file tree 3 files changed +35
-7
lines changed Original file line number Diff line number Diff line change 344344 mkIf cfg . enable (
345345 lib . mkMerge [
346346 {
347+ assertions = [
348+ {
349+ assertion = ! lib . hasInfix "$" cfg . dotDir ;
350+ message = ''
351+ programs.zsh.dotDir cannot contain shell variables as it is used for file creation at build time.
352+ Current dotDir: ${ cfg . dotDir }
353+ Consider using an absolute path or home-manager config options instead.
354+ You can replace shell variables with options like:
355+ - config.home.homeDirectory (user's home directory)
356+ - config.xdg.configHome (XDG config directory)
357+ - config.xdg.dataHome (XDG data directory)
358+ - config.xdg.cacheHome (XDG cache directory)
359+ '' ;
360+ }
361+ ] ;
362+
347363 warnings =
348364 lib . optionals
349- ( cfg . dotDir != homeDir && ! lib . hasPrefix "/" cfg . dotDir && ! lib . hasPrefix "$" cfg . dotDir )
365+ ( cfg . dotDir != homeDir && ! lib . hasPrefix "/" cfg . dotDir && ! lib . hasInfix "$" cfg . dotDir )
350366 [
351367 ''
352368 Using relative paths in programs.zsh.dotDir is deprecated and will be removed in a future release.
Original file line number Diff line number Diff line change 44 zsh-dotdir-absolute = import ./dotdir.nix "absolute" ;
55 zsh-dotdir-default = import ./dotdir.nix "default" ;
66 zsh-dotdir-relative = import ./dotdir.nix "relative" ;
7- zsh-dotdir-xdg -variable = import ./dotdir.nix "xdg -variable" ;
7+ zsh-dotdir-shell -variable = import ./dotdir.nix "shell -variable" ;
88 zsh-history-ignore-pattern = ./history-ignore-pattern.nix ;
99 zsh-history-path-absolute = import ./history-path.nix "absolute" ;
1010 zsh-history-path-default = import ./history-path.nix "default" ;
Original file line number Diff line number Diff line change 1818 subDir
1919 else if case == "default" then
2020 options . programs . zsh . dotDir . default
21- else if case == "xdg -variable" then
21+ else if case == "shell -variable" then
2222 "\ ${XDG_CONFIG_HOME:-\ $HOME/.config}/zsh"
2323 else
2424 abort "Test condition not provided." ;
4848 ''
4949 ] ;
5050
51+ test . asserts . assertions . expected = lib . optionals ( case == "shell-variable" ) [
52+ ''
53+ programs.zsh.dotDir cannot contain shell variables as it is used for file creation at build time.
54+ Current dotDir: '' ${XDG_CONFIG_HOME:-'' $HOME/.config}/zsh
55+ Consider using an absolute path or home-manager config options instead.
56+ You can replace shell variables with options like:
57+ - config.home.homeDirectory (user's home directory)
58+ - config.xdg.configHome (XDG config directory)
59+ - config.xdg.dataHome (XDG data directory)
60+ - config.xdg.cacheHome (XDG cache directory)
61+ ''
62+ ] ;
63+
5164 nmt . script =
52- if case == "xdg -variable" then
65+ if case == "shell -variable" then
5366 ''
54- # For XDG variable case, check that shell variables are preserved in the generated shell code
55- # The fixed implementation should preserve variables without wrapping them in single quotes
56- assertFileContains home-files/.zshenv 'source '' ${XDG_CONFIG_HOME:-'' $HOME/.config}/zsh/.zshenv'
67+ # Shell variable case should fail assertion, no files to check
68+ echo "Shell variable case should trigger assertion failure"
5769 ''
5870 else
5971 lib . concatStringsSep "\n " [
You can’t perform that action at this time.
0 commit comments