I'm using raspberry-pi-nix as part of a flake and would like to override the kernel to apply the realtime kernel patches and enable PREEMPT_RT-related config options. I've tried a bunch of different ways of applying overlays to accomplish this, but nothing seems to be working. Here's a snippet of an overlay applied to nixpkgs.
nixpkgs.overlays = [
(final: prev: {
rpi-kernels.v6_6_54.bcm2712 = prev.rpi-kernels.v6_6_54.bcm2712.override (prevKernel: {
structuredExtraConfig = with prev.lib.kernel; {
SND_HDA_GENERIC = yes;
SND_HDA_INTEL = yes;
SND_HDA_PREALLOC_SIZE = 2048;
# realtime
# PREEMPT_RT was merged in to kernel 6.12.
# https://github.com/NixOS/nixpkgs/blob/master/pkgs/os-specific/linux/kernel/linux-rt-6.1.nix
PREEMPT_RT = yes;
EXPERT = yes; # PREEMPT_RT depends on it (in kernel/Kconfig.preempt)
# Fix error: option not set correctly: PREEMPT_VOLUNTARY (wanted 'y', got 'n').
PREEMPT_VOLUNTARY = prev.lib.mkForce no; # PREEMPT_RT deselects it.
# Fix error: unused option: RT_GROUP_SCHED.
RT_GROUP_SCHED = prev.lib.mkForce (option no); # Removed by sched-disable-rt-group-sched-on-rt.patch.
VIRTUALIZATION = no;
};
kernelPatches = let rt-patch = {
name = "rt";
patch = prev.fetchurl {
url = "mirror://kernel/linux/kernel/projects/rt/${prevKernel.branch}/older/patch-${prevKernel.version}.patch.xz";
sha256 = prev.lib.fakeHash;
};
}; in [ rt-patch ] ++ prevKernel.kernelPatches;
});
})
];
I'm using
raspberry-pi-nix
as part of a flake and would like to override the kernel to apply the realtime kernel patches and enablePREEMPT_RT
-related config options. I've tried a bunch of different ways of applying overlays to accomplish this, but nothing seems to be working. Here's a snippet of an overlay applied tonixpkgs
.