mirror of
https://github.com/xddxdd/nix-cachyos-kernel.git
synced 2026-07-03 19:18:07 +02:00
Merge pull request #16 from sempiternal-aurora/master
Allow FullLTO as a choice
This commit is contained in:
commit
a3aa71a8eb
@ -16,25 +16,23 @@ builtins.listToAttrs (
|
|||||||
pname = "linux-cachyos-latest";
|
pname = "linux-cachyos-latest";
|
||||||
inherit (linux_latest) version src;
|
inherit (linux_latest) version src;
|
||||||
configVariant = "linux-cachyos";
|
configVariant = "linux-cachyos";
|
||||||
lto = false;
|
|
||||||
})
|
})
|
||||||
(mkCachyKernel {
|
(mkCachyKernel {
|
||||||
pname = "linux-cachyos-latest-lto";
|
pname = "linux-cachyos-latest-lto";
|
||||||
inherit (linux_latest) version src;
|
inherit (linux_latest) version src;
|
||||||
configVariant = "linux-cachyos";
|
configVariant = "linux-cachyos";
|
||||||
lto = true;
|
lto = "thin";
|
||||||
})
|
})
|
||||||
(mkCachyKernel {
|
(mkCachyKernel {
|
||||||
pname = "linux-cachyos-lts";
|
pname = "linux-cachyos-lts";
|
||||||
inherit (linux) version src;
|
inherit (linux) version src;
|
||||||
configVariant = "linux-cachyos-lts";
|
configVariant = "linux-cachyos-lts";
|
||||||
lto = false;
|
|
||||||
})
|
})
|
||||||
(mkCachyKernel {
|
(mkCachyKernel {
|
||||||
pname = "linux-cachyos-lts-lto";
|
pname = "linux-cachyos-lts-lto";
|
||||||
inherit (linux) version src;
|
inherit (linux) version src;
|
||||||
configVariant = "linux-cachyos-lts";
|
configVariant = "linux-cachyos-lts";
|
||||||
lto = true;
|
lto = "thin";
|
||||||
})
|
})
|
||||||
|
|
||||||
# Additional CachyOS provided variants
|
# Additional CachyOS provided variants
|
||||||
@ -42,81 +40,75 @@ builtins.listToAttrs (
|
|||||||
pname = "linux-cachyos-bmq";
|
pname = "linux-cachyos-bmq";
|
||||||
inherit (linux_latest) version src;
|
inherit (linux_latest) version src;
|
||||||
configVariant = "linux-cachyos-bmq";
|
configVariant = "linux-cachyos-bmq";
|
||||||
lto = false;
|
|
||||||
cpusched = "bmq";
|
cpusched = "bmq";
|
||||||
})
|
})
|
||||||
(mkCachyKernel {
|
(mkCachyKernel {
|
||||||
pname = "linux-cachyos-bmq-lto";
|
pname = "linux-cachyos-bmq-lto";
|
||||||
inherit (linux_latest) version src;
|
inherit (linux_latest) version src;
|
||||||
configVariant = "linux-cachyos-bmq";
|
configVariant = "linux-cachyos-bmq";
|
||||||
lto = true;
|
lto = "thin";
|
||||||
cpusched = "bmq";
|
cpusched = "bmq";
|
||||||
})
|
})
|
||||||
(mkCachyKernel {
|
(mkCachyKernel {
|
||||||
pname = "linux-cachyos-bore";
|
pname = "linux-cachyos-bore";
|
||||||
inherit (linux_latest) version src;
|
inherit (linux_latest) version src;
|
||||||
configVariant = "linux-cachyos-bore";
|
configVariant = "linux-cachyos-bore";
|
||||||
lto = false;
|
|
||||||
cpusched = "bore";
|
cpusched = "bore";
|
||||||
})
|
})
|
||||||
(mkCachyKernel {
|
(mkCachyKernel {
|
||||||
pname = "linux-cachyos-bore-lto";
|
pname = "linux-cachyos-bore-lto";
|
||||||
inherit (linux_latest) version src;
|
inherit (linux_latest) version src;
|
||||||
configVariant = "linux-cachyos-bore";
|
configVariant = "linux-cachyos-bore";
|
||||||
lto = true;
|
lto = "thin";
|
||||||
cpusched = "bore";
|
cpusched = "bore";
|
||||||
})
|
})
|
||||||
(mkCachyKernel {
|
(mkCachyKernel {
|
||||||
pname = "linux-cachyos-deckify";
|
pname = "linux-cachyos-deckify";
|
||||||
inherit (linux_latest) version src;
|
inherit (linux_latest) version src;
|
||||||
configVariant = "linux-cachyos-deckify";
|
configVariant = "linux-cachyos-deckify";
|
||||||
lto = false;
|
|
||||||
})
|
})
|
||||||
(mkCachyKernel {
|
(mkCachyKernel {
|
||||||
pname = "linux-cachyos-deckify-lto";
|
pname = "linux-cachyos-deckify-lto";
|
||||||
inherit (linux_latest) version src;
|
inherit (linux_latest) version src;
|
||||||
configVariant = "linux-cachyos-deckify";
|
configVariant = "linux-cachyos-deckify";
|
||||||
lto = true;
|
lto = "thin";
|
||||||
})
|
})
|
||||||
(mkCachyKernel {
|
(mkCachyKernel {
|
||||||
pname = "linux-cachyos-eevdf";
|
pname = "linux-cachyos-eevdf";
|
||||||
inherit (linux_latest) version src;
|
inherit (linux_latest) version src;
|
||||||
configVariant = "linux-cachyos-eevdf";
|
configVariant = "linux-cachyos-eevdf";
|
||||||
cpusched = "eevdf";
|
cpusched = "eevdf";
|
||||||
lto = false;
|
|
||||||
})
|
})
|
||||||
(mkCachyKernel {
|
(mkCachyKernel {
|
||||||
pname = "linux-cachyos-eevdf-lto";
|
pname = "linux-cachyos-eevdf-lto";
|
||||||
inherit (linux_latest) version src;
|
inherit (linux_latest) version src;
|
||||||
configVariant = "linux-cachyos-eevdf";
|
configVariant = "linux-cachyos-eevdf";
|
||||||
cpusched = "eevdf";
|
cpusched = "eevdf";
|
||||||
lto = true;
|
lto = "thin";
|
||||||
})
|
})
|
||||||
(mkCachyKernel {
|
(mkCachyKernel {
|
||||||
pname = "linux-cachyos-hardened";
|
pname = "linux-cachyos-hardened";
|
||||||
inherit (linux_latest) version src;
|
inherit (linux_latest) version src;
|
||||||
configVariant = "linux-cachyos-hardened";
|
configVariant = "linux-cachyos-hardened";
|
||||||
hardened = true;
|
hardened = true;
|
||||||
lto = false;
|
|
||||||
})
|
})
|
||||||
(mkCachyKernel {
|
(mkCachyKernel {
|
||||||
pname = "linux-cachyos-hardened-lto";
|
pname = "linux-cachyos-hardened-lto";
|
||||||
inherit (linux_latest) version src;
|
inherit (linux_latest) version src;
|
||||||
configVariant = "linux-cachyos-hardened";
|
configVariant = "linux-cachyos-hardened";
|
||||||
hardened = true;
|
hardened = true;
|
||||||
lto = true;
|
lto = "thin";
|
||||||
})
|
})
|
||||||
(mkCachyKernel {
|
(mkCachyKernel {
|
||||||
pname = "linux-cachyos-rc";
|
pname = "linux-cachyos-rc";
|
||||||
inherit (linux_testing) version src;
|
inherit (linux_testing) version src;
|
||||||
configVariant = "linux-cachyos-rc";
|
configVariant = "linux-cachyos-rc";
|
||||||
lto = false;
|
|
||||||
})
|
})
|
||||||
(mkCachyKernel {
|
(mkCachyKernel {
|
||||||
pname = "linux-cachyos-rc-lto";
|
pname = "linux-cachyos-rc-lto";
|
||||||
inherit (linux_testing) version src;
|
inherit (linux_testing) version src;
|
||||||
configVariant = "linux-cachyos-rc";
|
configVariant = "linux-cachyos-rc";
|
||||||
lto = true;
|
lto = "thin";
|
||||||
})
|
})
|
||||||
(mkCachyKernel {
|
(mkCachyKernel {
|
||||||
pname = "linux-cachyos-rt-bore";
|
pname = "linux-cachyos-rt-bore";
|
||||||
@ -124,7 +116,6 @@ builtins.listToAttrs (
|
|||||||
configVariant = "linux-cachyos-rt-bore";
|
configVariant = "linux-cachyos-rt-bore";
|
||||||
rt = true;
|
rt = true;
|
||||||
cpusched = "bore";
|
cpusched = "bore";
|
||||||
lto = false;
|
|
||||||
})
|
})
|
||||||
(mkCachyKernel {
|
(mkCachyKernel {
|
||||||
pname = "linux-cachyos-rt-bore-lto";
|
pname = "linux-cachyos-rt-bore-lto";
|
||||||
@ -132,7 +123,7 @@ builtins.listToAttrs (
|
|||||||
configVariant = "linux-cachyos-rt-bore";
|
configVariant = "linux-cachyos-rt-bore";
|
||||||
rt = true;
|
rt = true;
|
||||||
cpusched = "bore";
|
cpusched = "bore";
|
||||||
lto = true;
|
lto = "thin";
|
||||||
})
|
})
|
||||||
(mkCachyKernel {
|
(mkCachyKernel {
|
||||||
pname = "linux-cachyos-server";
|
pname = "linux-cachyos-server";
|
||||||
@ -141,7 +132,6 @@ builtins.listToAttrs (
|
|||||||
cpusched = "eevdf";
|
cpusched = "eevdf";
|
||||||
hzTicks = "300";
|
hzTicks = "300";
|
||||||
preemptType = "none";
|
preemptType = "none";
|
||||||
lto = false;
|
|
||||||
})
|
})
|
||||||
(mkCachyKernel {
|
(mkCachyKernel {
|
||||||
pname = "linux-cachyos-server-lto";
|
pname = "linux-cachyos-server-lto";
|
||||||
@ -150,7 +140,7 @@ builtins.listToAttrs (
|
|||||||
cpusched = "eevdf";
|
cpusched = "eevdf";
|
||||||
hzTicks = "300";
|
hzTicks = "300";
|
||||||
preemptType = "none";
|
preemptType = "none";
|
||||||
lto = true;
|
lto = "thin";
|
||||||
})
|
})
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
|
|||||||
@ -17,8 +17,9 @@ lib.makeOverridable (
|
|||||||
# See https://github.com/CachyOS/linux-cachyos for available values.
|
# See https://github.com/CachyOS/linux-cachyos for available values.
|
||||||
configVariant,
|
configVariant,
|
||||||
|
|
||||||
# Set to true to enable Clang+ThinLTO.
|
# Set to one of "none", "thin" or "full", anything other than "none" uses Clang
|
||||||
lto,
|
# to build the kernel with the selected LTO option
|
||||||
|
lto ? "none",
|
||||||
|
|
||||||
# Patches to be applied in patchedSrc phase. This is different from buildLinux's kernelPatches.
|
# Patches to be applied in patchedSrc phase. This is different from buildLinux's kernelPatches.
|
||||||
prePatch ? "",
|
prePatch ? "",
|
||||||
@ -53,6 +54,11 @@ lib.makeOverridable (
|
|||||||
# Additional args are passed to buildLinux.
|
# Additional args are passed to buildLinux.
|
||||||
...
|
...
|
||||||
}@args:
|
}@args:
|
||||||
|
assert lib.assertOneOf "LTO Valid Options" lto [
|
||||||
|
"none"
|
||||||
|
"thin"
|
||||||
|
"full"
|
||||||
|
];
|
||||||
let
|
let
|
||||||
helpers = callPackage ../helpers.nix { };
|
helpers = callPackage ../helpers.nix { };
|
||||||
inherit (helpers) stdenvLLVM ltoMakeflags;
|
inherit (helpers) stdenvLLVM ltoMakeflags;
|
||||||
@ -95,7 +101,7 @@ lib.makeOverridable (
|
|||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
defaultLocalVersion = if lto then "-cachyos-lto" else "-cachyos";
|
defaultLocalVersion = if lto == "none" then "-cachyos" else "-cachyos-lto";
|
||||||
|
|
||||||
cachySettings = callPackage ./cachySettings.nix { };
|
cachySettings = callPackage ./cachySettings.nix { };
|
||||||
structuredExtraConfig =
|
structuredExtraConfig =
|
||||||
@ -112,10 +118,10 @@ lib.makeOverridable (
|
|||||||
OVERLAY_FS_XINO_AUTO = no;
|
OVERLAY_FS_XINO_AUTO = no;
|
||||||
OVERLAY_FS_METACOPY = no;
|
OVERLAY_FS_METACOPY = no;
|
||||||
OVERLAY_FS_DEBUG = no;
|
OVERLAY_FS_DEBUG = no;
|
||||||
})
|
|
||||||
// (lib.optionalAttrs lto {
|
LTO_NONE = if lto == "none" then lib.kernel.yes else lib.kernel.no;
|
||||||
LTO_NONE = lib.kernel.no;
|
LTO_CLANG_THIN = if lto == "thin" then lib.kernel.yes else lib.kernel.no;
|
||||||
LTO_CLANG_THIN = lib.kernel.yes;
|
LTO_CLANG_FULL = if lto == "full" then lib.kernel.yes else lib.kernel.no;
|
||||||
})
|
})
|
||||||
|
|
||||||
# Apply CachyOS specific settings
|
# Apply CachyOS specific settings
|
||||||
@ -149,9 +155,9 @@ lib.makeOverridable (
|
|||||||
// {
|
// {
|
||||||
inherit pname version;
|
inherit pname version;
|
||||||
src = patchedSrc;
|
src = patchedSrc;
|
||||||
stdenv = args.stdenv or (if lto then stdenvLLVM else stdenv);
|
stdenv = args.stdenv or (if lto == "none" then stdenv else stdenvLLVM);
|
||||||
|
|
||||||
extraMakeFlags = (lib.optionals lto ltoMakeflags) ++ (args.extraMakeFlags or [ ]);
|
extraMakeFlags = (lib.optionals (lto != "none") ltoMakeflags) ++ (args.extraMakeFlags or [ ]);
|
||||||
|
|
||||||
defconfig = args.defconfig or "cachyos_defconfig";
|
defconfig = args.defconfig or "cachyos_defconfig";
|
||||||
|
|
||||||
@ -163,7 +169,10 @@ lib.makeOverridable (
|
|||||||
inherit structuredExtraConfig autoModules;
|
inherit structuredExtraConfig autoModules;
|
||||||
|
|
||||||
extraMeta = {
|
extraMeta = {
|
||||||
description = "Linux CachyOS Kernel" + lib.optionalString lto " with Clang+ThinLTO";
|
description =
|
||||||
|
"Linux CachyOS Kernel"
|
||||||
|
+ lib.optionalString (lto == "thin") " with Clang+ThinLTO"
|
||||||
|
+ lib.optionalString (lto == "full") " with Clang+FullLTO";
|
||||||
broken = !stdenv.isx86_64;
|
broken = !stdenv.isx86_64;
|
||||||
}
|
}
|
||||||
// (args.extraMeta or { });
|
// (args.extraMeta or { });
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user