at 23.11-beta 116 lines 3.8 kB view raw
1{ lib, stdenv, fetchFromGitHub, buildLinux, ... } @ args: 2 3let 4 # comments with variant added for update script 5 # ./update-zen.py zen 6 zenVariant = { 7 version = "6.6.1"; #zen 8 suffix = "zen1"; #zen 9 sha256 = "13m820wggf6pkp351w06mdn2lfcwbn08ydwksyxilqb88vmr0lpq"; #zen 10 isLqx = false; 11 }; 12 # ./update-zen.py lqx 13 lqxVariant = { 14 version = "6.5.11"; #lqx 15 suffix = "lqx2"; #lqx 16 sha256 = "0rak2ald95bwb5qlp8pf2g93a0gkv8rypiv5s8dpds3cilwmxrg9"; #lqx 17 isLqx = true; 18 }; 19 zenKernelsFor = { version, suffix, sha256, isLqx }: buildLinux (args // { 20 inherit version; 21 modDirVersion = lib.versions.pad 3 "${version}-${suffix}"; 22 isZen = true; 23 24 src = fetchFromGitHub { 25 owner = "zen-kernel"; 26 repo = "zen-kernel"; 27 rev = "v${version}-${suffix}"; 28 inherit sha256; 29 }; 30 31 # This is based on the following sources: 32 # - zen: https://gitlab.archlinux.org/archlinux/packaging/packages/linux-zen/-/blob/main/config 33 # - lqx: https://github.com/damentz/liquorix-package/blob/6.4/master/linux-liquorix/debian/config/kernelarch-x86/config-arch-64 34 # - Liquorix features: https://liquorix.net/ 35 # The list below is not exhaustive, so the kernels probably doesn't match 36 # the upstream, but should bring most of the improvements that will be 37 # expected by users 38 structuredExtraConfig = with lib.kernel; { 39 # Zen Interactive tuning 40 ZEN_INTERACTIVE = yes; 41 42 # FQ-Codel Packet Scheduling 43 NET_SCH_DEFAULT = yes; 44 DEFAULT_FQ_CODEL = yes; 45 DEFAULT_NET_SCH = freeform "fq_codel"; 46 47 # Preempt (low-latency) 48 PREEMPT = lib.mkOverride 60 yes; 49 PREEMPT_VOLUNTARY = lib.mkOverride 60 no; 50 51 # Preemptible tree-based hierarchical RCU 52 TREE_RCU = yes; 53 PREEMPT_RCU = yes; 54 RCU_EXPERT = yes; 55 TREE_SRCU = yes; 56 TASKS_RCU_GENERIC = yes; 57 TASKS_RCU = yes; 58 TASKS_RUDE_RCU = yes; 59 TASKS_TRACE_RCU = yes; 60 RCU_STALL_COMMON = yes; 61 RCU_NEED_SEGCBLIST = yes; 62 RCU_FANOUT = freeform "64"; 63 RCU_FANOUT_LEAF = freeform "16"; 64 RCU_BOOST = yes; 65 RCU_BOOST_DELAY = freeform "500"; 66 RCU_NOCB_CPU = yes; 67 RCU_LAZY = yes; 68 69 # Futex WAIT_MULTIPLE implementation for Wine / Proton Fsync. 70 FUTEX = yes; 71 FUTEX_PI = yes; 72 73 # Preemptive Full Tickless Kernel at 1000Hz 74 HZ = freeform "1000"; 75 HZ_1000 = yes; 76 } // lib.optionalAttrs (isLqx) { 77 # Google's BBRv3 TCP congestion Control 78 TCP_CONG_BBR = yes; 79 DEFAULT_BBR = yes; 80 DEFAULT_TCP_CONG = freeform "bbr"; 81 82 # PDS Process Scheduler 83 SCHED_ALT = yes; 84 SCHED_PDS = yes; 85 86 # Swap storage is compressed with LZ4 using zswap 87 ZSWAP_COMPRESSOR_DEFAULT_LZ4 = yes; 88 ZSWAP_COMPRESSOR_DEFAULT = freeform "lz4"; 89 90 # Fix error: unused option: XXX. 91 CFS_BANDWIDTH = lib.mkForce (option no); 92 PSI = lib.mkForce (option no); 93 RT_GROUP_SCHED = lib.mkForce (option no); 94 SCHED_AUTOGROUP = lib.mkForce (option no); 95 SCHED_CORE = lib.mkForce (option no); 96 97 # ERROR: modpost: "sched_numa_hop_mask" [drivers/net/ethernet/mellanox/mlx5/core/mlx5_core.ko] undefined! 98 MLX5_CORE = no; 99 }; 100 101 passthru.updateScript = [ ./update-zen.py (if isLqx then "lqx" else "zen") ]; 102 103 extraMeta = { 104 branch = lib.versions.majorMinor version + "/master"; 105 maintainers = with lib.maintainers; [ thiagokokada jerrysm64 ]; 106 description = "Built using the best configuration and kernel sources for desktop, multimedia, and gaming workloads." + 107 lib.optionalString isLqx " (Same as linux_zen, but less aggressive release schedule and additional extra config)"; 108 broken = stdenv.isAarch64; 109 }; 110 111 } // (args.argsOverride or { })); 112in 113{ 114 zen = zenKernelsFor zenVariant; 115 lqx = zenKernelsFor lqxVariant; 116}