mirror of
https://github.com/nix-community/home-manager.git
synced 2025-12-15 21:41:09 +01:00
zsh: env var assertion for dotdir
Needs to be known at build time. Ensure user doesn't accidentally use env var in `dotDir` Signed-off-by: Austin Horstman <khaneliman12@gmail.com>
This commit is contained in:
parent
40af7ba06b
commit
e52c6c3da3
3 changed files with 35 additions and 7 deletions
|
|
@ -344,9 +344,25 @@ in
|
|||
mkIf cfg.enable (
|
||||
lib.mkMerge [
|
||||
{
|
||||
assertions = [
|
||||
{
|
||||
assertion = !lib.hasInfix "$" cfg.dotDir;
|
||||
message = ''
|
||||
programs.zsh.dotDir cannot contain shell variables as it is used for file creation at build time.
|
||||
Current dotDir: ${cfg.dotDir}
|
||||
Consider using an absolute path or home-manager config options instead.
|
||||
You can replace shell 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)
|
||||
'';
|
||||
}
|
||||
];
|
||||
|
||||
warnings =
|
||||
lib.optionals
|
||||
(cfg.dotDir != homeDir && !lib.hasPrefix "/" cfg.dotDir && !lib.hasPrefix "$" cfg.dotDir)
|
||||
(cfg.dotDir != homeDir && !lib.hasPrefix "/" cfg.dotDir && !lib.hasInfix "$" cfg.dotDir)
|
||||
[
|
||||
''
|
||||
Using relative paths in programs.zsh.dotDir is deprecated and will be removed in a future release.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue