Unverified Commit 0e347b1a authored by Naïm Favier's avatar Naïm Favier
Browse files

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)
parent 0da20e2b
Loading
Loading
Loading
Loading
+4 −6
Original line number Diff line number Diff line
@@ -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