How to tell kernel to use a custom modeline?

My monitor has a weird resolution. I can active a custom modeline for Xorg like this:

screen_name="1840x1035(60Hz)"
device_name=DP-2
xrandr --newmode $screen_name 158.50  1840 1960 2152 2464  1035 1038 1043 1074 -hsync +vsync
xrandr --addmode $device_name $screen_name
xrandr --output $device_name --primary --mode $screen_name --pos 0x0 --rotate normal

However, my boot console, ttys and sway can’t use the above modeline. I guess I have to generate an edid binary for that mode and tell kernel to use that binary, but can’t find a nixos option for that.

I guess you could create your own package which copies the custom edid file into $out/lib/firmware then add that package in hardware.firmware and add something like drm_kms_helper.edid_firmware=DP-2:edid/your_edid.bin (stolen from the arch wiki entry ) to the kernel command line in boot.kernelParams.

Thank you very much.
I could make the kernel to load the firmware. Too bad kernel complained the generated edid file is somehow invalid :frowning: