Way to profide .config file in cutom kernel build

Hi,

Is there any way to provide a correct .config file to build a custom kernel
in nixos? Currently I set my configuration.nix to build the latest LTS hardened
kernel by using:

[...]
  boot.kernelPackages = let
      linux_hardened_pkg = { fetchurl, buildLinux, ... } @ args:

        buildLinux (args // rec {
          version = "5.10.92-hardened1";
          modDirVersion = version;

          src = fetchurl {
            url = "https://github.com/anthraxx/linux-hardened/archive/refs/tags/5.10.92-hardened1.tar.gz";
            sha256 = "be8fab989a432906c71c13c43a120a290730df040b1e89dec14e97121506a7f3";
          };
          kernelPatches = [];

          extraConfig = ''
                  '';

          extraMeta.branch = "5.10";
        } // (args.argsOverride or {}));
      linux_hardened = pkgs.callPackage linux_hardened_pkg{};
    in 
      pkgs.recurseIntoAttrs (pkgs.linuxPackagesFor linux_hardened);
[...]

And it works fine, but when I put my kernel configs in the extraConfig section I run
into a war field of errors, like failing the parse the end of file, or values that are set
and resolve to ‘n’, between other dragons.

Thanks!

maybe clues there?

Looks like I have to provide all configs one by one, I’d rather ask for
sourcing the full .config file. Is it possible? I’m evaluating to port an
existing platform based in buildroot to nixos, and I want to have same
kernel with configs.

Something like this may make it, though I fail to find
further documentation how to use it. Any hints?

Edited: false alarm, that seems to be to modify the make target for defconfig, which is
not about generating your own file and providing it as a defconfig, so not an option.

Thanks!

This one it is! though I certainly don’t have any idea how to specify
a manual config for the kernel I’m looking for, any help appreciated.

There is a section Customize your kernel in NixOS’ manual showing how to use manualConfig.

1 Like
Hosted by Flying Circus.