From b0ae5a671eb0d14a288fde12137fc70a823397be Mon Sep 17 00:00:00 2001 From: gedanziger Date: Tue, 7 Apr 2026 16:10:01 -0700 Subject: [PATCH] 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. --- .../modules/services/display-managers/gdm.nix | 27 ++++++++++++++----- 1 file changed, 20 insertions(+), 7 deletions(-) diff --git a/nixos/modules/services/display-managers/gdm.nix b/nixos/modules/services/display-managers/gdm.nix index 9fc92e91018c..62b90efa92b9 100644 --- a/nixos/modules/services/display-managers/gdm.nix +++ b/nixos/modules/services/display-managers/gdm.nix @@ -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