diff --git a/modules/targets/generic-linux.nix b/modules/targets/generic-linux.nix index b5a07d5fa..9dce9f5c8 100644 --- a/modules/targets/generic-linux.nix +++ b/modules/targets/generic-linux.nix @@ -99,7 +99,11 @@ in { "/usr/share/terminfo" # package default, all distros ]; in { - NIX_PATH = "$HOME/.nix-defexpr/channels\${NIX_PATH:+:}$NIX_PATH"; + NIX_PATH = if config.nix.enable + && (config.nix.settings.use-xdg-base-directories or false) then + "${config.xdg.stateHome}/nix/defexpr/channels\${NIX_PATH:+:}$NIX_PATH" + else + "$HOME/.nix-defexpr/channels\${NIX_PATH:+:}$NIX_PATH"; TERMINFO_DIRS = "${profileDirectory}/share/terminfo:$TERMINFO_DIRS\${TERMINFO_DIRS:+:}${distroTerminfoDirs}"; };