cuda-modules: fix sort predicate stability

Incorrect sorting predicate was found as part of
https://github.com/NixOS/nix/issues/12106 where `nix` was crashing on
the code like:

    $ nix eval --expr 'builtins.sort (a: b: true) [ 1 2 3 ]'
    ...
    Aborted (core dumped)

Note: the crash happens here because sorting predicate does not
implement `isLess` and triggers assertion failures for
`std::stable_sort` that backs `builtins.sort`.

THe change restore `isLess` semantic for `preferable`.
This commit is contained in:
Sergei Trofimovich 2024-12-26 15:46:57 +00:00 committed by SomeoneSerge
parent 8fa343c6b4
commit 9fd753ea84

View file

@ -81,7 +81,7 @@ let
redistArch = flags.getRedistArch hostPlatform.system;
preferable =
p1: p2: (isSupported p2 -> isSupported p1) && (strings.versionAtLeast p1.version p2.version);
p1: p2: (isSupported p2 -> isSupported p1) && (strings.versionOlder p2.version p1.version);
# All the supported packages we can build for our platform.
# perSystemReleases :: List Package