aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--doc/manual/src/command-ref/conf-file-prefix.md5
-rw-r--r--src/libutil/util.cc2
2 files changed, 4 insertions, 3 deletions
diff --git a/doc/manual/src/command-ref/conf-file-prefix.md b/doc/manual/src/command-ref/conf-file-prefix.md
index d660db502..44b7ba86d 100644
--- a/doc/manual/src/command-ref/conf-file-prefix.md
+++ b/doc/manual/src/command-ref/conf-file-prefix.md
@@ -16,8 +16,9 @@ By default Nix reads settings from the following places:
will be loaded in reverse order.
Otherwise it will look for `nix/nix.conf` files in `XDG_CONFIG_DIRS`
- and `XDG_CONFIG_HOME`. If these are unset, it will look in
- `$HOME/.config/nix/nix.conf`.
+ and `XDG_CONFIG_HOME`. If unset, `XDG_CONFIG_DIRS` defaults to
+ `/etc/xdg`, and `XDG_CONFIG_HOME` defaults to `$HOME/.config`
+ as per [XDG Base Directory Specification](https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html).
- If `NIX_CONFIG` is set, its contents is treated as the contents of
a configuration file.
diff --git a/src/libutil/util.cc b/src/libutil/util.cc
index 8ae3445c6..5468d1ed1 100644
--- a/src/libutil/util.cc
+++ b/src/libutil/util.cc
@@ -562,7 +562,7 @@ Path getConfigDir()
std::vector<Path> getConfigDirs()
{
Path configHome = getConfigDir();
- string configDirs = getEnv("XDG_CONFIG_DIRS").value_or("");
+ string configDirs = getEnv("XDG_CONFIG_DIRS").value_or("/etc/xdg");
std::vector<Path> result = tokenizeString<std::vector<string>>(configDirs, ":");
result.insert(result.begin(), configHome);
return result;