From 78f915a0025a594b334bccd3a56023d5c6f8310c Mon Sep 17 00:00:00 2001 From: Edmund Wu Date: Thu, 14 May 2020 22:08:26 -0400 Subject: [PATCH] nixos/kernel.nix: ensure same kernel is used Originally, changes to the kernel don't propagate to the other derivation within the same package set. This commit allows for the changes in the kernel to be propagated. A distinct example is setting `boot.kernel.randstructSeed` to a non-zero length string which would result in building 2 kernels, one with the correct seed and the other with the zero length seed. Then, when using an out-of-tree kernel driver, it would be built with the zero length seed which differs from the non-zero length seed used to boot, contradicting the purpose of the `boot.kernel.randstructSeed`. --- nixos/modules/system/boot/kernel.nix | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/nixos/modules/system/boot/kernel.nix b/nixos/modules/system/boot/kernel.nix index ed7226331d7..9287852bacf 100644 --- a/nixos/modules/system/boot/kernel.nix +++ b/nixos/modules/system/boot/kernel.nix @@ -37,12 +37,10 @@ in boot.kernelPackages = mkOption { default = pkgs.linuxPackages; type = types.unspecified // { merge = mergeEqualOption; }; - apply = kernelPackages: kernelPackages.extend (self: super: { - kernel = super.kernel.override { - inherit randstructSeed; - kernelPatches = super.kernel.kernelPatches ++ kernelPatches; - features = lib.recursiveUpdate super.kernel.features features; - }; + apply = kernelPackages: pkgs.linuxPackagesFor (kernelPackages.kernel.override { + inherit randstructSeed; + kernelPatches = kernelPackages.kernel.kernelPatches ++ kernelPatches; + features = lib.recursiveUpdate kernelPackages.kernel.features features; }); # We don't want to evaluate all of linuxPackages for the manual # - some of it might not even evaluate correctly.