nixos/gdm: add extraPackages to extend XDG_DATA_DIRS

This value is currently hard to extend/modify as it is an
environment variable. This makes it easier to change.
This commit is contained in:
gedanziger
2026-04-07 17:11:42 -07:00
committed by gdanziger
parent 1d9f3aa960
commit b0ae5a671e
@@ -169,6 +169,16 @@ in
'';
};
extraPackages = lib.mkOption {
type = lib.types.listOf lib.types.package;
default = [ ];
example = lib.literalExpression "[ pkgs.gnome-themes-extra ]";
description = ''
Additional packages to add to XDG_DATA_DIRS for GDM.
The `/share` directory of each package will be added to the data path.
'';
};
};
};
@@ -221,13 +231,16 @@ in
enable = true;
environment = {
GDM_X_SERVER_EXTRA_ARGS = toString (lib.filter (arg: arg != "-terminate") xdmcfg.xserverArgs);
XDG_DATA_DIRS = lib.makeSearchPath "share" [
gdm # for gnome-login.session
config.services.displayManager.sessionData.desktops
pkgs.gnome-control-center # for accessibility icon
pkgs.adwaita-icon-theme
pkgs.hicolor-icon-theme # empty icon theme as a base
];
XDG_DATA_DIRS = lib.makeSearchPath "share" (
[
gdm # for gnome-login.session
config.services.displayManager.sessionData.desktops
pkgs.gnome-control-center # for accessibility icon
pkgs.adwaita-icon-theme
pkgs.hicolor-icon-theme # empty icon theme as a base
]
++ cfg.extraPackages
);
}
// lib.optionalAttrs (xSessionWrapper != null) {
# Make GDM use this wrapper before running the session, which runs the