Skip to content

Commit

Permalink
wicked_kernel: add optimization flags & use clang
Browse files Browse the repository at this point in the history
  • Loading branch information
pongo1231 committed Jan 23, 2025
1 parent 23f6070 commit 8e52da0
Showing 1 changed file with 44 additions and 6 deletions.
50 changes: 44 additions & 6 deletions modules/wicked_kernel.nix
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@
nixpkgs.overlays = [
(final: prev: {
linuxPackages_wicked = final.kernel.linuxPackages_latest.extend (finalAttrs: prevAttrs: {
/*kernel = prevAttrs.kernel.override (prevAttrs': {
kernel = prevAttrs.kernel.override (prevAttrs': {
#kernelPatches = builtins.filter (x: !lib.hasPrefix "netfilter-typo-fix" x.name) prevAttrs'.kernelPatches;
ignoreConfigErrors = true;
argsOverride =
#ignoreConfigErrors = true;
/*argsOverride =
let
version = "6.13-rc7";
in
Expand All @@ -33,8 +33,8 @@
url = "https://git.kernel.org/torvalds/t/linux-${version}.tar.gz";
hash = "";
};*/
/*};
});*/
#};
});

xpadneo = prevAttrs.xpadneo.overrideAttrs (finalAttrs': prevAttrs': {
src = final.fetchFromGitHub {
Expand All @@ -58,7 +58,43 @@
];

boot = {
kernelPackages = pkgs.linuxPackages_wicked;
kernelPackages =
let
stdenvLLVM =
let
llvmPin = pkgs.buildPackages.llvmPackages.override {
bootBintools = null;
bootBintoolsNoLibc = null;
};

stdenv' = pkgs.overrideCC llvmPin.stdenv llvmPin.clangUseLLVM;
in
stdenv' // {
mkDerivation = args: stdenv'.mkDerivation (args // {
# INFO: This line may seem useless, since we already have lld coming
# from clangUseLLVM, but it isn't.
# The lld provided is wrapped "llvm-binutils-wrapper" and will _NOT_
# work. Adding lld here manually override that one, and works around the
# issue. The real solution here is to either:
# 1. Figure out a way to force the usage of the unwrapped bintools
# 2. Fix our lld wrapper
nativeBuildInputs = (args.nativeBuildInputs or [ ])
++ (with llvmPin; [ lld ]);
});
};

makeLTO = k:
k.override {
stdenv = stdenvLLVM;
extraMakeFlags = k.extraMakeFlags ++ [ "LLVM=1" "LLVM_IAS=1" ];
argsOverride.structuredExtraConfig =
with lib.kernel; k.structuredExtraConfig // {
LTO_NONE = no;
LTO_CLANG_FULL = yes;
};
};
in
makeLTO pkgs.linuxPackages_wicked.kernel;

kernelPatches =
let
Expand All @@ -75,6 +111,8 @@
patch = patch /linux/6.13/cachyos.patch;
extraConfig = ''
AMD_PRIVATE_COLOR y
X86_64_VERSION 3
CC_OPTIMIZE_FOR_PERFORMANCE_O3 y
'';
}
/*{
Expand Down

0 comments on commit 8e52da0

Please sign in to comment.