diff --git a/doc/release-notes/rl-2009.adoc b/doc/release-notes/rl-2009.adoc index 96dfce930..0562e046d 100644 --- a/doc/release-notes/rl-2009.adoc +++ b/doc/release-notes/rl-2009.adoc @@ -18,4 +18,28 @@ The state version in this release includes the changes below. These changes are only active if the `home.stateVersion` option is set to "20.09" or later. -* Nothing has happened. +* The options <> and <> no +longer have default values and must therefore be provided in your +configuration. Previously their values would default to the content of +the environment variables `HOME` and `USER`, respectively. ++ +-- +Further, the options <>, <>, +and <> will no longer be affected by the +`XDG_CACHE_HOME`, `XDG_CONFIG_HOME`, and `XDG_DATA_HOME` environment +variables. They now unconditionally default to + +- `"${config.home.homeDirectory}/.cache"`, +- `"${config.home.homeDirectory}/.config"`, and +- `"${config.home.homeDirectory}/.local/share"`. + +If you choose to switch to state version 20.09 then you must set these +options if you use non-default XDG base directory paths. + +The initial configuration generated by + +[source,console] +$ nix-shell '' -A install + +will automatically include these options, when necessary. +-- diff --git a/home-manager/install.nix b/home-manager/install.nix index 92de17bd6..87252730e 100644 --- a/home-manager/install.nix +++ b/home-manager/install.nix @@ -12,6 +12,18 @@ runCommand "home-manager-install" { echo echo "Creating initial Home Manager configuration..." + nl=$'\n' + xdgVars="" + if [[ -v XDG_CACHE_HOME && $XDG_CACHE_HOME != "$HOME/.cache" ]]; then + xdgVars="$xdgVars xdg.cacheHome = \"$XDG_CACHE_HOME\";$nl" + fi + if [[ -v XDG_CONFIG_HOME && $XDG_CONFIG_HOME != "$HOME/.config" ]]; then + xdgVars="$xdgVars xdg.configHome = \"$XDG_CONFIG_HOME\";$nl" + fi + if [[ -v XDG_DATA_HOME && $XDG_DATA_HOME != "$HOME/.local/share" ]]; then + xdgVars="$xdgVars xdg.dataHome = \"$XDG_DATA_HOME\";$nl" + fi + mkdir -p "$(dirname "$confFile")" cat > $confFile <