Change:
in '' mkdir -p $out/etc/udev/rules.d/ <del> ./tools/sane-desc -m udev > $out/etc/udev/rules.d/49-libsane.rules ||  </del> <ins> ./tools/sane-desc -m udev+hwdb -s doc/descriptions:doc/descriptions-external > $out/etc/udev/rules.d/49-libsane.rules ||  </ins> cp tools/udev/libsane.rules $out/etc/udev/rules.d/49-libsane.rules # the created 49-libsane references /bin/sh substituteInPlace $out/etc/udev/rules.d/49-libsane.rules 

Discussion:
When is enabled, my printer is not recognized by . Initially, when the option was not enabled, my printer would immediately get recognized upon plugging in the USB, show up in the Printers section in , and printing also works fine. After enabling SANE, the printer is not recognized, but the in-built scanner gets recognized and works properly in apps like . After disabling it and running , the printer is again immediately recognized, but obviously the scanner doesn't work. Configuration: Both the printer and scanner must function and get recognized properly when the above-mentioned configuration is applied. SANE did not give any errors Error after enabling : After disabling it, the printer gets recognized: Based on commit history for the SANE and modules Printer: CANON Pixma MG 2570 Driver: CUPS+Gutenprint v5.3.4
that is extremely puzzling, as sane is enabled or disabled though an environment variable that cannot be changed by a mere nixos-rebuild switch. you need to reboot or to logout/login to effectively toggle it.
Yes. initially, in order to enable the scanning functionality, a reboot was required. But the connection to the printer was established by simply disabling the option and rebuilding
Without lookling deeper into this, are you sure it’s not just a random coincidence? Were you setting up printing and scanning in the same session? Maybe you changed something else in-between.
Just tried it again today, same results
I have the same issue.
Pretty sure it's a permission problem. With cups enabled: With sane, saned and cups enabled: After a reboot, permissions are back to the first case. I guess there's a problem with sane's udev rules. Update: Sane or saned define udev rules that change the group of printer device nodes. I've tried setting , but libusb seems to do extra permission checking beyond the device nodes, so this doesn't allow cups to print.
Nice find! Do I understand correctly that when the device is owned by lp scanning does not work and when it is owned by scanner printing does not work?
Hello! Yes. From my understanding of , generates udev rules for every "scanner" device that changes the group permissions of device nodes to "scanner". This does not work for multifunction devices, as Cups expects device nodes to be accessible via the "lp" group.

I've created a quick fix for this by overriding the derivation to delete its udev rules. Note that SANE is set up for device nodes being owned by the group (seems to be implied by . I've worked around this by overriding sane backends to delete the udev rules: This is a temporary fix, but I don't know what the "proper" way to do this would be.
Ok so when the device is owned by lp, it also works with the scanner. Reading you it looks like an issue with upstream udev rules, I wonder if filing a bug upstream is warranted.
Seems to be a known issue:
Looks like is the proper solution. would you mind giving it a try? It's hard to test without affected hardware...
Turns out the command was never run, and the rules were just copied from the sane source. requires a search path to find description files. After patching via rules are indeed generated, and the owner isn't changed.
Sounds nice. Would you mind opening a PR?
I went ahead and created , due to lack of response.
this was fixed, but incorrectly, in . A fix to the fix is in , it would be nice if people affected by this can test it.
Still works for me, tested printing & scanning with the following overlay:
Closing since it sounds like some combination of and fixed this, but I'm happy to reopen if I'm misunderstanding.