From f2281f6186ab73006e516bb1976e3271137e6a5d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dominik=20Xaver=20H=C3=B6rl?= Date: Wed, 26 May 2021 13:38:08 +0200 Subject: [PATCH] nixos/boot: properly override the kernel in boot.kernelPatches Previously the code took the kernelPatches of the final derivation, which might or might not be what was passed to the derivation in the original call. The previous behaviour caused various hacks to become neccessary to avoid duplicates in kernelPatches. (cherry picked from commit 436f61c878e3992b3d980168a5532416dd5be504) --- nixos/modules/system/boot/kernel.nix | 6 +++--- pkgs/os-specific/linux/kernel/linux-rt-5.10.nix | 2 +- pkgs/os-specific/linux/kernel/linux-rt-5.11.nix | 2 +- pkgs/os-specific/linux/kernel/linux-rt-5.4.nix | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/nixos/modules/system/boot/kernel.nix b/nixos/modules/system/boot/kernel.nix index 363d8e47a0ff..1a6a9d99d5bb 100644 --- a/nixos/modules/system/boot/kernel.nix +++ b/nixos/modules/system/boot/kernel.nix @@ -38,11 +38,11 @@ in default = pkgs.linuxPackages; type = types.unspecified // { merge = mergeEqualOption; }; apply = kernelPackages: kernelPackages.extend (self: super: { - kernel = super.kernel.override { + kernel = super.kernel.override (originalArgs: { inherit randstructSeed; - kernelPatches = super.kernel.kernelPatches ++ kernelPatches; + kernelPatches = (originalArgs.kernelPatches or []) ++ kernelPatches; features = lib.recursiveUpdate super.kernel.features features; - }; + }); }); # We don't want to evaluate all of linuxPackages for the manual # - some of it might not even evaluate correctly. diff --git a/pkgs/os-specific/linux/kernel/linux-rt-5.10.nix b/pkgs/os-specific/linux/kernel/linux-rt-5.10.nix index 78d1155e8ed7..6ef781f6095c 100644 --- a/pkgs/os-specific/linux/kernel/linux-rt-5.10.nix +++ b/pkgs/os-specific/linux/kernel/linux-rt-5.10.nix @@ -27,7 +27,7 @@ in buildLinux (args // { url = "mirror://kernel/linux/kernel/projects/rt/${branch}/older/patch-${version}.patch.xz"; sha256 = "0szqm9f939p9z701i5hj881nf5bhfa0a6037bbcz974y0x8g9nmk"; }; - }; in [ rt-patch ] ++ lib.remove rt-patch kernelPatches; + }; in [ rt-patch ] ++ kernelPatches; structuredExtraConfig = with lib.kernel; { PREEMPT_RT = yes; diff --git a/pkgs/os-specific/linux/kernel/linux-rt-5.11.nix b/pkgs/os-specific/linux/kernel/linux-rt-5.11.nix index d9ebedf68016..5d1b14f1d0f0 100644 --- a/pkgs/os-specific/linux/kernel/linux-rt-5.11.nix +++ b/pkgs/os-specific/linux/kernel/linux-rt-5.11.nix @@ -27,7 +27,7 @@ in buildLinux (args // { url = "mirror://kernel/linux/kernel/projects/rt/${branch}/older/patch-${version}.patch.xz"; sha256 = "1az6cn9jj3bnjgwzzrjy1adnrnn06p2vzsnc1iib4xhs0sfr27hc"; }; - }; in [ rt-patch ] ++ lib.remove rt-patch kernelPatches; + }; in [ rt-patch ] ++ kernelPatches; structuredExtraConfig = with lib.kernel; { PREEMPT_RT = yes; diff --git a/pkgs/os-specific/linux/kernel/linux-rt-5.4.nix b/pkgs/os-specific/linux/kernel/linux-rt-5.4.nix index ec065e6833e2..7be45dc3e683 100644 --- a/pkgs/os-specific/linux/kernel/linux-rt-5.4.nix +++ b/pkgs/os-specific/linux/kernel/linux-rt-5.4.nix @@ -23,7 +23,7 @@ in buildLinux (args // { url = "mirror://kernel/linux/kernel/projects/rt/${branch}/older/patch-${version}.patch.xz"; sha256 = "0prfrvk2ds20sclikizzgg5qf4mfcyaymp9r272d5nj35293622n"; }; - }; in [ rt-patch ] ++ lib.remove rt-patch kernelPatches; + }; in [ rt-patch ] ++ kernelPatches; structuredExtraConfig = with lib.kernel; { PREEMPT_RT = yes;