Linux kernel: Difference between revisions

imported>Tfc
Add make-linux-fast-again script
imported>Samueldr
Removes the possibly dangerous snippet
Line 49: Line 49:
The config attribute <code>boot.kernelParams</code> can be set to supply the Linux kernel with additional command line arguments at boot time.
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">
<syntaxHighlight lang="nix">
# file: make-linux-fast-again.nix
{ pkgs, config, ... }:
{ pkgs, config, ... }:


let
{
  cmdline = builtins.readFile (
   boot.kernelParams = [ /* list of command line arguments */ ];
    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>