Linux kernel: Difference between revisions

imported>Mth
mNo edit summary
imported>Tfc
Add make-linux-fast-again script
Line 42: Line 42:
{
{
   boot.extraModulePackages = with config.boot.kernelPackages; [ wireguard ];
   boot.extraModulePackages = with config.boot.kernelPackages; [ wireguard ];
}
</syntaxHighlight>
=== Custom kernel commandline ===
The config attribute <code>boot.kernelParams</code> can be set to supply the Linux kernel with additional command line arguments at boot time.
The following example downloads command line arguments from [https://make-linux-fast-again.com make-linux-fast-again.com] that are known to disable CPU vulnerability mitigations that have a negative performance impact on the system:
<syntaxHighlight lang="nix">
# file: make-linux-fast-again.nix
{ pkgs, config, ... }:
let
  cmdline = builtins.readFile (
    builtins.fetchurl "https://make-linux-fast-again.com"
  );
in {
  boot.kernelParams = pkgs.lib.splitString " " cmdline;
}
</syntaxHighlight>
The easiest way to use this is to store this file in the <code>/etc/nixos</code> folder and then put it into the <code>imports</code> list in <code>/etc/nixos/configuration.nix</code> file like this:
<syntaxHighlight lang="nix">
{ pkgs, config, ... }:
{
  imports = [
    ./make-linux-fast-again.nix
  ];
 
  # ...
}
}
</syntaxHighlight>
</syntaxHighlight>