1{ config, pkgs, lib, ... }:
2
3let
4 configfile = builtins.storePath (builtins.toFile "config" (lib.concatStringsSep "\n"
5 (map (builtins.getAttr "configLine") config.system.requiredKernelConfig))
6 );
7
8 origKernel = pkgs.buildLinux {
9 inherit (pkgs.linux) src version;
10 inherit configfile;
11 allowImportFromDerivation = true;
12 kernelPatches = [ pkgs.kernelPatches.cifs_timeout_2_6_38 ];
13 };
14
15 kernel = origKernel // (derivation (origKernel.drvAttrs // {
16 configurePhase = ''
17 runHook preConfigure
18 mkdir ../build
19 make $makeFlags "''${makeFlagsArray[@]}" mrproper
20 make $makeFlags "''${makeFlagsArray[@]}" KCONFIG_ALLCONFIG=${configfile} allnoconfig
21 runHook postConfigure
22 '';
23 }));
24
25 kernelPackages = pkgs.linuxPackagesFor kernel;
26in {
27 boot.kernelPackages = kernelPackages;
28}