Build linux with custom kernel config

Hello everyone,

I’m new to nix and I need to build the linux kernel using a custom config. Not a defconfig. Just use a specific config file to build. I’m on nixos 18.09 and looking at the source of buildLinux there is only a way to specifiy a defconfig file or extraConfig. How can I use a specific config file to build a linux kernel?

1 Like

was going to point you at Linux kernel - NixOS Wiki but I realize there is no example for a .config yet. Bottomline is you want to use linuxManualConfig. From my overlay:

  linux_mptcp_trunk = (prev.linuxManualConfig {
    inherit (prev) stdenv;
    inherit (linux_mptcp_trunk_raw) src version modDirVersion;

    configfile = ./kernels/mptcp_trunk_netlink.config;
    # we need this to true else the kernel can't parse the config and 
    # detect if modules are in used
    allowImportFromDerivation = true;

  }).overrideAttrs (oa: {
    shellHook = ''
      touch .scmversion
      echo "hello boss"
    '';
  });
1 Like

well even better than the wiki, the official doc NixOS 23.11 manual | Nix & NixOS xD

1 Like