Files
nix-config/packages/linux-cachyos/kernel.nix
2026-01-20 13:50:46 -06:00

91 lines
2.0 KiB
Nix

{
cachyConfig,
kconfigToNix,
config,
configfile,
callPackage,
lib,
linuxManualConfig,
stdenv,
# Weird injections
kernelPatches ? [ ],
features ? null,
randstructSeed ? "",
pname ? "unknown",
# For tests
kernelPackages,
flakes,
final,
}:
let
version =
if stdenv.isAarch64 then
"6.12.47"
else
cachyConfig.versions.linux.version;
# Single-value optional attr
optionalAttr =
key: pred: value:
if pred then { "${key}" = value; } else { };
in
(linuxManualConfig {
inherit
pname
stdenv
version
features
randstructSeed
;
inherit (configfile) src;
modDirVersion = lib.versions.pad 3 "${version}${cachyConfig.versions.suffix}";
inherit config configfile;
allowImportFromDerivation = false;
kernelPatches =
kernelPatches
++ builtins.map (filename: {
name = builtins.baseNameOf filename;
patch = filename;
}) configfile.passthru.kernelPatches;
extraMeta = {
maintainers = with lib.maintainers; [
dr460nf1r3
pedrohlc
];
inherit (configfile.meta) platforms;
};
}).overrideAttrs
(prevAttrs: {
postPatch = prevAttrs.postPatch + configfile.extraVerPatch;
# bypasses https://github.com/NixOS/nixpkgs/issues/216529
passthru =
prevAttrs.passthru
// {
inherit cachyConfig kconfigToNix;
features = {
efiBootStub = true;
ia32Emulation = true;
netfilterRPFilter = true;
};
isLTS = false;
isZen = true;
isHardened = cachyConfig.cpuSched == "hardened";
isLibre = false;
updateScript = null;
tests = (prevAttrs.passthru.tests or { }) // {
plymouth = import ./test.nix {
inherit kernelPackages;
inherit (flakes) nixpkgs;
chaotic = flakes.self;
} final;
};
}
// optionalAttr "updateScript" (cachyConfig.withUpdateScript != null) (
callPackage ./update.nix {
inherit (cachyConfig) withUpdateScript;
}
);
})