Despite extensive troubleshooting, I’m unable to get my Brother DCP-L2530DW network scanner (IP: 192.168.0.139) working on NixOS. The core issue appears to be that the sane-backends package on my system is not correctly configured to find the brscan4 driver (libsane-brother4.so.1).
** Input file **
My nixos input file look like:
# nixos/modules/services/printing.nix
{
lib,
pkgs,
...
}: {
##############################################################################
# System-wide CUPS setup with a fixed IPP queue for Brother DCP-L2530DW
##############################################################################
services.printing = {
enable = true;
webInterface = true; # CUPS UI: http://localhost:631
drivers = with pkgs; [
gutenprint # generic drivers
brlaser # Brother open driver (backup)
];
browsed.enable = false; # we use a fixed queue, not autodiscovery
};
# mDNS/Avahi optional but harmless
services.avahi = {
enable = true;
nssmdns4 = true;
openFirewall = true;
};
##############################################################################
# Declarative printer queue
##############################################################################
hardware.printers = {
ensureDefaultPrinter = "Brother_DCP_L2530DW";
ensurePrinters = [
{
name = "Brother_DCP_L2530DW";
# ip of wifi at the first floor
deviceUri = "ipp://192.168.0.139/ipp/print";
model = "everywhere"; # IPP Everywhere (driverless)
ppdOptions = {
PageSize = "A4";
Duplex = "DuplexNoTumble"; # long-edge duplex on A4
};
}
];
};
##############################################################################
# Ensure printers service waits for network and retries
##############################################################################
systemd.services.ensure-printers = {
after = ["NetworkManager-wait-online.service" "cups.service"];
wants = ["NetworkManager-wait-online.service" "cups.service"];
wantedBy = ["multi-user.target"];
unitConfig = {
StartLimitIntervalSec = "0";
};
serviceConfig = {
Restart = "on-failure";
RestartSec = "15s";
SuccessExitStatus = [0];
};
};
##############################################################################
# SANE (Scanner Access Now Easy) configuration for Brother DCP-L2530DW
##############################################################################
hardware.sane = {
enable = true;
# Brother-specific SANE backend
brscan4 = {
enable = true;
netDevices = {
"Brother_DCP_L2530DW" = {
model = "DCP-L2530DW";
ip = "192.168.0.139";
};
};
};
# sane-airscan is a universal driver for modern network scanners (eSCL/WSD)
# extraBackends = [ pkgs.sane-airscan ];
};
# sane-airscan uses mDNS (Avahi, already enabled) for discovery.
# No extra firewall ports are typically needed if Avahi is correctly set up
# with openFirewall = true.
}
The printer looks fine and works. but my scanner cannot be reached.
Troubleshooting Steps Taken:
- Initial Attempt with
sane-airscan:airscan-discoverfound no devices. - Switched to
brscan4: Identifiedbrscan4as the correct driver for the scanner. - NixOS Configuration Attempts:
- Enabled
hardware.sane.brscan4module innixos/modules/services/printing.nix. - Attempted to use
hardware.sane.extraBackends = [ "brother4" ];. - Added
brscan4toenvironment.systemPackages.
- Enabled
- Network Configuration: Confirmed scanner is reachable on the network.
- SANE Debugging: Used
SANE_DEBUG_DLL=255 SANE_DEBUG_BRSCAN4=255 scanimage -Lto diagnose.- Critical Finding: Debug logs consistently show
couldn't find backend 'brother4'errors. Thescanimagewrapper provided by NixOS does not seem to include the necessary path forlibsane-brother4.so.1in its library search paths.
- Critical Finding: Debug logs consistently show
- Manual Path Forcing: Attempted to set
SANE_PATHenvironment variable, but this was ignored by the wrappedscanimagecommand. - Configuration Files:
etc/sane-config/dll.confcorrectly listsbrother4.- Removed a lingering
airscanconfig frometc/sane-config/dll.d/.
Conclusion:
All attempts to configure the brscan4 driver via standard NixOS options and manual environment variable manipulation have failed. This strongly suggests a deeper, build-time issue within my specific NixOS flake configuration, where the sane-backends package is not being wrapped or built with the correct library search paths for the brscan4 backend.
Request for Assistance:
I am seeking assistance from the NixOS community to understand why the sane-backends package is failing to locate the brscan4 driver, despite being explicitly enabled and configured.
Please find the full SANE debug log attached/pasted below for detailed analysis.