tpwrules / nixos-apple-silicon

Resources to install NixOS bare metal on Apple Silicon Macs
MIT License
872 stars 88 forks source link

Kernel custom configuration #238

Open lloeki opened 1 month ago

lloeki commented 1 month ago

It seems like some people are interested in having some tunability of kernel configuration:

Usually this is done via configuration.nix's boot.kernelPatches (wiki) but it looks like the linux-asahi package is using that: https://github.com/tpwrules/nixos-apple-silicon/blob/c5f944f49a052232015bb3c03524b69e3fdd2aa4/apple-silicon-support/packages/linux-asahi/default.nix#L101

In the code I see this: https://github.com/tpwrules/nixos-apple-silicon/blob/c5f944f49a052232015bb3c03524b69e3fdd2aa4/apple-silicon-support/modules/kernel/default.nix#L10

Which AIUI is referenced here, appended to linuxKernel.manualConfig's kernelPatches: https://github.com/tpwrules/nixos-apple-silicon/blob/c5f944f49a052232015bb3c03524b69e3fdd2aa4/apple-silicon-support/packages/linux-asahi/default.nix#L105

So am I correct that something like the following in configuration.nix would work?

{
      boot.kernelPatches = [
        {
          name = "btrfs-config";
          patch = null;
          extraConfig = ''
                  BTRFS_DEBUG y
                '';
        }
        {
          name = "bcachefs-config";
          patch = null;
          extraConfig = ''
                  BCACHEFS_FS y
                '';
        }
      ];
}