nix-community / home-manager

Manage a user environment using Nix [maintainer=@rycee]
https://nix-community.github.io/home-manager/
MIT License
6.92k stars 1.8k forks source link

bug: home manager zsh option "dotDir" is mangling zdotdir path and causing ".config/zsh" to be created in any directory the user is in #5100

Open sweetbbak opened 7 months ago

sweetbbak commented 7 months ago

Are you following the right branch?

Is there an existing issue for this?

Issue description

Im having the exact same issue as this issue here #219 and the suggested solution brings an even more annoying issue where ".config/zsh" is created in literally any directory relative to the current.

So for if example if the current working directory is /etc/nixos home-manager creates /etc/nixos/.config/zsh/... or if I am in ~/.config/home-manager and open a terminal, it creates ~/.config/home-manager/.config/zsh. So far the only other file it creates is the zsh history file.

Its very annoying. The problem is that I can literally only set programs.zsh.dotDir to ".config/zsh" and cant use "${config.xdg.configHome}"/zsh or even an absolute path like "/home/xxx/.config/zsh" because "$HOME" is prepended to dotDir and the .zshenv in the home directory (which sources a .zshenv in dotDir)

so it looks like this "$HOME/'.config/zsh'" (with ".config/zsh") and it looks like when using any absolute path like the xdg option: "$HOME//home/xxx/.config/zsh" So for some reason in certain cases $HOME isn't being evaluated and it creates the directory structure relative to whatever directory the user is in.

the solution I would guess is to allow the user to specify the full path and not prepend '$HOME' to the .zshenv file that is symlinked to home

Maintainer CC

No response

System information

❯ nix-shell -p nix-info --run "nix-info -m"
 - system: `"x86_64-linux"`
 - host os: `Linux 6.6.19, NixOS, 24.05 (Uakari), 24.05.20240303.b8697e5`
 - multi-user?: `yes`
 - sandbox: `yes`
 - version: `nix-env (Nix) 2.18.1`
 - channels(root): `"nixos, nixos-unstable"`
 - nixpkgs: `/nix/var/nix/profiles/per-user/root/channels/nixos`
stale[bot] commented 4 months ago

Thank you for your contribution! I marked this issue as stale due to inactivity. Please be considerate of people watching this issue and receiving notifications before commenting 'I have this issue too'. We welcome additional information that will help resolve this issue. Please read the relevant sections below before commenting.

If you are the original author of the issue

* If this is resolved, please consider closing it so that the maintainers know not to focus on this. * If this might still be an issue, but you are not interested in promoting its resolution, please consider closing it while encouraging others to take over and reopen an issue if they care enough. * If you know how to solve the issue, please consider submitting a Pull Request that addresses this issue.

If you are not the original author of the issue

* If you are also experiencing this issue, please add details of your situation to help with the debugging process. * If you know how to solve the issue, please consider submitting a Pull Request that addresses this issue.

Memorandum on closing issues

Don't be afraid to manually close an issue, even if it holds valuable information. Closed issues stay in the system for people to search, read, cross-reference, or even reopen – nothing is lost! Closing obsolete issues is an important way to help maintainers focus their time and effort.