Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 4 additions & 5 deletions pkgs/linux-cachyos/config-nix/cachyos-lto.x86_64-linux.nix
Original file line number Diff line number Diff line change
@@ -1,16 +1,15 @@
{
"CONFIG_CC_VERSION_TEXT" = "clang version 20.1.8";
"CONFIG_CC_VERSION_TEXT" = "clang version 19.1.7";
"CONFIG_GCC_VERSION" = "0";
"CONFIG_CC_IS_CLANG" = "y";
"CONFIG_CLANG_VERSION" = "200108";
"CONFIG_CLANG_VERSION" = "190107";
"CONFIG_AS_IS_LLVM" = "y";
"CONFIG_AS_VERSION" = "200108";
"CONFIG_AS_VERSION" = "190107";
"CONFIG_LD_VERSION" = "0";
"CONFIG_LD_IS_LLD" = "y";
"CONFIG_LLD_VERSION" = "200108";
"CONFIG_LLD_VERSION" = "190107";
"CONFIG_RUSTC_VERSION" = "0";
"CONFIG_RUSTC_LLVM_VERSION" = "0";
"CONFIG_CC_CAN_LINK" = "y";
"CONFIG_CC_HAS_ASM_GOTO_OUTPUT" = "y";
"CONFIG_CC_HAS_ASM_GOTO_TIED_OUTPUT" = "y";
"CONFIG_TOOLS_SUPPORT_RELR" = "y";
Expand Down
41 changes: 10 additions & 31 deletions pkgs/linux-cachyos/default.nix
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{ final, ... }@inputs:
{ final, flakes, ... }@inputs:

let
inherit (final.stdenv) isDarwin;
inherit (final.lib.trivial) importJSON;

# CachyOS repeating stuff.
Expand All @@ -16,11 +17,14 @@ let
});

mkCachyKernel =
if final.stdenv.isDarwin then
if isDarwin then
_attrs: { kernel = brokenDarwin; }
else
attrs:
final.callPackage ./packages-for.nix (
{
callPackage ? final.callPackage,
...
}@attrs:
callPackage ./packages-for.nix (
{
versions = mainVersions;
inherit inputs;
Expand All @@ -29,16 +33,12 @@ let
// attrs
);

stdenvLLVM = final.callPackage ./lib/llvm-stdenv.nix { };

mainKernel = mkCachyKernel {
taste = "linux-cachyos";
configPath = ./config-nix/cachyos.x86_64-linux.nix;
# since all flavors use the same versions.json, we just need the updateScript in one of them
withUpdateScript = "stable";
};

llvmModuleOverlay = import ./lib/llvm-module-overlay.nix inputs stdenvLLVM;
in
{
inherit
Expand Down Expand Up @@ -67,31 +67,10 @@ in
taste = "linux-cachyos";
configPath = ./config-nix/cachyos-lto.x86_64-linux.nix;

stdenv = stdenvLLVM;
inherit (final.pkgsLLVM.extend flakes.self.overlays.default) callPackage;
useLTO = "thin";

description = "Linux EEVDF-BORE scheduler Kernel by CachyOS built with LLVM and Thin LTO";

packagesExtend =
kernel: _finalModules: prev:
(builtins.mapAttrs (
k: v:
if
builtins.elem k [
"zenpower"
"v4l2loopback"
"zfs_cachyos"
"virtualbox"
"xone"
]
then
llvmModuleOverlay kernel v
else
v
) prev)
// {
recurseForDerivations = false;
};
};

cachyos-sched-ext = throw "\"sched-ext\" patches were merged with \"cachyos\" flavor.";
Expand Down Expand Up @@ -124,7 +103,7 @@ in
};

zfs = final.zfs_2_3.overrideAttrs (prevAttrs: {
src = if final.stdenv.isDarwin then brokenDarwin else mainKernel.zfs_cachyos.src;
src = if isDarwin then brokenDarwin else mainKernel.zfs_cachyos.src;
patches = [ ];
passthru = prevAttrs.passthru // {
kernelModuleAttribute = "zfs_cachyos";
Expand Down
49 changes: 0 additions & 49 deletions pkgs/linux-cachyos/lib/llvm-stdenv.nix

This file was deleted.

14 changes: 13 additions & 1 deletion pkgs/linux-cachyos/packages-for.nix
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,12 @@
fetchFromGitHub,
nyxUtils,
lib,
buildPackages,
ogKernelConfigfile ? linuxPackages.kernel.passthru.configfile,
withUpdateScript ? null,
packagesExtend ? null,
cachyOverride,
extraMakeFlags ? [ ],
# those are set in their PKGBUILDs
kernelPatches ? { },
basicCachy ? true,
Expand All @@ -28,7 +30,7 @@
withHDR ? true,
withoutDebug ? false,
description ? "Linux EEVDF-BORE scheduler Kernel by CachyOS with other patches and improvements",
# For tests
# For flakes
inputs,
}:

Expand Down Expand Up @@ -64,6 +66,7 @@ let
stdenv
kernel
ogKernelConfigfile
commonMakeFlags
;
};
kconfigToNix = callPackage ./lib/kconfig-to-nix.nix {
Expand All @@ -81,6 +84,15 @@ let
kernelPackages = packagesWithRightPlatforms;
};

commonMakeFlags = import "${inputs.flakes.nixpkgs}/pkgs/os-specific/linux/kernel/common-flags.nix" {
inherit
lib
stdenv
buildPackages
extraMakeFlags
;
};

# CachyOS repeating stuff.
addOurs = _finalAttrs: prevAttrs: {
kernel_configfile = prevAttrs.kernel.configfile;
Expand Down
17 changes: 8 additions & 9 deletions pkgs/linux-cachyos/prepare.nix
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
stdenv,
kernel,
ogKernelConfigfile,
commonMakeFlags,
}:
let
inherit (cachyConfig.versions.linux) version;
Expand Down Expand Up @@ -111,10 +112,7 @@ let
++ damonConfig
++ ntSyncConfig
++ hdrConfig
++ disableDebug

#_use_auto_optimization, defaults to "y" [but GENERIC to ""]
;
++ disableDebug;

# _cachy_config, defaults to "y"
basicCachyConfig = lib.optional cachyConfig.basicCachy "-e CACHY";
Expand Down Expand Up @@ -180,6 +178,7 @@ let

# _use_llvm_lto, defaults to "none"
ltoConfig =
assert (cachyConfig.useLTO == "none" || stdenv.cc.isClang);
if cachyConfig.useLTO == "thin" then
[
"-e LTO"
Expand Down Expand Up @@ -311,14 +310,14 @@ let
"-d LATENCYTOP"
"-d DEBUG_PREEMPT"
];

makeEnv = if cachyConfig.useLTO != "none" then "make LLVM=1 LLVM_IAS=1" else "make";
in
stdenv.mkDerivation (finalAttrs: {
inherit src patches;
name = "linux-cachyos-config";
nativeBuildInputs = kernel.nativeBuildInputs ++ kernel.buildInputs;

makeFlags = commonMakeFlags;

postPhase = ''
${finalAttrs.passthru.extraVerPatch}
'';
Expand All @@ -327,10 +326,10 @@ stdenv.mkDerivation (finalAttrs: {
runHook preBuild

cp "${config-src}/${cachyConfig.taste}/config" ".config"
${makeEnv} olddefconfig
make $makeFlags olddefconfig
patchShebangs scripts/config
scripts/config ${lib.concatStringsSep " " pkgbuildConfig}
${makeEnv} olddefconfig
make $makeFlags olddefconfig

runHook postBuild
'';
Expand All @@ -349,7 +348,7 @@ stdenv.mkDerivation (finalAttrs: {
};

passthru = {
inherit cachyConfig makeEnv stdenv;
inherit cachyConfig commonMakeFlags stdenv;
kernelPatches = patches;
extraVerPatch = ''
sed -Ei"" 's/EXTRAVERSION = ?(.*)$/EXTRAVERSION = \1${cachyConfig.versions.suffix}/g' Makefile
Expand Down