diff --git a/pkgs/os-specific/linux/kernel/common-config.nix b/pkgs/os-specific/linux/kernel/common-config.nix index e7c212cb6e6fe..e3ae987f43b42 100644 --- a/pkgs/os-specific/linux/kernel/common-config.nix +++ b/pkgs/os-specific/linux/kernel/common-config.nix @@ -11,6 +11,7 @@ # Configuration { lib, stdenv, version +, rustAvailable , features ? {} }: @@ -33,10 +34,8 @@ let kernelSupportsRust = lib.versionAtLeast version "6.7"; # Currently only enabling Rust by default on kernel 6.12+, - # which actually has features that use Rust that we want, - # and only on x86_64, because of a nixpkgs rustc issue: - # https://github.com/NixOS/nixpkgs/pull/315121#issuecomment-2135805876 - defaultRust = lib.versionAtLeast version "6.12" && stdenv.hostPlatform.isx86_64; + # which actually has features that use Rust that we want. + defaultRust = lib.versionAtLeast version "6.12" && rustAvailable; withRust = (forceRust || defaultRust) && kernelSupportsRust; options = { @@ -641,7 +640,10 @@ let NFS_V4_1 = yes; # NFSv4.1 client support NFS_V4_2 = yes; NFS_V4_SECURITY_LABEL = yes; - NFS_LOCALIO = whenAtLeast "6.12" yes; + + # Fails with + # `fs/nfs/localio.o: relocation R_AARCH64_ADR_PREL_PG_HI21 against symbol `nfs_to' which may bind externally can not be used when making a shared object; recompile with -fPIC` + NFS_LOCALIO = lib.mkIf (!stdenv.hostPlatform.isAarch64) (whenAtLeast "6.12" yes); CIFS_XATTR = yes; CIFS_POSIX = option yes; diff --git a/pkgs/os-specific/linux/kernel/generic.nix b/pkgs/os-specific/linux/kernel/generic.nix index fdfc782352266..49c9594f8f7f0 100644 --- a/pkgs/os-specific/linux/kernel/generic.nix +++ b/pkgs/os-specific/linux/kernel/generic.nix @@ -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. };