1
0
Fork 0
mirror of https://github.com/nix-community/home-manager.git synced 2025-12-03 15:41:02 +01:00
home-manager/tests/modules/programs/zsh/plugins.nix
Kristopher James Kent (kjkent) 21399deff2 zsh: improve dotDir handling
Previously, `config.programs.zsh.dotDir` prepended strings with `$HOME`.
This caused issues like nix-community#5100, where `$HOME` is
inconsistently resolved in time for the evaluation of the option. The handling
of this variable is also inconsistent with how paths are handled elsewhere,
including within the same module, where `config.programs.zsh.history.path`
does not mutate the supplied string.

To preserve backwards compatibility, this change prepends
`config.home.homeDirectory` to relative paths, while assigning absolute paths
unchanged. Tests for both cases are added.

Signed-off-by: Austin Horstman <khaneliman12@gmail.com>
2025-07-25 13:15:29 -05:00

31 lines
881 B
Nix

{ pkgs, ... }:
let
mockZshPluginSrc = pkgs.writeText "mockZshPluginSrc" "echo example";
in
{
config = {
programs.zsh = {
enable = true;
plugins = [
{
name = "mockPlugin";
file = "share/mockPlugin/mockPlugin.plugin.zsh";
src = mockZshPluginSrc;
completions = [
"share/zsh/site-functions"
"share/zsh/vendor-completions"
];
}
];
};
test.stubs.zsh = { };
nmt.script = ''
assertFileRegex home-files/.zshrc '^path+="/home/hm-user/.zsh/plugins/mockPlugin"$'
assertFileRegex home-files/.zshrc '^fpath+="/home/hm-user/.zsh/plugins/mockPlugin"$'
assertFileRegex home-files/.zshrc '^fpath+=("/home/hm-user/.zsh/plugins/mockPlugin/share/zsh/site-functions" "/home/hm-user/.zsh/plugins/mockPlugin/share/zsh/vendor-completions")$'
'';
};
}