|
43 | 43 | ); |
44 | 44 |
|
45 | 45 | forceRust = features.rust or false; |
46 | | - kernelSupportsRust = lib.versionAtLeast version "6.7"; |
| 46 | + # Architecture support collected from HAVE_RUST Kconfig definitions and the following table: |
| 47 | + # https://web.git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/rust/arch-support.rst |
| 48 | + rustByDefault = ( |
| 49 | + lib.versionAtLeast version "6.12" |
| 50 | + && ( |
| 51 | + stdenv.hostPlatform.isx86_64 |
| 52 | + || stdenv.hostPlatform.isLoongArch64 |
| 53 | + || stdenv.hostPlatform.isAarch64 |
| 54 | + || (stdenv.hostPlatform.isRiscV64 && !stdenv.cc.isGNU) |
| 55 | + ) |
| 56 | + ); |
47 | 57 |
|
48 | | - # Currently only enabling Rust by default on kernel 6.12+, |
49 | | - # which actually has features that use Rust that we want. |
50 | | - defaultRust = lib.versionAtLeast version "6.12" && rustAvailable; |
51 | 58 | withRust = |
52 | | - assert lib.assertMsg (!(forceRust && !kernelSupportsRust)) '' |
53 | | - Kernels below 6.7 (the kernel being built is ${version}) don't support Rust. |
54 | | - ''; |
55 | | - (forceRust || defaultRust) && kernelSupportsRust; |
| 59 | + lib.warnIfNot (forceRust -> rustAvailable) |
| 60 | + "force-enabling Rust for Linux without an available rustc" |
| 61 | + lib.warnIfNot |
| 62 | + (forceRust -> rustByDefault) |
| 63 | + "force-enabling Rust for Linux on an unsupported kernel version, host platform or compiler" |
| 64 | + (forceRust || (rustAvailable && rustByDefault)); |
56 | 65 |
|
57 | 66 | options = { |
58 | 67 |
|
@@ -1054,7 +1063,7 @@ let |
1054 | 1063 | HIDRAW = yes; |
1055 | 1064 |
|
1056 | 1065 | # Enable loading HID fixups as eBPF from userspace |
1057 | | - HID_BPF = whenAtLeast "6.3" yes; |
| 1066 | + HID_BPF = whenAtLeast "6.3" (whenPlatformHasEBPFJit yes); |
1058 | 1067 |
|
1059 | 1068 | HID_ACRUX_FF = yes; |
1060 | 1069 | DRAGONRISE_FF = yes; |
@@ -1281,7 +1290,7 @@ let |
1281 | 1290 | LIRC = yes; |
1282 | 1291 |
|
1283 | 1292 | SCHED_CORE = whenAtLeast "5.14" yes; |
1284 | | - SCHED_CLASS_EXT = whenAtLeast "6.12" yes; |
| 1293 | + SCHED_CLASS_EXT = whenAtLeast "6.12" (whenPlatformHasEBPFJit yes); |
1285 | 1294 |
|
1286 | 1295 | LRU_GEN = whenAtLeast "6.1" yes; |
1287 | 1296 | LRU_GEN_ENABLED = whenAtLeast "6.1" yes; |
|
0 commit comments