lol
This commit is contained in:
@@ -1,8 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
set -eu
|
||||
|
||||
# -gcc,-server,-lts,-rc,-hardened,
|
||||
# ,-rc-lto, -lts-lto,-hardened-lto, -lto,
|
||||
for flavor in cachyos{-server-lto,-lto-znver4,-server-lto-znver4}; do
|
||||
nom build ".#nixosConfigurations.jallen-nas.pkgs.mjallen.linuxPackages_${flavor}.kernel"
|
||||
done
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -1 +0,0 @@
|
||||
import ./cachyos-rc-lto.x86_64-linux.nix // { "CONFIG_X86_64_VERSION" = "ZEN4"; }
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -1 +0,0 @@
|
||||
import ./cachyos-server-lto.x86_64-linux.nix // { "CONFIG_X86_64_VERSION" = "ZEN4"; }
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1 +0,0 @@
|
||||
import ./cachyos-lto.x86_64-linux.nix // { "CONFIG_X86_64_VERSION" = "ZEN4"; }
|
||||
@@ -1,427 +0,0 @@
|
||||
{
|
||||
stdenv,
|
||||
pkgs,
|
||||
lib,
|
||||
callPackage,
|
||||
zfs_2_3,
|
||||
# 1. Add 'inputs' generic argument (passed by Snowfall Lib)
|
||||
inputs ? { },
|
||||
# 2. Make 'self' optional, defaulting to inputs.self (handles both Overlay and Snowfall cases)
|
||||
self ? inputs.self,
|
||||
namespace,
|
||||
...
|
||||
}@args: # 3. Rename this capture from 'inputs' to 'args' to avoid variable name collision
|
||||
|
||||
let
|
||||
inherit (stdenv) isx86_64 isAarch64 isLinux;
|
||||
inherit (lib.trivial) importJSON;
|
||||
inherit (lib.${namespace}) selectVariant;
|
||||
|
||||
arch = (if isx86_64 then "x86_64" else "aarch64");
|
||||
|
||||
# ######################################################
|
||||
# Source Versions #
|
||||
# ######################################################
|
||||
versionSpec = importJSON ./version.json;
|
||||
mkVersions =
|
||||
selected:
|
||||
let
|
||||
s = selected.sources;
|
||||
vars = selected.variables or { };
|
||||
in
|
||||
{
|
||||
suffix = vars.suffix or "";
|
||||
linux = {
|
||||
inherit (s.linux) version hash;
|
||||
}
|
||||
// lib.optionalAttrs (s.linux ? fetcher && s.linux.fetcher == "github") {
|
||||
inherit (s.linux) owner repo rev;
|
||||
};
|
||||
config = {
|
||||
rev = s.config.rev;
|
||||
hash = s.config.hash;
|
||||
};
|
||||
patches = {
|
||||
rev = s.patches.rev;
|
||||
hash = s.patches.hash;
|
||||
};
|
||||
zfs = {
|
||||
rev = s.zfs.rev;
|
||||
hash = s.zfs.hash;
|
||||
};
|
||||
};
|
||||
|
||||
mainVersions = mkVersions (selectVariant versionSpec null null);
|
||||
ltsVersions = mkVersions (selectVariant versionSpec "lts" null);
|
||||
rcVersions = mkVersions (selectVariant versionSpec "rc" null);
|
||||
hardenedVersions = mkVersions (selectVariant versionSpec "hardened" null);
|
||||
|
||||
# ######################################################
|
||||
# Base LTO Config #
|
||||
# ######################################################
|
||||
ltoKernelAttrs = {
|
||||
taste = "linux-cachyos";
|
||||
pname = "cachyos-lto";
|
||||
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;
|
||||
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";
|
||||
};
|
||||
|
||||
serverLtoKernelAttrs = ltoKernelAttrs // {
|
||||
taste = "linux-cachyos-server";
|
||||
pname = "cachyos-server-lto";
|
||||
configPath = ./config-nix/${arch}-linux/cachyos-server-lto.${arch}-linux.nix;
|
||||
basicCachy = false;
|
||||
cpuSched = "eevdf";
|
||||
ticksHz = 300;
|
||||
tickRate = "idle";
|
||||
preempt = "server";
|
||||
hugePages = "madvise";
|
||||
withDAMON = true;
|
||||
withNTSync = false;
|
||||
withHDR = false;
|
||||
};
|
||||
|
||||
# ######################################################
|
||||
# Misc Utils #
|
||||
# ######################################################
|
||||
|
||||
# Evaluation hack
|
||||
brokenReplacement = pkgs.hello.overrideAttrs (prevAttrs: {
|
||||
meta = prevAttrs.meta // {
|
||||
platform = [ ];
|
||||
broken = true;
|
||||
};
|
||||
});
|
||||
|
||||
isUnsupported = !(isx86_64 || isAarch64) || !isLinux;
|
||||
|
||||
mkCachyKernel =
|
||||
if isUnsupported then
|
||||
# Evaluation hack
|
||||
_attrs: {
|
||||
kernel = brokenReplacement;
|
||||
recurseForDerivations = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
callPackage ? args.callPackage,
|
||||
...
|
||||
}@attrs:
|
||||
callPackage ./packages-for.nix (
|
||||
{
|
||||
versions = mainVersions;
|
||||
inherit inputs;
|
||||
cachyOverride = newAttrs: mkCachyKernel (attrs // newAttrs);
|
||||
}
|
||||
// attrs
|
||||
);
|
||||
|
||||
# ######################################################
|
||||
# Base GCC Config #
|
||||
# ######################################################
|
||||
|
||||
gccKernelAttrs = {
|
||||
taste = "linux-cachyos";
|
||||
pname = "cachyos-gcc";
|
||||
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";
|
||||
};
|
||||
|
||||
# ######################################################
|
||||
# Base LTS Config #
|
||||
# ######################################################
|
||||
|
||||
ltsAttrs = {
|
||||
versions = ltsVersions;
|
||||
withUpdateScript = "lts";
|
||||
|
||||
# Prevent building kernel modules for LTS kernel
|
||||
packagesExtend =
|
||||
_kernel: _final: prev:
|
||||
prev // { recurseForDerivations = false; };
|
||||
};
|
||||
|
||||
# ######################################################
|
||||
# Base RC Config #
|
||||
# ######################################################
|
||||
|
||||
rcAttrs = {
|
||||
versions = rcVersions;
|
||||
withUpdateScript = "rc";
|
||||
|
||||
# Prevent building kernel modules for rc kernel
|
||||
packagesExtend =
|
||||
_kernel: _final: prev:
|
||||
prev // { recurseForDerivations = false; };
|
||||
};
|
||||
|
||||
# ######################################################
|
||||
# Base Server Config #
|
||||
# ######################################################
|
||||
|
||||
serverAttrs = {
|
||||
basicCachy = false;
|
||||
cpuSched = "eevdf";
|
||||
ticksHz = 300;
|
||||
tickRate = "idle";
|
||||
preempt = "server";
|
||||
hugePages = "madvise";
|
||||
withDAMON = true;
|
||||
withNTSync = false;
|
||||
withHDR = false;
|
||||
description = "Linux EEVDF scheduler Kernel by CachyOS targeted for Servers";
|
||||
};
|
||||
|
||||
# ######################################################
|
||||
# Base Hardened Config #
|
||||
# ######################################################
|
||||
|
||||
hardenedAttrs = {
|
||||
cpuSched = "hardened";
|
||||
|
||||
versions = hardenedVersions;
|
||||
withUpdateScript = "hardened";
|
||||
|
||||
withNTSync = false;
|
||||
withHDR = false;
|
||||
};
|
||||
in
|
||||
{
|
||||
inherit
|
||||
mainVersions
|
||||
rcVersions
|
||||
hardenedVersions
|
||||
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/${arch}-linux/cachyos-deckify.${arch}-linux.nix;
|
||||
}
|
||||
);
|
||||
|
||||
# ######################################################
|
||||
# LTO Kernels #
|
||||
# ######################################################
|
||||
|
||||
# Base LTO
|
||||
cachyos-lto = mkCachyKernel ltoKernelAttrs;
|
||||
|
||||
# LTO Full
|
||||
cachyos-lto-full = mkCachyKernel (
|
||||
ltoKernelAttrs
|
||||
// {
|
||||
configPath = ./config-nix/${arch}-linux/cachyos-lto-full.${arch}-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;
|
||||
}
|
||||
);
|
||||
|
||||
# LTS LTO
|
||||
cachyos-lts-lto = mkCachyKernel (
|
||||
ltoKernelAttrs
|
||||
// ltsAttrs
|
||||
// {
|
||||
taste = "linux-cachyos-lts";
|
||||
pname = "cachyos-lts-lto";
|
||||
configPath = ./config-nix/${arch}-linux/cachyos-lts-lto.${arch}-linux.nix;
|
||||
}
|
||||
);
|
||||
|
||||
# LTS LTO 16k
|
||||
cachyos-lts-lto-16k = mkCachyKernel (
|
||||
ltoKernelAttrs
|
||||
// ltsAttrs
|
||||
// {
|
||||
taste = "linux-cachyos-lts";
|
||||
pname = "cachyos-lts-lto";
|
||||
configPath = ./config-nix/${arch}-linux/cachyos-lts-lto-16k.${arch}-linux.nix;
|
||||
pageSize = "16k";
|
||||
}
|
||||
);
|
||||
|
||||
# Hardened LTO
|
||||
cachyos-hardened-lto = mkCachyKernel (
|
||||
ltoKernelAttrs
|
||||
// hardenedAttrs
|
||||
// {
|
||||
taste = "linux-cachyos-hardened";
|
||||
pname = "cachyos-hardened-lto";
|
||||
configPath = ./config-nix/${arch}-linux/cachyos-hardened-lto.${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-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;
|
||||
}
|
||||
);
|
||||
|
||||
# Server LTO
|
||||
cachyos-server-lto-16k = mkCachyKernel (
|
||||
ltoKernelAttrs
|
||||
// serverAttrs
|
||||
// {
|
||||
taste = "linux-cachyos-server";
|
||||
pname = "cachyos-server-lto";
|
||||
configPath = ./config-nix/${arch}-linux/cachyos-server-lto-16k.${arch}-linux.nix;
|
||||
pageSize = "16k";
|
||||
}
|
||||
);
|
||||
|
||||
# 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/${arch}-linux/cachyos-deckify-lto.${arch}-linux.nix;
|
||||
}
|
||||
);
|
||||
|
||||
# ######################################################
|
||||
# Cachy ZFZ #
|
||||
# ######################################################
|
||||
|
||||
zfs = zfs_2_3.overrideAttrs (prevAttrs: {
|
||||
src = if isUnsupported then brokenReplacement else (mkCachyKernel gccKernelAttrs).zfs_cachyos.src;
|
||||
patches = [ ];
|
||||
passthru = prevAttrs.passthru // {
|
||||
kernelModuleAttribute = "zfs_cachyos";
|
||||
};
|
||||
postPatch = builtins.replaceStrings [ "grep --quiet '^Linux-M" ] [ "# " ] prevAttrs.postPatch;
|
||||
});
|
||||
}
|
||||
@@ -1,94 +0,0 @@
|
||||
{
|
||||
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: {
|
||||
# Apply patches with --forward (skip already-merged/reversed hunks) and
|
||||
# --fuzz=3 (tolerate minor context mismatches due to kernel version skew).
|
||||
patchPhase = ''
|
||||
runHook prePatch
|
||||
for p in $patches; do
|
||||
echo "applying patch $p"
|
||||
patch -p1 --forward --fuzz=3 < "$p" || true
|
||||
done
|
||||
runHook postPatch
|
||||
'';
|
||||
postPatch = prevAttrs.postPatch + configfile.extraVerPatch;
|
||||
# bypasses https://github.com/NixOS/nixpkgs/issues/216529
|
||||
passthru =
|
||||
prevAttrs.passthru
|
||||
// {
|
||||
inherit cachyConfig kconfigToNix;
|
||||
features = {
|
||||
efiBootStub = true;
|
||||
ia32Emulation = stdenv.isx86_64;
|
||||
netfilterRPFilter = true;
|
||||
};
|
||||
isLTS = false;
|
||||
isZen = true;
|
||||
isHardened = cachyConfig.cpuSched == "hardened";
|
||||
isLibre = false;
|
||||
updateScript = null;
|
||||
tests = null;
|
||||
}
|
||||
// optionalAttr "updateScript" (cachyConfig.withUpdateScript != null) (
|
||||
callPackage ./update.nix {
|
||||
inherit (cachyConfig) withUpdateScript;
|
||||
}
|
||||
);
|
||||
})
|
||||
@@ -1,11 +0,0 @@
|
||||
{ runCommand, configfile }:
|
||||
# taken from <nixpkgs>/pkgs/os-specific/linux/kernel/manual-config.nix
|
||||
runCommand "config.nix" { } ''
|
||||
echo "{" > "$out"
|
||||
while IFS='=' read key val; do
|
||||
[ "x''${key#CONFIG_}" != "x$key" ] || continue
|
||||
no_firstquote="''${val#\"}";
|
||||
echo ' "'"$key"'" = "'"''${no_firstquote%\"}"'";' >> "$out"
|
||||
done < "${configfile}"
|
||||
echo "}" >> $out
|
||||
''
|
||||
@@ -1,102 +0,0 @@
|
||||
{ pkgs, lib, ... }:
|
||||
kernel: _finalModules: prevModules:
|
||||
|
||||
let
|
||||
# Helps when overriding both inputs and outputs attrs.
|
||||
multiOverride = prev: newInputs: (prev.override newInputs).overrideAttrs;
|
||||
|
||||
# Helps replacing all the dependencies in a derivation.
|
||||
overrideFull =
|
||||
newScope: prev:
|
||||
let
|
||||
args = prev.override.__functionArgs;
|
||||
names = builtins.filter (arg: builtins.hasAttr arg newScope) (builtins.attrNames args);
|
||||
values = lib.attrsets.genAttrs names (arg: builtins.getAttr arg newScope);
|
||||
in
|
||||
prev.override values;
|
||||
|
||||
# Don't waste user's time.
|
||||
markBroken =
|
||||
drv:
|
||||
drv.overrideAttrs (prevAttrs: {
|
||||
meta = (prevAttrs.meta or { }) // {
|
||||
broken = true;
|
||||
};
|
||||
});
|
||||
|
||||
fixNoVideo =
|
||||
prevDrv:
|
||||
prevDrv.overrideAttrs (prevAttrs: {
|
||||
passthru = prevAttrs.passthru // {
|
||||
settings = overrideFull (pkgs // pkgs.xorg) prevAttrs.passthru.settings;
|
||||
};
|
||||
});
|
||||
in
|
||||
with prevModules;
|
||||
{
|
||||
evdi =
|
||||
multiOverride prevModules.evdi
|
||||
{
|
||||
inherit (pkgs) python3;
|
||||
}
|
||||
(prevAttrs: rec {
|
||||
env = prevAttrs.env // {
|
||||
CFLAGS = "";
|
||||
};
|
||||
makeFlags = prevAttrs.makeFlags ++ [
|
||||
"CFLAGS=${
|
||||
builtins.replaceStrings [ "discarded-qualifiers" ] [ "ignored-qualifiers" ] prevAttrs.env.CFLAGS
|
||||
}"
|
||||
];
|
||||
postPatch = ''
|
||||
substituteInPlace Makefile \
|
||||
--replace-fail 'discarded-qualifiers' 'ignored-qualifiers'
|
||||
'';
|
||||
# Don't build userspace stuff
|
||||
postBuild = "";
|
||||
installPhase =
|
||||
builtins.replaceStrings [ "install -Dm755 library/libevdi.so" ] [ "#" ]
|
||||
prevAttrs.installPhase;
|
||||
});
|
||||
nvidia_x11 = fixNoVideo nvidia_x11;
|
||||
nvidia_x11_beta = fixNoVideo nvidia_x11_beta;
|
||||
nvidia_x11_latest = fixNoVideo nvidia_x11_latest;
|
||||
nvidia_x11_legacy535 = fixNoVideo nvidia_x11_legacy535;
|
||||
nvidia_dc_535 = markBroken nvidia_dc_535;
|
||||
nvidia_dc_565 = markBroken nvidia_dc_565;
|
||||
nvidia_x11_legacy470 = markBroken nvidia_x11_legacy470;
|
||||
nvidiaPackages = nvidiaPackages.extend (
|
||||
_finalNV: prevNV: with prevNV; {
|
||||
production = fixNoVideo production;
|
||||
stable = fixNoVideo stable;
|
||||
beta = fixNoVideo beta;
|
||||
vulkan_beta = fixNoVideo vulkan_beta;
|
||||
latest = fixNoVideo latest;
|
||||
legacy_535 = fixNoVideo legacy_535;
|
||||
dc_535 = markBroken dc_535;
|
||||
dc_565 = markBroken dc_565;
|
||||
legacy_470 = markBroken legacy_470;
|
||||
}
|
||||
);
|
||||
# perf needs systemtap fixed first
|
||||
perf = markBroken perf;
|
||||
virtualbox =
|
||||
multiOverride virtualbox
|
||||
{
|
||||
inherit (final) virtualbox;
|
||||
}
|
||||
(prevAttrs: {
|
||||
makeFlags = prevAttrs.makeFlags ++ kernel.commonMakeFlags;
|
||||
});
|
||||
xpadneo = xpadneo.override {
|
||||
inherit (final) bluez;
|
||||
};
|
||||
zenpower = zenpower.overrideAttrs (prevAttrs: {
|
||||
makeFlags =
|
||||
prevAttrs.makeFlags
|
||||
++ kernel.commonMakeFlags
|
||||
++ [
|
||||
"KBUILD_CFLAGS="
|
||||
];
|
||||
});
|
||||
}
|
||||
@@ -1,30 +0,0 @@
|
||||
{
|
||||
pkgs,
|
||||
self,
|
||||
...
|
||||
}:
|
||||
let
|
||||
# Don't waste user's time.
|
||||
markBroken =
|
||||
drv:
|
||||
drv.overrideAttrs (prevAttrs: {
|
||||
meta = (prevAttrs.meta or { }) // {
|
||||
broken = true;
|
||||
};
|
||||
});
|
||||
in
|
||||
(pkgs.pkgsLLVM.extend self.overlays.default).extend (
|
||||
_finalLLVM: prevLLVM: {
|
||||
inherit (pkgs)
|
||||
dbus
|
||||
libdrm
|
||||
libgbm
|
||||
libGL
|
||||
libxv
|
||||
libtirpc
|
||||
wayland
|
||||
xorg
|
||||
;
|
||||
cups = markBroken prevLLVM.cups;
|
||||
}
|
||||
)
|
||||
@@ -1,9 +0,0 @@
|
||||
# Resolve the Rust toolchain packages needed for CONFIG_RUST=y kernel builds.
|
||||
# Uses buildPackages so cross-compilation works correctly (the compiler runs on
|
||||
# the build machine but produces code for the host/target).
|
||||
{ pkgs, ... }:
|
||||
{
|
||||
rustc = pkgs.buildPackages.rustc-unwrapped;
|
||||
rustBindgen = pkgs.buildPackages.rust-bindgen-unwrapped;
|
||||
rustLibSrc = pkgs.buildPackages.rustPlatform.rustLibSrc;
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,234 +0,0 @@
|
||||
{
|
||||
stdenv,
|
||||
taste,
|
||||
configPath,
|
||||
versions,
|
||||
callPackage,
|
||||
linuxPackages,
|
||||
linuxPackagesFor,
|
||||
fetchFromGitHub,
|
||||
lib,
|
||||
pkgs,
|
||||
buildPackages,
|
||||
ogKernelConfigfile ? linuxPackages.kernel.passthru.configfile,
|
||||
withUpdateScript ? null,
|
||||
packagesExtend ? null,
|
||||
cachyOverride,
|
||||
extraMakeFlags ? [ ],
|
||||
zfsOverride ? { },
|
||||
# those are set in their PKGBUILDs
|
||||
basicCachy ? true,
|
||||
mArch ? null,
|
||||
cpuSched ? "cachyos",
|
||||
useLTO ? "none",
|
||||
ticksHz ? 500,
|
||||
tickRate ? "full",
|
||||
preempt ? "full",
|
||||
hugePages ? "always",
|
||||
withDAMON ? false,
|
||||
withNTSync ? true,
|
||||
withHDR ? true,
|
||||
withoutDebug ? false,
|
||||
pageSize ? "4k",
|
||||
withRust ? false,
|
||||
description ? "Linux EEVDF-BORE scheduler Kernel by CachyOS with other patches and improvements",
|
||||
# For flakes
|
||||
inputs ? { },
|
||||
pname ? "unknown",
|
||||
# Explicitly accept nixpkgs, falling back to inputs or the system path
|
||||
nixpkgs ? inputs.nixpkgs or pkgs.path,
|
||||
}:
|
||||
|
||||
let
|
||||
# For revs
|
||||
shorter = builtins.substring 0 7;
|
||||
|
||||
# Helps when overriding.
|
||||
dropUpdateScript = prevAttrs: { passthru = removeAttrs prevAttrs.passthru [ "updateScript" ]; };
|
||||
|
||||
# Helps when batch-overriding.
|
||||
dropAttrsUpdateScript = builtins.mapAttrs (
|
||||
_k: v: if (v.passthru.updateScript or null) != null then v.overrideAttrs dropUpdateScript else v
|
||||
);
|
||||
|
||||
# Helps when batch-overriding.
|
||||
setAttrsPlatforms =
|
||||
platforms:
|
||||
builtins.mapAttrs (
|
||||
_k: v:
|
||||
if (v ? "overrideAttrs") then
|
||||
v.overrideAttrs (prevAttrs: {
|
||||
meta = (prevAttrs.meta or { }) // {
|
||||
platforms = lib.lists.intersectLists (prevAttrs.meta.platforms or [ ]) platforms;
|
||||
platformsOrig = prevAttrs.meta.platforms or [ ];
|
||||
badPlatforms = [ ];
|
||||
};
|
||||
})
|
||||
else
|
||||
v
|
||||
);
|
||||
|
||||
cachyConfig = {
|
||||
inherit
|
||||
taste
|
||||
versions
|
||||
basicCachy
|
||||
mArch
|
||||
cpuSched
|
||||
useLTO
|
||||
ticksHz
|
||||
tickRate
|
||||
preempt
|
||||
hugePages
|
||||
withDAMON
|
||||
withNTSync
|
||||
withHDR
|
||||
withoutDebug
|
||||
description
|
||||
withUpdateScript
|
||||
pageSize
|
||||
withRust
|
||||
;
|
||||
};
|
||||
|
||||
# The three phases of the config
|
||||
# - First we apply the changes fromt their PKGBUILD using kconfig;
|
||||
# - Then we NIXify it (in the update-script);
|
||||
# - Last state is importing the NIXified version for building.
|
||||
rustPkgs = lib.optionalAttrs withRust (import ./lib/rust-pkgs.nix { inherit pkgs; });
|
||||
|
||||
preparedConfigfile = callPackage ./prepare.nix (
|
||||
{
|
||||
inherit
|
||||
cachyConfig
|
||||
stdenv
|
||||
kernel
|
||||
ogKernelConfigfile
|
||||
commonMakeFlags
|
||||
;
|
||||
}
|
||||
// lib.optionalAttrs withRust {
|
||||
inherit (rustPkgs) rustc rustBindgen rustLibSrc;
|
||||
}
|
||||
);
|
||||
kconfigToNix = callPackage ./lib/kconfig-to-nix.nix {
|
||||
configfile = preparedConfigfile;
|
||||
};
|
||||
linuxConfigTransfomed = import configPath;
|
||||
|
||||
# normalizeKernelName = pname: drv:
|
||||
# drv.overrideAttrs (old: let
|
||||
# ver = old.version or (lib.getVersion old.name or "unknown");
|
||||
# in {
|
||||
# __intentionallyOverridingVersion = true;
|
||||
# pname = (if useLTO != "none" then "${pname}-lto" else pname);
|
||||
# version = ver;
|
||||
# name = "${pname}-${ver}";
|
||||
# });
|
||||
|
||||
# versionSuffix = "+C${shorter versions.config.rev}+P${shorter versions.patches.rev}";
|
||||
|
||||
# kernel =
|
||||
# normalizeKernelName (cachyConfig.taste or "linux")
|
||||
# (callPackage ./kernel.nix {
|
||||
# inherit cachyConfig stdenv kconfigToNix;
|
||||
# kernelPatches = [ ];
|
||||
# configfile = preparedConfigfile;
|
||||
# config = linuxConfigTransfomed;
|
||||
# flakes = inputs.flakes or null;
|
||||
# final = inputs.final or null;
|
||||
# kernelPackages = packagesWithRightPlatforms;
|
||||
# });
|
||||
|
||||
kernel = callPackage ./kernel.nix {
|
||||
inherit
|
||||
cachyConfig
|
||||
pname
|
||||
stdenv
|
||||
kconfigToNix
|
||||
;
|
||||
kernelPatches = [ ];
|
||||
configfile = preparedConfigfile;
|
||||
config = linuxConfigTransfomed;
|
||||
# For tests: Use 'or null' so it doesn't crash if inputs is empty
|
||||
flakes = inputs.flakes or null;
|
||||
final = inputs.final or null;
|
||||
kernelPackages = packagesWithRightPlatforms;
|
||||
};
|
||||
|
||||
# Use 'nixpkgs' argument instead of 'inputs.nixpkgs'
|
||||
commonMakeFlags = import "${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;
|
||||
zfs_cachyos =
|
||||
(finalAttrs.callPackage "${nixpkgs}/pkgs/os-specific/linux/zfs/generic.nix" zfsOverride {
|
||||
kernelModuleAttribute = "zfs_cachyos";
|
||||
kernelMinSupportedMajorMinor = "1.0";
|
||||
kernelMaxSupportedMajorMinor = "99.99";
|
||||
enableUnsupportedExperimentalKernel = true;
|
||||
inherit (prevAttrs.zfs_2_3) version;
|
||||
tests = { };
|
||||
maintainers = with lib.maintainers; [
|
||||
pedrohlc
|
||||
];
|
||||
hash = "";
|
||||
extraPatches = [ ];
|
||||
}).overrideAttrs
|
||||
(prevAttrs: {
|
||||
src = fetchFromGitHub {
|
||||
owner = "cachyos";
|
||||
repo = "zfs";
|
||||
inherit (versions.zfs) rev hash;
|
||||
};
|
||||
postPatch = builtins.replaceStrings [ "grep --quiet '^Linux-M" ] [ "# " ] prevAttrs.postPatch;
|
||||
});
|
||||
inherit cachyOverride;
|
||||
};
|
||||
|
||||
basePackages = linuxPackagesFor kernel;
|
||||
packagesWithOurs = basePackages.extend addOurs;
|
||||
packagesWithExtend =
|
||||
if packagesExtend == null then
|
||||
packagesWithOurs
|
||||
else
|
||||
packagesWithOurs.extend (packagesExtend kernel);
|
||||
packagesWithRemovals = removeAttrs packagesWithExtend [
|
||||
"zfs"
|
||||
"zfs_2_1"
|
||||
"zfs_2_2"
|
||||
"zfs_2_3"
|
||||
"zfs_unstable"
|
||||
"lkrg"
|
||||
"drbd"
|
||||
# these kernelPackages.* are now pkgs.*
|
||||
"system76-power"
|
||||
"system76-scheduler"
|
||||
"perf"
|
||||
];
|
||||
packagesWithoutUpdateScript = dropAttrsUpdateScript packagesWithRemovals;
|
||||
packagesWithRightPlatforms = setAttrsPlatforms supportedPlatforms packagesWithoutUpdateScript;
|
||||
|
||||
supportedPlatforms = [
|
||||
(with lib.systems.inspect.patterns; isx86_64 // isLinux)
|
||||
(with lib.systems.inspect.patterns; isx86 // isLinux)
|
||||
"x86_64-linux"
|
||||
"aarch64-linux"
|
||||
];
|
||||
|
||||
versionSuffix = "+C${shorter versions.config.rev}+P${shorter versions.patches.rev}";
|
||||
in
|
||||
packagesWithRightPlatforms
|
||||
// {
|
||||
_description = "Kernel and modules for ${description}";
|
||||
_version = "${versions.linux.version}${versionSuffix}";
|
||||
inherit (basePackages) kernel; # This one still has the updateScript
|
||||
}
|
||||
@@ -1,519 +0,0 @@
|
||||
{
|
||||
cachyConfig,
|
||||
fetchFromGitHub,
|
||||
fetchurl,
|
||||
lib,
|
||||
stdenv,
|
||||
kernel,
|
||||
ogKernelConfigfile,
|
||||
commonMakeFlags,
|
||||
# Rust toolchain — only injected when cachyConfig.withRust is true
|
||||
rustc ? null,
|
||||
rustBindgen ? null,
|
||||
rustLibSrc ? null,
|
||||
}:
|
||||
let
|
||||
version =
|
||||
if stdenv.isAarch64 then
|
||||
"6.12.47"
|
||||
else
|
||||
cachyConfig.versions.linux.version;
|
||||
|
||||
majorMinor = lib.versions.majorMinor version;
|
||||
|
||||
patches-src = fetchFromGitHub {
|
||||
owner = "CachyOS";
|
||||
repo = "kernel-patches";
|
||||
inherit (cachyConfig.versions.patches) rev hash;
|
||||
};
|
||||
|
||||
config-src = fetchFromGitHub {
|
||||
owner = "CachyOS";
|
||||
repo = "linux-cachyos";
|
||||
inherit (cachyConfig.versions.config) rev hash;
|
||||
};
|
||||
|
||||
src =
|
||||
if stdenv.isAarch64 then
|
||||
let
|
||||
tag = "stable_20250916";
|
||||
hash = "sha256-Rjn+eWl5cLcc9wgjS3HYVaWM5eKMN3pPfPbsu+QGR/M=";
|
||||
in
|
||||
fetchurl {
|
||||
url = "https://github.com/raspberrypi/linux/archive/refs/tags/${tag}.tar.gz";
|
||||
hash = hash;
|
||||
}
|
||||
else if cachyConfig.taste == "linux-cachyos-rc" then
|
||||
# Use the CachyOS pre-tagged release when a tag is specified; it includes
|
||||
# upstream interim patches that the CachyOS kernel-patches are written against.
|
||||
# Fall back to the vanilla torvalds tarball when no tag is set.
|
||||
if cachyConfig.versions.linux ? tag then
|
||||
fetchurl {
|
||||
url = "https://github.com/CachyOS/linux/releases/download/${cachyConfig.versions.linux.tag}/${cachyConfig.versions.linux.tag}.tar.gz";
|
||||
inherit (cachyConfig.versions.linux) hash;
|
||||
}
|
||||
else
|
||||
fetchurl {
|
||||
url = "https://git.kernel.org/torvalds/t/linux-${version}.tar.gz";
|
||||
inherit (cachyConfig.versions.linux) hash;
|
||||
}
|
||||
else
|
||||
fetchurl {
|
||||
url = "mirror://kernel/linux/kernel/v${lib.versions.major version}.x/linux-${
|
||||
if version == "${majorMinor}.0" then majorMinor else version
|
||||
}.tar.xz";
|
||||
inherit (cachyConfig.versions.linux) hash;
|
||||
};
|
||||
|
||||
schedPatches =
|
||||
if cachyConfig.cpuSched == "eevdf" then
|
||||
[ ]
|
||||
else if cachyConfig.cpuSched == "hardened" then
|
||||
[ ] # BORE disabled in CachyOS/linux-cachyos/commit/4ffae8ab9947f35495dfa7b62b7a22f023488dfb
|
||||
else if (cachyConfig.cpuSched == "cachyos" || cachyConfig.cpuSched == "sched-ext") then
|
||||
lib.optionals (lib.strings.versionOlder majorMinor "6.12") [
|
||||
"${patches-src}/${majorMinor}/sched/0001-sched-ext.patch"
|
||||
]
|
||||
++ lib.optionals (cachyConfig.cpuSched == "cachyos" && version != "6.17-rc1") [
|
||||
"${patches-src}/${majorMinor}/sched/0001-bore-cachy.patch"
|
||||
]
|
||||
else
|
||||
throw "Unsupported cachyos _cpu_sched=${toString cachyConfig.cpuSched}";
|
||||
|
||||
patches = [
|
||||
"${patches-src}/${majorMinor}/all/0001-cachyos-base-all.patch"
|
||||
]
|
||||
++ schedPatches
|
||||
++ lib.optional (
|
||||
cachyConfig.cpuSched == "hardened"
|
||||
) "${patches-src}/${majorMinor}/misc/0001-hardened.patch";
|
||||
|
||||
# There are some configurations set by the PKGBUILD
|
||||
pkgbuildConfig =
|
||||
with cachyConfig;
|
||||
basicCachyConfig
|
||||
++ mArchConfig
|
||||
++ cpuSchedConfig
|
||||
++ [
|
||||
"-m BCACHEFS_FS"
|
||||
"-m CONFIG_CRYPTO_BLAKE2B"
|
||||
]
|
||||
++ [
|
||||
|
||||
# _per_gov, defaults to empty [but PERSONAL CHANGE to "y"]
|
||||
"-d CPU_FREQ_DEFAULT_GOV_SCHEDUTIL"
|
||||
"-e CPU_FREQ_DEFAULT_GOV_PERFORMANCE"
|
||||
|
||||
# _tcp_bbr3, defaults to "y"
|
||||
"-m TCP_CONG_CUBIC"
|
||||
"-d DEFAULT_CUBIC"
|
||||
"-e TCP_CONG_BBR"
|
||||
"-e DEFAULT_BBR"
|
||||
"--set-str DEFAULT_TCP_CONG bbr"
|
||||
"-m NET_SCH_FQ_CODEL"
|
||||
"-e NET_SCH_FQ"
|
||||
"-d DEFAULT_FQ_CODEL"
|
||||
"-e DEFAULT_FQ"
|
||||
"--set-str DEFAULT_NET_SCH fq"
|
||||
|
||||
# Nixpkgs don't support this
|
||||
"-d CONFIG_SECURITY_TOMOYO"
|
||||
]
|
||||
++ ltoConfig
|
||||
++ ticksHzConfig
|
||||
++ tickRateConfig
|
||||
++ preemptConfig
|
||||
++ [
|
||||
# _cc_harder, defaults to "y"
|
||||
"-d CC_OPTIMIZE_FOR_PERFORMANCE"
|
||||
"-e CC_OPTIMIZE_FOR_PERFORMANCE_O3"
|
||||
|
||||
# _lru_config, defaults to "standard"
|
||||
"-e LRU_GEN"
|
||||
"-e LRU_GEN_ENABLED"
|
||||
"-d LRU_GEN_STATS"
|
||||
|
||||
# _vma_config, defaults to "standard"
|
||||
"-e PER_VMA_LOCK"
|
||||
"-d PER_VMA_LOCK_STATS"
|
||||
]
|
||||
++ hugePagesConfig
|
||||
++ damonConfig
|
||||
++ ntSyncConfig
|
||||
++ hdrConfig
|
||||
++ disableDebug
|
||||
++ pageSizeConfig;
|
||||
|
||||
# _cachy_config, defaults to "y"
|
||||
basicCachyConfig = lib.optional cachyConfig.basicCachy "-e CACHY";
|
||||
|
||||
# _processor_opt config, defaults to ""
|
||||
mArchConfig =
|
||||
if cachyConfig.mArch == null then
|
||||
[ ]
|
||||
else if cachyConfig.mArch == "NATIVE" then
|
||||
[
|
||||
"-d GENERIC_CPU"
|
||||
"-d MZEN4"
|
||||
"-e X86_NATIVE_CPU"
|
||||
]
|
||||
else if cachyConfig.mArch == "ZEN4" then
|
||||
[
|
||||
"-d GENERIC_CPU"
|
||||
"-e MZEN4"
|
||||
"-d X86_NATIVE_CPU"
|
||||
]
|
||||
else if builtins.match "GENERIC_V[1-4]" cachyConfig.mArch != null then
|
||||
let
|
||||
v = lib.strings.removePrefix "GENERIC_V" cachyConfig.mArch;
|
||||
in
|
||||
[
|
||||
"-e GENERIC_CPU"
|
||||
"-d MZEN4"
|
||||
"-d X86_NATIVE_CPU"
|
||||
"--set-val X86_64_VERSION ${v}"
|
||||
]
|
||||
else
|
||||
throw "Unsuppoted cachyos mArch";
|
||||
|
||||
# _cpusched, defaults to "cachyos"
|
||||
cpuSchedConfig =
|
||||
if cachyConfig.cpuSched == "eevdf" then
|
||||
[ ]
|
||||
else if cachyConfig.cpuSched == "hardened" then
|
||||
[ "-e SCHED_BORE" ]
|
||||
else if cachyConfig.cpuSched == "sched-ext" then
|
||||
[ "-e SCHED_CLASS_EXT" ]
|
||||
else if cachyConfig.cpuSched == "cachyos" then
|
||||
[
|
||||
"-e SCHED_BORE"
|
||||
"-e SCHED_CLASS_EXT"
|
||||
]
|
||||
else
|
||||
throw "Unsupported cachyos scheduler";
|
||||
|
||||
# _HZ_ticks, defaults to "500"
|
||||
ticksHzConfig =
|
||||
if cachyConfig.ticksHz == 300 then
|
||||
[
|
||||
"-e HZ_300"
|
||||
"--set-val HZ 300"
|
||||
]
|
||||
else
|
||||
[
|
||||
"-d HZ_300"
|
||||
"--set-val HZ ${toString cachyConfig.ticksHz}"
|
||||
"-e HZ_${toString cachyConfig.ticksHz}"
|
||||
];
|
||||
|
||||
# _use_llvm_lto, defaults to "none"
|
||||
ltoConfig =
|
||||
if cachyConfig.useLTO == "thin" then
|
||||
[
|
||||
"-e LTO"
|
||||
"-e LTO_CLANG"
|
||||
"-e ARCH_SUPPORTS_LTO_CLANG"
|
||||
"-e ARCH_SUPPORTS_LTO_CLANG_THIN"
|
||||
"-d LTO_NONE"
|
||||
"-e HAS_LTO_CLANG"
|
||||
"-d LTO_CLANG_FULL"
|
||||
"-e LTO_CLANG_THIN"
|
||||
]
|
||||
else if cachyConfig.useLTO == "full" then
|
||||
[
|
||||
"-e LTO"
|
||||
"-e LTO_CLANG"
|
||||
"-e ARCH_SUPPORTS_LTO_CLANG"
|
||||
"-e ARCH_SUPPORTS_LTO_CLANG_THIN"
|
||||
"-d LTO_NONE"
|
||||
"-e HAS_LTO_CLANG"
|
||||
"-e LTO_CLANG_FULL"
|
||||
"-d LTO_CLANG_THIN"
|
||||
]
|
||||
else if cachyConfig.useLTO == "none" then
|
||||
[ ]
|
||||
else
|
||||
throw "Unsupported cachyos _use_llvm_lto";
|
||||
|
||||
# _tickrate defaults to "full"
|
||||
tickRateConfig =
|
||||
if cachyConfig.tickRate == "idle" then
|
||||
[
|
||||
"-d HZ_PERIODIC"
|
||||
"-d NO_HZ_FULL"
|
||||
"-e NO_HZ_IDLE"
|
||||
"-e NO_HZ"
|
||||
"-e NO_HZ_COMMON"
|
||||
]
|
||||
else if cachyConfig.tickRate == "full" then
|
||||
[
|
||||
"-d HZ_PERIODIC"
|
||||
"-d NO_HZ_IDLE"
|
||||
"-e NO_HZ_FULL"
|
||||
"-e NO_HZ"
|
||||
"-e NO_HZ_COMMON"
|
||||
"-e CONTEXT_TRACKING"
|
||||
]
|
||||
# x86-only tickrate symbols — absent on aarch64, silently ignored but excluded for clarity
|
||||
++ lib.optionals (!stdenv.isAarch64) [
|
||||
"-d CONTEXT_TRACKING_FORCE"
|
||||
"-e NO_HZ_FULL_NODEF"
|
||||
]
|
||||
else
|
||||
throw "Unsupported cachyos _tickrate";
|
||||
|
||||
# _preempt, defaults to "full"
|
||||
preemptConfig =
|
||||
if cachyConfig.preempt == "full" then
|
||||
[
|
||||
"-e PREEMPT_BUILD"
|
||||
"-d PREEMPT_NONE"
|
||||
"-d PREEMPT_VOLUNTARY"
|
||||
"-e PREEMPT"
|
||||
"-e PREEMPT_COUNT"
|
||||
"-e PREEMPTION"
|
||||
"-e PREEMPT_DYNAMIC"
|
||||
]
|
||||
else if cachyConfig.preempt == "server" then
|
||||
[
|
||||
"-e PREEMPT_NONE_BUILD"
|
||||
"-e PREEMPT_NONE"
|
||||
"-d PREEMPT_VOLUNTARY"
|
||||
"-d PREEMPT"
|
||||
"-d PREEMPTION"
|
||||
"-d PREEMPT_DYNAMIC"
|
||||
]
|
||||
else
|
||||
throw "Unsupported cachyos _preempt";
|
||||
|
||||
# _hugepage, defaults to "always"
|
||||
hugePagesConfig =
|
||||
if cachyConfig.hugePages == "always" then
|
||||
[
|
||||
"-d TRANSPARENT_HUGEPAGE_MADVISE"
|
||||
"-e TRANSPARENT_HUGEPAGE_ALWAYS"
|
||||
]
|
||||
else if cachyConfig.hugePages == "madvise" then
|
||||
[
|
||||
"-d TRANSPARENT_HUGEPAGE_ALWAYS"
|
||||
"-e TRANSPARENT_HUGEPAGE_MADVISE"
|
||||
]
|
||||
else
|
||||
throw "Unsupported cachyos _hugepage";
|
||||
|
||||
pageSizeConfig =
|
||||
if cachyConfig.pageSize == "16k" then
|
||||
[
|
||||
"-e CONFIG_SRAM"
|
||||
"-e CONFIG_HISI_HIKEY_USB"
|
||||
"-e CONFIG_OPEN_DICE"
|
||||
"-e CONFIG_VCPU_STALL_DETECTOR"
|
||||
"-e CONFIG_EEPROM_AT25"
|
||||
"-e CONFIG_EEPROM_93XX46"
|
||||
"-e CONFIG_TI_ST"
|
||||
"-e CONFIG_SENSORS_LIS3_SPI"
|
||||
"-e CONFIG_ECHO"
|
||||
# RP1
|
||||
"-e CONFIG_FIRMWARE_RP1"
|
||||
"-e CONFIG_RP1_PIO"
|
||||
"-e CONFIG_WS2812_PIO_RP1"
|
||||
"-e CONFIG_PWM_PIO_RP1"
|
||||
"-e CONFIG_PWM_RP1"
|
||||
"-e CONFIG_PINCTRL_RP1"
|
||||
"-e CONFIG_MFD_RP1"
|
||||
"-e CONFIG_SENSORS_RP1_ADC"
|
||||
"-e CONFIG_VIDEO_RP1_CFE"
|
||||
"-e CONFIG_DRM_RP1_DSI"
|
||||
"-e CONFIG_DRM_RP1_DPI"
|
||||
"-e CONFIG_DRM_RP1_VEC"
|
||||
"-e CONFIG_SND_RP1_AUDIO_OUT"
|
||||
"-e CONFIG_COMMON_CLK_RP1"
|
||||
"-e CONFIG_COMMON_CLK_RP1_SDIO"
|
||||
"-e CONFIG_MBOX_RP1"
|
||||
|
||||
"-e CONFIG_PINCTRL_BCM2712"
|
||||
"-e CONFIG_PINCTRL_BCM2835"
|
||||
"-e CONFIG_ARCH_BCM"
|
||||
"-e CONFIG_ARCH_BCM2835"
|
||||
"-e CONFIG_ARCH_BRCMSTB"
|
||||
"-e CONFIG_AHCI_BRCM"
|
||||
"-e CONFIG_BRCMUTIL"
|
||||
"-e CONFIG_BRCMSMAC"
|
||||
"-e CONFIG_BRCMFMAC"
|
||||
"-e CONFIG_BRCMFMAC_PROTO_BCDC"
|
||||
"-e CONFIG_BRCMFMAC_PROTO_MSGBUF"
|
||||
"-e CONFIG_BRCMFMAC_SDIO"
|
||||
"-e CONFIG_BRCMFMAC_USB"
|
||||
"-e CONFIG_BRCMFMAC_PCIE"
|
||||
"-e CONFIG_BRCMDBG"
|
||||
"-e CONFIG_BRCM_CHAR_DRIVERS"
|
||||
"-e CONFIG_BCM2708_VCMEM"
|
||||
"-e CONFIG_BCM_VCIO"
|
||||
"-e CONFIG_GPIO_BCM_VIRT"
|
||||
"-e CONFIG_GPIO_BRCMSTB"
|
||||
"-e CONFIG_BRCM_USB_PINMAP"
|
||||
"-e CONFIG_MMC_SDHCI_BRCMSTB"
|
||||
"-e CONFIG_RTC_DRV_BRCMSTB"
|
||||
"-e CONFIG_SOC_BRCMSTB"
|
||||
"-e CONFIG_PWM_BRCMSTB"
|
||||
"-e CONFIG_BCM2712_MIP"
|
||||
"-e CONFIG_BCM7120_L2_IRQ"
|
||||
"-e CONFIG_BRCMSTB_L2_IRQ"
|
||||
"-e CONFIG_RESET_BRCMSTB"
|
||||
"-e CONFIG_RESET_BRCMSTB_RESCAL"
|
||||
"-e CONFIG_PHY_BRCM_USB"
|
||||
"-e CONFIG_ARCH_BRCMSTB"
|
||||
"-e CONFIG_ARM_BRCMSTB_AVS_CPUFREQ"
|
||||
|
||||
# Raspberry Pi
|
||||
"-d CONFIG_ARM64_4K_PAGES"
|
||||
"-e CONFIG_ARM64_16K_PAGES"
|
||||
"-e CONFIG_ARM_RASPBERRYPI_CPUFREQ"
|
||||
"-e CONFIG_RASPBERRYPI_FIRMWARE"
|
||||
"-e CONFIG_TOUCHSCREEN_RASPBERRYPI_FW"
|
||||
"-e CONFIG_RASPBERRYPI_GPIOMEM"
|
||||
"-e CONFIG_GPIO_RASPBERRYPI_EXP"
|
||||
"-e CONFIG_SENSORS_RASPBERRYPI_HWMON"
|
||||
"-e CONFIG_MFD_RASPBERRYPI_POE_HAT"
|
||||
"-e CONFIG_REGULATOR_RASPBERRYPI_TOUCHSCREEN_ATTINY"
|
||||
"-e CONFIG_REGULATOR_RASPBERRYPI_TOUCHSCREEN_V2"
|
||||
"-e CONFIG_VIDEO_RASPBERRYPI_PISP_BE"
|
||||
"-e CONFIG_DRM_PANEL_RASPBERRYPI_TOUCHSCREEN"
|
||||
"-e CONFIG_CLK_RASPBERRYPI"
|
||||
"-e CONFIG_RASPBERRYPI_POWER"
|
||||
"-e CONFIG_PWM_RASPBERRYPI_POE"
|
||||
"-e CONFIG_RESET_RASPBERRYPI"
|
||||
"-e CONFIG_ARCH_HAS_RESET_CONTROLLER"
|
||||
"-e CONFIG_NVMEM_RASPBERRYPI_OTP"
|
||||
"-e CONFIG_CPUFREQ_DT"
|
||||
"-e CONFIG_CPUFREQ_DT_PLATDEV"
|
||||
"-e CONFIG_ARM_SCPI_CPUFREQ"
|
||||
"-e CONFIG_ARM_BRCMSTB_AVS_CPUFREQ"
|
||||
"-e CONFIG_ARM_RASPBERRYPI_CPUFREQ"
|
||||
"-e CONFIG_ARM_SCMI_CPUFREQ"
|
||||
"-e KVM"
|
||||
"-e NET_9P_USBG"
|
||||
"-e GPIO_PALMAS"
|
||||
"-e CROS_EC_PROTO"
|
||||
]
|
||||
else if cachyConfig.pageSize == "4k" then
|
||||
[ ]
|
||||
else
|
||||
throw "Unsupported cachyos _hugepage";
|
||||
|
||||
# _damon, defaults to empty
|
||||
damonConfig = lib.optionals cachyConfig.withDAMON [
|
||||
"-e DAMON"
|
||||
"-e DAMON_VADDR"
|
||||
"-e DAMON_DBGFS"
|
||||
"-e DAMON_SYSFS"
|
||||
"-e DAMON_PADDR"
|
||||
"-e DAMON_RECLAIM"
|
||||
"-e DAMON_LRU_SORT"
|
||||
];
|
||||
|
||||
# _ntsync, defaults to empty
|
||||
ntSyncConfig = lib.optionals cachyConfig.withNTSync [ "-m NTSYNC" ];
|
||||
|
||||
# custom made
|
||||
hdrConfig = lib.optionals cachyConfig.withHDR [ "-e AMD_PRIVATE_COLOR" ];
|
||||
|
||||
# https://github.com/CachyOS/linux-cachyos/issues/187
|
||||
disableDebug =
|
||||
lib.optionals
|
||||
(
|
||||
cachyConfig.withoutDebug && cachyConfig.cpuSched != "sched-ext" && cachyConfig.cpuSched != "cachyos"
|
||||
)
|
||||
[
|
||||
"-d DEBUG_INFO"
|
||||
"-d DEBUG_INFO_BTF"
|
||||
"-d DEBUG_INFO_DWARF4"
|
||||
"-d DEBUG_INFO_DWARF5"
|
||||
"-d PAHOLE_HAS_SPLIT_BTF"
|
||||
"-d DEBUG_INFO_BTF_MODULES"
|
||||
"-d SLUB_DEBUG"
|
||||
"-d PM_DEBUG"
|
||||
"-d PM_ADVANCED_DEBUG"
|
||||
"-d PM_SLEEP_DEBUG"
|
||||
"-d ACPI_DEBUG"
|
||||
"-d SCHED_DEBUG"
|
||||
"-d LATENCYTOP"
|
||||
"-d DEBUG_PREEMPT"
|
||||
];
|
||||
|
||||
configTaste = cachyConfig.taste;
|
||||
|
||||
# Rust toolchain — needed so `make olddefconfig` can probe rustc and set
|
||||
# RUSTC_VERSION correctly, which gates CONFIG_RUST and all rust-dependent
|
||||
# symbols (DRM_ASAHI, APPLE_SEP, etc.)
|
||||
rustNativeBuildInputs = lib.optionals cachyConfig.withRust [
|
||||
rustc
|
||||
rustBindgen
|
||||
];
|
||||
|
||||
in
|
||||
stdenv.mkDerivation (finalAttrs: {
|
||||
inherit src patches;
|
||||
name = "linux-cachyos-config";
|
||||
nativeBuildInputs = kernel.nativeBuildInputs ++ kernel.buildInputs ++ rustNativeBuildInputs;
|
||||
|
||||
# Apply each patch with --forward (skip already-applied/reversed hunks) and
|
||||
# --fuzz=3 (tolerate minor context differences due to kernel version skew).
|
||||
# Use || true so that "hunk ignored" exit-1 from already-merged patches does
|
||||
# not abort the build; genuine failures are still visible in the log.
|
||||
patchPhase = ''
|
||||
runHook prePatch
|
||||
for p in $patches; do
|
||||
echo "applying patch $p"
|
||||
patch -p1 --forward --fuzz=3 < "$p" || true
|
||||
done
|
||||
runHook postPatch
|
||||
'';
|
||||
|
||||
makeFlags = commonMakeFlags;
|
||||
|
||||
env = lib.optionalAttrs cachyConfig.withRust {
|
||||
RUST_LIB_SRC = rustLibSrc;
|
||||
KRUSTFLAGS = "--remap-path-prefix ${rustLibSrc}=/";
|
||||
};
|
||||
|
||||
postPhase = ''
|
||||
${finalAttrs.passthru.extraVerPatch}
|
||||
'';
|
||||
|
||||
buildPhase = ''
|
||||
runHook preBuild
|
||||
|
||||
echo ${cachyConfig.taste}
|
||||
cp "${config-src}/${configTaste}/config" ".config"
|
||||
make $makeFlags olddefconfig
|
||||
patchShebangs scripts/config
|
||||
scripts/config ${lib.concatStringsSep " " pkgbuildConfig}
|
||||
make $makeFlags olddefconfig
|
||||
|
||||
runHook postBuild
|
||||
'';
|
||||
|
||||
installPhase = ''
|
||||
runHook preInstall
|
||||
|
||||
cp .config $out
|
||||
|
||||
runHook postInstall
|
||||
'';
|
||||
|
||||
meta = ogKernelConfigfile.meta // {
|
||||
platforms = [
|
||||
"x86_64-linux"
|
||||
"aarch64-linux"
|
||||
];
|
||||
};
|
||||
|
||||
passthru = {
|
||||
inherit cachyConfig commonMakeFlags stdenv;
|
||||
kernelPatches = patches;
|
||||
extraVerPatch = ''
|
||||
sed -Ei"" 's/EXTRAVERSION = ?(.*)$/EXTRAVERSION = \1${cachyConfig.versions.suffix}/g' Makefile
|
||||
'';
|
||||
};
|
||||
})
|
||||
@@ -1,8 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
set -eu
|
||||
|
||||
#
|
||||
for flavor in cachyos{-gcc,-lto,-lto-full,-server,-hardened,-server-lto,-hardened-lto,-rc,-rc-lto,-lts,-lts-lto}; do
|
||||
cat "$(nom build ".#nixosConfigurations.jallen-nas.pkgs.mjallen.linuxPackages_${flavor}.kernel.kconfigToNix" --no-link --print-out-paths)" \
|
||||
>"/etc/nixos/packages/linux-cachyos/config-nix/x86_64-linux/${flavor}.x86_64-linux.nix"
|
||||
done
|
||||
@@ -1,116 +0,0 @@
|
||||
{
|
||||
writeShellScript,
|
||||
lib,
|
||||
coreutils,
|
||||
findutils,
|
||||
gnugrep,
|
||||
gnused,
|
||||
curl,
|
||||
jq,
|
||||
git,
|
||||
nix,
|
||||
nix-prefetch-git,
|
||||
moreutils,
|
||||
withUpdateScript,
|
||||
}:
|
||||
let
|
||||
path = lib.makeBinPath [
|
||||
coreutils
|
||||
curl
|
||||
findutils
|
||||
gnugrep
|
||||
gnused
|
||||
jq
|
||||
moreutils
|
||||
git
|
||||
nix-prefetch-git
|
||||
nix
|
||||
];
|
||||
|
||||
releaseSrcUrl = "https://cdn.kernel.org/pub/linux/kernel/v6.x/linux-\${latestVer%.0}.tar.xz";
|
||||
|
||||
major =
|
||||
if withUpdateScript == "stable" then
|
||||
{
|
||||
versionsFile = "versions.json";
|
||||
suffix = "";
|
||||
flavors = [
|
||||
"-gcc"
|
||||
"-lto"
|
||||
"-server"
|
||||
];
|
||||
srcUrl = releaseSrcUrl;
|
||||
}
|
||||
else if withUpdateScript == "rc" then
|
||||
{
|
||||
versionsFile = "versions-rc.json";
|
||||
suffix = "-rc";
|
||||
flavors = [ "-rc" ];
|
||||
srcUrl = "https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/snapshot/linux-\${latestVer%.0}.tar.gz";
|
||||
}
|
||||
else if withUpdateScript == "hardened" then
|
||||
{
|
||||
versionsFile = "versions-hardened.json";
|
||||
suffix = "-hardened";
|
||||
flavors = [ "-hardened" ];
|
||||
srcUrl = releaseSrcUrl;
|
||||
}
|
||||
else if withUpdateScript == "lts" then
|
||||
{
|
||||
versionsFile = "versions-lts.json";
|
||||
suffix = "-lts";
|
||||
flavors = [ "-lts" ];
|
||||
srcUrl = releaseSrcUrl;
|
||||
}
|
||||
else
|
||||
throw "Unsupported update-script for linux-cachyos";
|
||||
in
|
||||
with major;
|
||||
writeShellScript "update-cachyos" ''
|
||||
set -euo pipefail
|
||||
PATH=${path}
|
||||
|
||||
srcJson=/etc/nixos/packages/linux-cachyos/${versionsFile}
|
||||
localVer=$(jq -r .linux.version < $srcJson)
|
||||
|
||||
latestVer=$(curl 'https://raw.githubusercontent.com/CachyOS/linux-cachyos/master/linux-cachyos${suffix}/.SRCINFO' | grep -Po '(?<=pkgver = )(.+)$' | sed 's/\.rc/-rc/')
|
||||
|
||||
if [ "$localVer" == "$latestVer" ]; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
latestSha256=$(nix-prefetch-url --type sha256 "${srcUrl}")
|
||||
latestHash=$(nix-hash --to-sri --type sha256 $latestSha256)
|
||||
|
||||
configRepo=$(nix-prefetch-git --quiet 'https://github.com/CachyOS/linux-cachyos.git')
|
||||
configRev=$(echo "$configRepo" | jq -r .rev)
|
||||
configHash=$(echo "$configRepo" | jq -r .hash)
|
||||
configPath=$(echo "$configRepo" | jq -r .path)
|
||||
|
||||
patchesRepo=$(nix-prefetch-git --quiet 'https://github.com/CachyOS/kernel-patches.git')
|
||||
patchesRev=$(echo "$patchesRepo" | jq -r .rev)
|
||||
patchesHash=$(echo "$patchesRepo" | jq -r .hash)
|
||||
|
||||
zfsRev=$(grep -Po '(?<=zfs.git#commit=)([^"]+)' $configPath/linux-cachyos${suffix}/PKGBUILD)
|
||||
zfsRepo=$(nix-prefetch-git --quiet 'https://github.com/CachyOS/zfs.git' --rev $zfsRev)
|
||||
zfsHash=$(echo "$zfsRepo" | jq -r .hash)
|
||||
|
||||
jq \
|
||||
--arg latestVer "$latestVer" --arg latestHash "$latestHash" \
|
||||
--arg configRev "$configRev" --arg configHash "$configHash" \
|
||||
--arg patchesRev "$patchesRev" --arg patchesHash "$patchesHash" \
|
||||
--arg zfsRev "$zfsRev" --arg zfsHash "$zfsHash" \
|
||||
".linux.version = \$latestVer | .linux.hash = \$latestHash |\
|
||||
.config.rev = \$configRev | .config.hash = \$configHash |\
|
||||
.patches.rev = \$patchesRev | .patches.hash = \$patchesHash |\
|
||||
.zfs.rev = \$zfsRev | .zfs.hash = \$zfsHash" \
|
||||
"$srcJson" | sponge "$srcJson"
|
||||
|
||||
${lib.strings.concatMapStrings (flavor: ''
|
||||
cat "$(nix build '.#legacyPackages.x86_64-linux.linuxPackages_cachyos${flavor}.kernel.kconfigToNix' --no-link --print-out-paths)" \
|
||||
> /etc/nixos/packages/linux-cachyos/config-nix/cachyos${flavor}.x86_64-linux.nix || true
|
||||
'') flavors}
|
||||
|
||||
git add /etc/nixos/packages/linux-cachyos
|
||||
git commit -m "linux_cachyos${suffix}: $localVer -> $latestVer"
|
||||
''
|
||||
@@ -1,79 +0,0 @@
|
||||
{
|
||||
"schemaVersion": 1,
|
||||
"variables": {
|
||||
"suffix": "-cachyos"
|
||||
},
|
||||
"sources": {
|
||||
"linux": {
|
||||
"fetcher": "none",
|
||||
"version": "6.19.8",
|
||||
"hash": "sha256-qtpHItuLz6C5cyhRhW1AUIK2pPouOrBnvo2xfN0RWzg="
|
||||
},
|
||||
"config": {
|
||||
"fetcher": "github",
|
||||
"owner": "CachyOS",
|
||||
"repo": "linux-cachyos",
|
||||
"rev": "3b9ae1ae5d4ee95e1509d350b65c0777dde97628",
|
||||
"hash": "sha256-O5Fr6f+iS+IVKdB59yqkCaWfkr1SSHD5BLDDlZO7RwU="
|
||||
},
|
||||
"patches": {
|
||||
"fetcher": "github",
|
||||
"owner": "CachyOS",
|
||||
"repo": "kernel-patches",
|
||||
"rev": "217d964190c29f3785ed379977074ac54248ba8e",
|
||||
"hash": "sha256-jfeXEq2EmwNUdArmUq8gWu4ubneudgoz/6bRS8Zimcw="
|
||||
},
|
||||
"zfs": {
|
||||
"fetcher": "git",
|
||||
"url": "https://github.com/cachyos/zfs.git",
|
||||
"rev": "1c702dda346a59e05cfd3029569bbb1d5d91c54b",
|
||||
"hash": "sha256-gapM2PNVOjhwGw6TAZF6QDxLza7oqOf1tpj7q0EN9Vg="
|
||||
}
|
||||
},
|
||||
"variants": {
|
||||
"asahi": {
|
||||
"sources": {
|
||||
"linux": {
|
||||
"fetcher": "github",
|
||||
"owner": "AsahiLinux",
|
||||
"repo": "linux",
|
||||
"version": "6.18.15",
|
||||
"rev": "asahi-6.18.15-1",
|
||||
"hash": "sha256-A+/tpsog/ku+ujqMSLB+AkrKoUWxYDpoPzC4ESkeqvA="
|
||||
}
|
||||
}
|
||||
},
|
||||
"lts": {
|
||||
"sources": {
|
||||
"linux": {
|
||||
"version": "6.18.18",
|
||||
"hash": "sha256-1iESL16K7Y/Ljljwsy4nkP2Trd6qmFN6HJD/oxjLVXM="
|
||||
}
|
||||
}
|
||||
},
|
||||
"rc": {
|
||||
"sources": {
|
||||
"linux": {
|
||||
"version": "7.0-rc3",
|
||||
"tag": "cachyos-7.0-rc3-1",
|
||||
"hash": "sha256-2kaZ9CQ1dshq7giQDCu4tt0+wIIXhsKRX0cev8QGdFk="
|
||||
}
|
||||
}
|
||||
},
|
||||
"hardened": {
|
||||
"sources": {
|
||||
"linux": {
|
||||
"version": "6.18.18",
|
||||
"hash": "sha256-1iESL16K7Y/Ljljwsy4nkP2Trd6qmFN6HJD/oxjLVXM="
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"notes": {
|
||||
"suffix": "Matches `Add-extra-version-CachyOS.patch`",
|
||||
"linux": "pkgver from config's PKGBUILD",
|
||||
"config": "latest commit from https://github.com/CachyOS/linux-cachyos/commits/master/linux-cachyos",
|
||||
"patches": "latest commit from https://github.com/CachyOS/kernel-patches/commits/master/x.y",
|
||||
"zfs": "search for `git+https://github.com/cachyos/zfs.git` in config's PKGBUILD"
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user