Linux kernel: Difference between revisions

imported>Orbekk
Add an example of overriding linuxPackages (https://github.com/NixOS/nixpkgs/issues/38345)
imported>Thiagokokada
No edit summary
Line 89: Line 89:
               '';
               '';
         } ];
         } ];
}
</syntaxhighlight>
Another way to build a kernel with custom configuration is to create a overlay and use either <tt>extraConfig</tt> or <tt>structuredExtraConfig</tt>. This allows for more flexibility, since you can basically override any kernel option available here <ref>[https://github.com/NixOS/nixpkgs/blob/e6db435973160591fe7348876a5567c729495175/pkgs/os-specific/linux/kernel/generic.nix#L11-L56<tt>pkgs/os-specific/linux/kernel/generic.nix#L11-L56</tt>]</ref>. Using <tt>structuredExtraConfig</tt> is recommended since there is some sanity check if the options you're passing to your kernel is correct. Also, setting <tt>ignoreConfigErrors</tt> is useful to avoid <tt>error: unused option</tt> during build.
<syntaxhighlight lang=nix>
{
  nixpkgs = {
    overlays = [
      (self: super: {
        linuxZenWMuQSS = pkgs.linuxPackagesFor (pkgs.linux_zen.override {
          structuredExtraConfig = with lib.kernel; {
            SCHED_MUQSS = yes;
          };
          ignoreConfigErrors = true;
        });
      })
    ];
  };
}
}
</syntaxhighlight>
</syntaxhighlight>