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?

was going to point you at https://nixos.wiki/wiki/Linux_kernel 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 https://nixos.org/nixos/manual/index.html#sec-linux-config-customizing xD