linux: implement rustAvailable condition
* It doesn't matter if `rustc` is available, but if rustc can compile to the hostPlatform. So use a custom condition instead of `availableOn`. * Explicitly exclude the combination of GCC and riscv which is known to be broken[1]. [1] https://lore.kernel.org/lkml/31885EDD-EF6D-4EF1-94CA-276BA7A340B7@kernel.org/T/ Co-authored-by: Alyssa Ross <hi@alyssa.is>
This commit is contained in:
committed by
Alyssa Ross
co-authored by
Alyssa Ross
parent
bda6c82a81
commit
d3e6c8fc75
@@ -11,6 +11,7 @@
|
||||
|
||||
# Configuration
|
||||
{ lib, stdenv, version
|
||||
, rustAvailable
|
||||
|
||||
, features ? {}
|
||||
}:
|
||||
@@ -34,7 +35,7 @@ let
|
||||
|
||||
# Currently only enabling Rust by default on kernel 6.12+,
|
||||
# which actually has features that use Rust that we want.
|
||||
defaultRust = lib.versionAtLeast version "6.12" && (stdenv.hostPlatform.isx86_64 || stdenv.hostPlatform.isAarch64);
|
||||
defaultRust = lib.versionAtLeast version "6.12" && rustAvailable;
|
||||
withRust = (forceRust || defaultRust) && kernelSupportsRust;
|
||||
|
||||
options = {
|
||||
|
||||
@@ -108,6 +108,11 @@ let
|
||||
|
||||
commonStructuredConfig = import ./common-config.nix {
|
||||
inherit lib stdenv version;
|
||||
rustAvailable =
|
||||
lib.any (lib.meta.platformMatch stdenv.hostPlatform) rustc.targetPlatforms
|
||||
&& lib.all (p: !lib.meta.platformMatch stdenv.hostPlatform p) rustc.badTargetPlatforms
|
||||
# Known to be broken: https://lore.kernel.org/lkml/31885EDD-EF6D-4EF1-94CA-276BA7A340B7@kernel.org/T/
|
||||
&& !(stdenv.hostPlatform.isRiscV && stdenv.cc.isGNU);
|
||||
|
||||
features = kernelFeatures; # Ensure we know of all extra patches, etc.
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user