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)
This commit is contained in:
Naïm Favier 2024-03-28 18:22:25 +01:00
parent 0da20e2b84
commit 0e347b1a77
No known key found for this signature in database
GPG Key ID: 95AFCE8211908325

View File

@ -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