From 02333bc7d57fee9d1c86b17b4038ef54a034daca Mon Sep 17 00:00:00 2001 From: Tim Schumacher Date: Thu, 27 Feb 2025 22:59:37 +0100 Subject: [PATCH] linux/common-config: Split Rust toolchain and kernel-based conditions The ongoing RISC-V breakage may become version independent in the future, move it to the correct condition before updating it with the full list of supported architectures. While at it, simplify the remaining rustc-specific conditions into an `availableOn`. --- pkgs/os-specific/linux/kernel/common-config.nix | 5 ++++- pkgs/os-specific/linux/kernel/generic.nix | 6 +----- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/pkgs/os-specific/linux/kernel/common-config.nix b/pkgs/os-specific/linux/kernel/common-config.nix index 0f7606c79b53..4bbebf2cc3b4 100644 --- a/pkgs/os-specific/linux/kernel/common-config.nix +++ b/pkgs/os-specific/linux/kernel/common-config.nix @@ -43,7 +43,10 @@ let ); forceRust = features.rust or false; - kernelSupportsRust = lib.versionAtLeast version "6.7"; + kernelSupportsRust = lib.versionAtLeast version "6.7" + # Known to be broken: https://lore.kernel.org/lkml/31885EDD-EF6D-4EF1-94CA-276BA7A340B7@kernel.org/T/ + && !(stdenv.hostPlatform.isRiscV && stdenv.cc.isGNU); + # Currently only enabling Rust by default on kernel 6.12+, # which actually has features that use Rust that we want. diff --git a/pkgs/os-specific/linux/kernel/generic.nix b/pkgs/os-specific/linux/kernel/generic.nix index fe6b1b8f0f98..334e76efb60a 100644 --- a/pkgs/os-specific/linux/kernel/generic.nix +++ b/pkgs/os-specific/linux/kernel/generic.nix @@ -109,11 +109,7 @@ 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); + rustAvailable = lib.meta.availableOn stdenv.hostPlatform rustc; features = kernelFeatures; # Ensure we know of all extra patches, etc. };