mirror of
https://github.com/NixOS/nix
synced 2025-06-27 00:11:17 +02:00
config: use all of XDG_CONFIG_DIRS
Previously, config would only be read from XDG_CONFIG_HOME. This change allows reading config from additional directories, which enables e.g. per-project binary caches or chroot stores with the help of direnv.
This commit is contained in:
parent
7a9ac91a43
commit
f3b8173a93
3 changed files with 17 additions and 1 deletions
|
@ -496,6 +496,15 @@ Path getConfigDir()
|
|||
return configDir;
|
||||
}
|
||||
|
||||
std::vector<Path> getConfigDirs()
|
||||
{
|
||||
Path configHome = getConfigDir();
|
||||
string configDirs = getEnv("XDG_CONFIG_DIRS");
|
||||
std::vector<Path> result = tokenizeString<std::vector<string>>(configDirs, ":");
|
||||
result.insert(result.begin(), configHome);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
Path getDataDir()
|
||||
{
|
||||
|
|
|
@ -131,6 +131,9 @@ Path getCacheDir();
|
|||
/* Return $XDG_CONFIG_HOME or $HOME/.config. */
|
||||
Path getConfigDir();
|
||||
|
||||
/* Return the directories to search for user configuration files */
|
||||
std::vector<Path> getConfigDirs();
|
||||
|
||||
/* Return $XDG_DATA_HOME or $HOME/.local/share. */
|
||||
Path getDataDir();
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue