This commit is contained in:
mjallen18
2026-01-02 11:55:52 -06:00
parent 1d5b1cf5e0
commit 0f42ffeebd
26 changed files with 69693 additions and 145 deletions

View File

@@ -15,16 +15,23 @@ let
inherit (stdenv) isx86_64 isAarch64 isLinux;
inherit (lib.trivial) importJSON;
# CachyOS repeating stuff.
arch = (if isx86_64 then "x86_64" else "aarch64");
# ######################################################
# Source Versions #
# ######################################################
mainVersions = importJSON ./versions.json;
ltsVersions = importJSON ./versions-lts.json;
rcVersions = importJSON ./versions-rc.json;
hardenedVersions = importJSON ./versions-hardened.json;
# ######################################################
# Base LTO Config #
# ######################################################
ltoKernelAttrs = {
taste = "linux-cachyos";
pname = "cachyos-lto";
configPath = ./config-nix/cachyos-lto.x86_64-linux.nix;
configPath = ./config-nix/${arch}-linux/cachyos-lto.${arch}-linux.nix;
# Pass the unified arguments (including the resolved 'self') to llvm-pkgs
inherit (import ./lib/llvm-pkgs.nix (args // { inherit self; })) callPackage;
@@ -67,10 +74,10 @@ let
useLTO = "full";
};
serverLtoKernelAttrs = {
serverLtoKernelAttrs = ltoKernelAttrs // {
taste = "linux-cachyos-server";
pname = "cachyos-server-lto";
configPath = ./config-nix/cachyos-server-lto.x86_64-linux.nix;
configPath = ./config-nix/${arch}-linux/cachyos-server-lto.${arch}-linux.nix;
basicCachy = false;
cpuSched = "eevdf";
ticksHz = 300;
@@ -80,43 +87,12 @@ let
withDAMON = true;
withNTSync = false;
withHDR = false;
# Pass the unified arguments (including the resolved 'self') to llvm-pkgs
inherit (import ./lib/llvm-pkgs.nix (args // { inherit self; })) callPackage;
useLTO = "thin";
packagesExtend = import ./lib/llvm-module-overlay.nix args;
zfsOverride = {
inherit (pkgs)
autoreconfHook269
util-linux
coreutils
perl
udevCheckHook
zlib
libuuid
python3
attr
openssl
libtirpc
nfs-utils
gawk
gnugrep
gnused
systemd
smartmontools
sysstat
pkg-config
curl
pam
nix-update-script
;
};
description = "Linux EEVDF-BORE scheduler Kernel by CachyOS built with LLVM and Thin LTO";
};
# ######################################################
# Misc Utils #
# ######################################################
# Evaluation hack
brokenReplacement = pkgs.hello.overrideAttrs (prevAttrs: {
meta = prevAttrs.meta // {
@@ -148,29 +124,23 @@ let
// attrs
);
gccKernel = mkCachyKernel {
# ######################################################
# Base GCC Config #
# ######################################################
gccKernelAttrs = {
taste = "linux-cachyos";
pname = "cachyos-gcc";
configPath = ( if isx86_64 then ./config-nix/cachyos-gcc.x86_64-linux.nix else ./config-nix/cachyos-gcc.aarch64-linux.nix);
configPath = ./config-nix/${arch}-linux/cachyos-gcc.${arch}-linux.nix;
# since all flavors use the same versions.json, we just need the updateScript in one of them
withUpdateScript = "stable";
};
in
{
inherit
mainVersions
rcVersions
hardenedVersions
mkCachyKernel
;
cachyos-gcc = gccKernel;
cachyos-lts = mkCachyKernel {
taste = "linux-cachyos-lts";
pname = "cachyos-lts";
configPath = ./config-nix/cachyos-lts.x86_64-linux.nix;
# ######################################################
# Base LTS Config #
# ######################################################
ltsAttrs = {
versions = ltsVersions;
withUpdateScript = "lts";
@@ -180,11 +150,11 @@ in
prev // { recurseForDerivations = false; };
};
cachyos-rc = mkCachyKernel {
taste = "linux-cachyos-rc";
pname = "cachyos-rc";
configPath = ./config-nix/cachyos-rc.x86_64-linux.nix;
# ######################################################
# Base RC Config #
# ######################################################
rcAttrs = {
versions = rcVersions;
withUpdateScript = "rc";
@@ -193,57 +163,12 @@ in
_kernel: _final: prev:
prev // { recurseForDerivations = false; };
};
cachyos-lto = mkCachyKernel ltoKernelAttrs;
cachyos-lto-full = mkCachyKernel ltoFullKernelAttrs;
cachyos-lto-znver4 = mkCachyKernel (
ltoKernelAttrs
// {
pname = "cachyos-lto-znver4";
configPath = ./config-nix/cachyos-znver4.x86_64-linux.nix;
}
);
# ######################################################
# Base Server Config #
# ######################################################
cachyos-rc-lto = mkCachyKernel (
ltoKernelAttrs
// {
taste = "linux-cachyos-rc";
pname = "cachyos-rc-lto";
configPath = ./config-nix/cachyos-rc-lto.x86_64-linux.nix;
versions = rcVersions;
withUpdateScript = "rc";
# Prevent building kernel modules for rc kernel
packagesExtend =
_kernel: _final: prev:
prev // { recurseForDerivations = false; };
}
);
cachyos-rc-lto-znver4 = mkCachyKernel (
ltoKernelAttrs
// {
taste = "linux-cachyos-rc";
pname = "cachyos-rc-lto-znver4";
configPath = ./config-nix/cachyos-rc-znver4.x86_64-linux.nix;
versions = rcVersions;
withUpdateScript = "rc";
# Prevent building kernel modules for rc kernel
packagesExtend =
_kernel: _final: prev:
prev // { recurseForDerivations = false; };
}
);
cachyos-sched-ext = throw "\"sched-ext\" patches were merged with \"cachyos\" flavor.";
cachyos-server = mkCachyKernel {
taste = "linux-cachyos-server";
pname = "cachyos-server";
configPath = ./config-nix/cachyos-server.x86_64-linux.nix;
serverAttrs = {
basicCachy = false;
cpuSched = "eevdf";
ticksHz = 300;
@@ -256,20 +181,11 @@ in
description = "Linux EEVDF scheduler Kernel by CachyOS targeted for Servers";
};
cachyos-server-lto = mkCachyKernel serverLtoKernelAttrs;
# ######################################################
# Base Hardened Config #
# ######################################################
cachyos-server-lto-znver4 = mkCachyKernel (
serverLtoKernelAttrs
// {
configPath = ./config-nix/cachyos-znver4.x86_64-linux.nix;
pname = "cachyos-server-lto-znver4";
}
);
cachyos-hardened = mkCachyKernel {
taste = "linux-cachyos-hardened";
pname = "cachyos-hardened";
configPath = ./config-nix/cachyos-hardened.x86_64-linux.nix;
hardenedAttrs = {
cpuSched = "hardened";
versions = hardenedVersions;
@@ -278,23 +194,127 @@ in
withNTSync = false;
withHDR = false;
};
in
{
inherit
mainVersions
rcVersions
hardenedVersions
mkCachyKernel
;
cachyos-deckify = mkCachyKernel {
# ######################################################
# GCC Kernels #
# ######################################################
# Base GCC
cachyos-gcc = mkCachyKernel gccKernelAttrs;
# GCC LTS
cachyos-lts = mkCachyKernel (gccKernelAttrs // ltsAttrs // {
taste = "linux-cachyos-lts";
pname = "cachyos-lts";
configPath = ./config-nix/${arch}-linux/cachyos-lts.${arch}-linux.nix;
});
# GCC RC
cachyos-rc = mkCachyKernel (gccKernelAttrs // rcAttrs // {
taste = "linux-cachyos-rc";
pname = "cachyos-rc";
configPath = ./config-nix/${arch}-linux/cachyos-rc.${arch}-linux.nix;
});
# Server GCC
cachyos-server = mkCachyKernel gccKernelAttrs // serverAttrs // ({
taste = "linux-cachyos-server";
pname = "cachyos-server";
configPath = ./config-nix/${arch}-linux/cachyos-server.${arch}-linux.nix;
});
# Hardened GCC
cachyos-hardened = mkCachyKernel (gccKernelAttrs // hardenedAttrs // {
taste = "linux-cachyos-hardened";
pname = "cachyos-hardened";
configPath = ./config-nix/${arch}-linux/cachyos-hardened.${arch}-linux.nix;
});
# Deckify GCC
cachyos-deckify = mkCachyKernel (gccKernelAttrs // {
taste = "linux-cachyos-deckify";
pname = "cachyos-deckify";
configPath = ./config-nix/cachyos-deckify.x86_64-linux.nix;
configPath = ./config-nix/${arch}-linux/cachyos-deckify.${arch}-linux.nix;
});
versions = mainVersions;
withUpdateScript = "stable";
# ######################################################
# LTO Kernels #
# ######################################################
# Base LTO
cachyos-lto = mkCachyKernel ltoKernelAttrs;
# LTO Full
cachyos-lto-full = mkCachyKernel (ltoKernelAttrs // {
configPath = ./config-nix/cachyos-lto.x86_64-linux.nix;
useLTO = "full";
});
# LTO Zen Version 4
cachyos-lto-znver4 = mkCachyKernel (
ltoKernelAttrs
// {
pname = "cachyos-lto-znver4";
configPath = ./config-nix/${arch}-linux/cachyos-znver4.${arch}-linux.nix;
}
);
# RC LTO
cachyos-rc-lto = mkCachyKernel (
ltoKernelAttrs
// rcAttrs // {
taste = "linux-cachyos-rc";
pname = "cachyos-rc-lto";
configPath = ./config-nix/${arch}-linux/cachyos-rc-lto.${arch}-linux.nix;
}
);
# RC LTO Zen Version 4
cachyos-rc-lto-znver4 = mkCachyKernel (
ltoKernelAttrs
// rcAttrs // {
taste = "linux-cachyos-rc";
pname = "cachyos-rc-lto-znver4";
configPath = ./config-nix/${arch}-linux/cachyos-rc-lto-znver4.${arch}-linux.nix;
}
);
# Server LTO
cachyos-server-lto = mkCachyKernel ltoKernelAttrs // serverAttrs // {
taste = "linux-cachyos-server";
pname = "cachyos-server-lto";
configPath = ./config-nix/${arch}-linux/cachyos-server-lto.${arch}-linux.nix;
};
cachyos-deckify-lto = mkCachyKernel ltoKernelAttrs // {
# Server LTO Zen Version 4
cachyos-server-lto-znver4 = mkCachyKernel (
serverLtoKernelAttrs
// {
configPath = ./config-nix/${arch}-linux/cachyos-server-znver4.${arch}-linux.nix;
pname = "cachyos-server-lto-znver4";
}
);
# Deckify LTO
cachyos-deckify-lto = mkCachyKernel (ltoKernelAttrs // {
pname = "linux-cachyos-deckify-lto";
configPath = ./config-nix/cachyos-deckify-lto.x86_64-linux.nix;
};
configPath = ./config-nix/${arch}-linux/cachyos-deckify-lto.${arch}-linux.nix;
});
# ######################################################
# Cachy ZFZ #
# ######################################################
zfs = zfs_2_3.overrideAttrs (prevAttrs: {
src = if isUnsupported then brokenReplacement else gccKernel.zfs_cachyos.src;
src = if isUnsupported then brokenReplacement else (mkCachyKernel gccKernelAttrs).zfs_cachyos.src;
patches = [ ];
passthru = prevAttrs.passthru // {
kernelModuleAttribute = "zfs_cachyos";