From eaacd115fad1829a985790a67112e10b3c651416 Mon Sep 17 00:00:00 2001 From: Lan Tian Date: Sat, 9 May 2026 16:34:22 -0700 Subject: [PATCH] Remove the now unnecessary kernel module override --- README.md | 10 ---------- helpers.nix | 25 ------------------------- kernel-cachyos/packages.nix | 25 ++++++++++--------------- 3 files changed, 10 insertions(+), 50 deletions(-) diff --git a/README.md b/README.md index 1e52990..709d324 100644 --- a/README.md +++ b/README.md @@ -365,16 +365,6 @@ Additional arguments are passed through to `buildLinux` from nixpkgs. See [nixpk # Additional args are available. See kernel-cachyos/mkCachyKernel.nix }; - # For non-LTO kernels kernelPackages = pkgs.linuxKernel.packagesFor kernel; - - - # For LTO kernels, helpers.kernelModuleLLVMOverride fixes compilation for some - # out-of-tree modules in nixpkgs. - kernelPackagesWithLTOFix = let - # helpers.nix provides a few utilities for building kernel with LTO. - # I haven't figured out a clean way to expose it in flakes. - helpers = pkgs.callPackage "${inputs.nix-cachyos-kernel.outPath}/helpers.nix" {}; - in helpers.kernelModuleLLVMOverride (pkgs.linuxKernel.packagesFor kernel); } ``` diff --git a/helpers.nix b/helpers.nix index 6248017..049f522 100644 --- a/helpers.nix +++ b/helpers.nix @@ -55,29 +55,4 @@ rec { pkgs.patchelf ]; }); - - kernelModuleLLVMOverride = - kernelPackages_: - kernelPackages_.extend ( - _final: prev: - lib.mapAttrs ( - n: v: - if - builtins.elem "LLVM=1" kernelPackages_.kernel.commonMakeFlags - && !(builtins.elem n [ "kernel" ]) - && lib.isDerivation v - && ((v.overrideAttrs or null) != null) - then - v.overrideAttrs (old: { - makeFlags = (old.makeFlags or [ ]) ++ kernelPackages_.kernel.commonMakeFlags; - postPatch = (if (old.postPatch or null) == null then "" else old.postPatch) + '' - if [ -f Makefile ]; then - substituteInPlace Makefile --replace "gcc" "cc" - fi - ''; - }) - else - v - ) prev - ); } diff --git a/kernel-cachyos/packages.nix b/kernel-cachyos/packages.nix index 3e1905e..0a3c65b 100644 --- a/kernel-cachyos/packages.nix +++ b/kernel-cachyos/packages.nix @@ -6,26 +6,21 @@ ... }: let - helpers = callPackage ../helpers.nix { }; - inherit (helpers) kernelModuleLLVMOverride; - kernels = lib.filterAttrs (_: lib.isDerivation) (callPackage ./. { inherit inputs; }); in lib.mapAttrs' ( n: v: let - packages = kernelModuleLLVMOverride ( - (linuxKernel.packagesFor v).extend ( - final: prev: - let - variant = lib.removePrefix "linux-cachyos-" v.cachyosConfigVariant; - in - { - zfs_cachyos = final.callPackage ../zfs-cachyos { - inherit inputs variant; - }; - } - ) + packages = (linuxKernel.packagesFor v).extend ( + final: prev: + let + variant = lib.removePrefix "linux-cachyos-" v.cachyosConfigVariant; + in + { + zfs_cachyos = final.callPackage ../zfs-cachyos { + inherit inputs variant; + }; + } ); in lib.nameValuePair "linuxPackages-${lib.removePrefix "linux-" n}" packages