Bumping because I’m a complete nixos novice and ran into the same issue. I have a monitor that requires a custom edid binary and so far everything looked good up until
boot.initrd.extraFiles."lib/firmware/edid/dell_u2412m_edid.bin".source =
pkgs.runCommandNoCC "dell-u2412-edid" {} "cp ${./dell_u2412m_edid.bin.src} $out";
For reference, I got this snippet from this github issue.
The result of sudo nixos-rebuild switch
is
building Nix...
building the system configuration...
these 3 derivations will be built:
/nix/store/k0f58n3pnk78vlxwqfbyp9wb9amxkq3f-initrd-linux-6.6.36.drv
/nix/store/q4iyp68xwxn473r2w56b0s1w1nkg56q6-boot.json.drv
/nix/store/16v6wlqzgla023gldcjgixh258xrf04x-nixos-system-beta-24.05.2472.c0d0be00d4ec.drv
building '/nix/store/k0f58n3pnk78vlxwqfbyp9wb9amxkq3f-initrd-linux-6.6.36.drv'...
mkdir: cannot create directory 'root/lib/firmware/edid': Permission denied
error: builder for '/nix/store/k0f58n3pnk78vlxwqfbyp9wb9amxkq3f-initrd-linux-6.6.36.drv' failed with exit code 1
error: 1 dependencies of derivation '/nix/store/16v6wlqzgla023gldcjgixh258xrf04x-nixos-system-beta-24.05.2472.c0d0be00d4ec.drv' failed to build
I might note that
hardware.firmware = [
(pkgs.runCommandNoCC "dell-u2414-edid" { compressFirmware = false; } ''
mkdir -p $out/lib/firmware/edid/
cp ${./dell_u2412m_edid.bin.src} $out/lib/firmware/edid/dell_u2412m_edid.bin
'')
];
gets the binary into /run/current-system/firmware/edid
but ends up giving me error=-22
in the logs, hence why I think I need it in initrd.
Hoping this bump will catch the eye of someone more experienced.
EDIT: I should have paid more attention to the very last reply in this post on the topic.
From what I gather now, hardware.firmware
is the preferred way of modifying firmware (who would have guessed,) so the last snippet was actually correct. It just turns out that error=-22
means firmware could not be found because the kernel is not compiled with other search paths (for a lack of a better term.) The snippet I reproduce here should do the trick:
boot.kernelPatches = [
{
name = "edid-loader-fix-config";
patch = null;
extraConfig = ''
FW_LOADER y
'';
}
];
From the linked github issue, it seems that nixos will eventually get this upstream sometime in the future.
In any case, this worked for me. Hoping this helps anyone else.