1
0
Fork 0
mirror of https://github.com/nix-community/home-manager.git synced 2025-11-08 19:46:05 +01:00

zsh: relative path deprecation warning

Warn users when they configure a relative path. We want to encourage
using absolute paths and env variables.

Signed-off-by: Austin Horstman <khaneliman12@gmail.com>
This commit is contained in:
Austin Horstman 2025-07-28 10:08:42 -05:00
parent 9ff467fbe7
commit 40af7ba06b
4 changed files with 59 additions and 0 deletions

View file

@ -343,6 +343,24 @@ in
in
mkIf cfg.enable (
lib.mkMerge [
{
warnings =
lib.optionals
(cfg.dotDir != homeDir && !lib.hasPrefix "/" cfg.dotDir && !lib.hasPrefix "$" cfg.dotDir)
[
''
Using relative paths in programs.zsh.dotDir is deprecated and will be removed in a future release.
Current dotDir: ${cfg.dotDir}
Consider using absolute paths or home-manager config options instead.
You can replace relative paths or environment variables with options like:
- config.home.homeDirectory (user's home directory)
- config.xdg.configHome (XDG config directory)
- config.xdg.dataHome (XDG data directory)
- config.xdg.cacheHome (XDG cache directory)
''
];
}
(mkIf (cfg.envExtra != "") {
home.file."${dotDirRel}/.zshenv".text = cfg.envExtra;
})

View file

@ -171,6 +171,21 @@ in
};
config = {
warnings =
lib.optionals (!lib.hasPrefix "/" cfg.history.path && !lib.hasInfix "$" cfg.history.path)
[
''
Using relative paths in programs.zsh.history.path is deprecated and will be removed in a future release.
Consider using absolute paths or home-manager config options instead.
You can replace relative paths or environment variables with options like:
- config.home.homeDirectory (user's home directory)
- config.xdg.configHome (XDG config directory)
- config.xdg.dataHome (XDG data directory)
- config.xdg.cacheHome (XDG cache directory)
Current history.path: ${cfg.history.path}
''
];
programs.zsh.initContent = lib.mkMerge [
(lib.mkOrder 910 ''
# History options should be set in .zshrc and after oh-my-zsh sourcing.

View file

@ -35,6 +35,19 @@ in
test.stubs.zsh = { };
test.asserts.warnings.expected = lib.optionals (case == "relative") [
''
Using relative paths in programs.zsh.dotDir is deprecated and will be removed in a future release.
Current dotDir: subdir/subdir2
Consider using absolute paths or home-manager config options instead.
You can replace relative paths or environment variables with options like:
- config.home.homeDirectory (user's home directory)
- config.xdg.configHome (XDG config directory)
- config.xdg.dataHome (XDG data directory)
- config.xdg.cacheHome (XDG cache directory)
''
];
nmt.script =
if case == "xdg-variable" then
''

View file

@ -47,6 +47,19 @@ in
test.stubs.zsh = { };
test.asserts.warnings.expected = lib.optionals (case == "relative") [
''
Using relative paths in programs.zsh.history.path is deprecated and will be removed in a future release.
Consider using absolute paths or home-manager config options instead.
You can replace relative paths or environment variables with options like:
- config.home.homeDirectory (user's home directory)
- config.xdg.configHome (XDG config directory)
- config.xdg.dataHome (XDG data directory)
- config.xdg.cacheHome (XDG cache directory)
Current history.path: some/subdir/.zsh_history
''
];
nmt.script =
if case == "xdg-variable" then
''