Skip to content

Commit cda6f9e

Browse files
committed
xdg.userDirs: add a setSessionVariables option
It defaults to `true` to maintain the current behavior. This is conditionalized on 25.11, so in future `setSessionVariables` will default to `false`.
1 parent 4a4c60d commit cda6f9e

File tree

1 file changed

+17
-1
lines changed

1 file changed

+17
-1
lines changed

modules/misc/xdg-user-dirs.nix

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,22 @@ in
110110
};
111111

112112
createDirectories = lib.mkEnableOption "automatic creation of the XDG user directories";
113+
114+
setSessionVariables = mkOption {
115+
type = with types; bool;
116+
default = lib.versionOlder config.home.stateVersion "25.11";
117+
defaultText = literalExpression ''
118+
lib.versionOlder config.home.stateVersion "25.11"
119+
'';
120+
description = ''
121+
Whether to set the XDG user dir environment variables, like
122+
`XDG_DESKTOP_DIR`. The recommended way to get these values is via the
123+
`xdg-user-dir` command or by processing
124+
`$XDG_CONFIG_HOME/user-dirs.dirs` directly in your application.
125+
126+
This defaults to `true` for state version < 25.11 and `false` otherwise.
127+
'';
128+
};
113129
};
114130

115131
config =
@@ -139,7 +155,7 @@ in
139155

140156
home.packages = lib.mkIf (cfg.package != null) [ cfg.package ];
141157

142-
home.sessionVariables = directories;
158+
home.sessionVariables = lib.mkIf cfg.setSessionVariables directories;
143159

144160
home.activation.createXdgUserDirectories = lib.mkIf cfg.createDirectories (
145161
let

0 commit comments

Comments
 (0)