From 0e347b1a77a08ef429ea2bdf878eab6af99f90dc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Na=C3=AFm=20Favier?= Date: Thu, 28 Mar 2024 18:22:25 +0100 Subject: [PATCH] nixos/xserver: respect module order Reimplement the `ModulePath` generation logic by only adding the `/lib/xorg/modules` subpath for each module, in the specified order. In particular, hardware-specific drivers are listed *before* `xorgserver`, which fixes https://github.com/NixOS/nixpkgs/issues/299684. This also keeps the list reproducible, as wanted by https://github.com/NixOS/nixpkgs/pull/230186. I have confirmed that X is able to find `.so` files recursively within the `ModulePath`, so that there is no need to include subdirectories of `/lib/xorg/modules`. Furthermore, I don't expect there to be a need to include directories *outside* of `/lib/xorg/modules`, as the default `ModulePath` on standard distributions is `/usr/lib/xorg/modules`. (see https://www.x.org/releases/current/doc/man/man5/xorg.conf.5.xhtml#heading4) --- nixos/modules/services/x11/xserver.nix | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/nixos/modules/services/x11/xserver.nix b/nixos/modules/services/x11/xserver.nix index 453f414e2a86..c5b168e608a4 100644 --- a/nixos/modules/services/x11/xserver.nix +++ b/nixos/modules/services/x11/xserver.nix @@ -111,7 +111,7 @@ let } '' echo 'Section "Files"' >> $out - echo $fontpath >> $out + echo "$fontpath" >> $out for i in ${toString fontsForXServer}; do if test "''${i:0:''${#NIX_STORE}}" == "$NIX_STORE"; then @@ -121,11 +121,9 @@ let fi done - for i in $(find ${toString cfg.modules} -type d | sort); do - if test $(echo $i/*.so* | wc -w) -ne 0; then - echo " ModulePath \"$i\"" >> $out - fi - done + ${concatMapStrings (m: '' + echo " ModulePath \"${m}/lib/xorg/modules\"" >> "$out" + '') cfg.modules} echo '${cfg.filesSection}' >> $out echo 'EndSection' >> $out