Samsung scanner CLX-3185

Hi,

has anyone been able to use the scanner function of the CLX-3185 multifunction printer with nixos (or with any other Samsung CLX series scanner/printer )?

I’ve been following Scanners - NixOS Wiki and tried several options, but still no scanner available.

Thx

Hi,

how can I remove a kernel module from the blacklist in configuration.nix ?

I want to try if I can access to my samsung scanner by removing usblp from the blacklisted modules

Thx

  boot.blacklistedKernelModules = lib.mkForce [ ];

Will make it an empty list despite the other module’s config.

I’d check whether other modules put some values into the list beforehand though.

Thx for the answer.

But even with the usblp module loaded, I still can’t use my scanner. I’ve a working configuration on Fedora with that scanner, still not figured out what’s different between my nixos config and fedora. But I don’t give up :smiley:

Hi,

I finally found a hack to use the scanner.

I added the following line
tcp 192.168.1.240
at the end of the file
/nix/store/**hash**-sane-config/etc/sane.d/xerox_mfp.conf
192.168.1.240 is of course the ip of my multifunction printer

the result of scanimage -L is now
device xerox_mfp:tcp 192.168.1.240 is a Samsung Samsung CLX-3180 Series multi-function peripheral

I’m now able to use my scanner, but this isn’t a long term solution.

Any ideas how to convert this hack into a nixos configuration ?

Thx

Which module generates that file and puts it in your env?

Have you tried this option?

Hi,
I was able to look at my issue again. The files are installed by sane-backends

I tried to add the line tcp 192.168.1.240 to the xerox_mfp.conf file with the following overlay

(final: prev: {
  sane-backends = prev.sane-backends.overrideAttrs (oldAttrs: {
    postInstall = (oldAttrs.postInstall or "") + ''
        FILE=$SANE_CONFIG_DIR/xerox_mfp.conf
        IP=192.168.1.240

        if [[ -f "$FILE" ]]; then
            if ! grep -Fxq "tcp $IP" $FILE; then
                echo "tcp $IP" >> $FILE
            fi
        fi
    '';
  });
})

But sane-backends is linked to multiple packages (libreoffice, gnome…) so everything has to be recompiled.

Is there another solution to add this line without having to recompile everything ?

Thx

You’d want a more targeted approach; only override sane-backends in the package which need it rather than globally.

Which package would that be and where is it actually used (is it a daemon or a library? Who uses the library?)

sane-backends is installed if I enable the option hardware.sane.enable

option declared in this module https://github.com/NixOS/nixpkgs/blob/c93e5ab157b45adbb6165bd85a9d8f67e49ff31d/nixos/modules/services/hardware/sane.nix#L38

https://github.com/NixOS/nixpkgs/blob/c93e5ab157b45adbb6165bd85a9d8f67e49ff31d/nixos/modules/services/hardware/sane.nix#L7-L10 declares the package used for saned.

As a proof of concept, rebuild your system from a local Nixpkgs checkout and apply your override to that package.

Hi,
I finally found some time to tinker with nixos, and I came up with a configuration that allows me to use my scanner.

  hardware.sane = {
    enable = true;
    extraBackends = [
      (pkgs.runCommand "my-xerox_mfp.conf" { } ''
        mkdir -p "$out/etc/sane.d"
        echo "tcp 192.168.1.240" >> "$out/etc/sane.d/xerox_mfp.conf"
      '')
    ];
  };

but I have a warning when I build my configuration

warning: conflict for /nix/store/agk41d73x62brm88lcc0p699rvnxac9i-sane-config/etc/sane.d/xerox_mfp.conf. Overriding /nix/store/s6s1cpsqpspg43dv1wrangkabwm1hb6r-sane-backends-1.1.1/etc/sane.d/xerox_mfp.conf with /nix/store/fya6v9ryca6jivdzy8s0086pbhsbjd0g-my-xerox_mfp.conf/etc/sane.d/xerox_mfp.conf.

Question : is there a way to merge these two versions of xerox_mfp.conf files ?

It took me a while, but I finally managed to implement your solution (my son helped me to understand how it all works :sweat_smile: )

I disabled the sane module in my configuration.nix

  disabledModules = [ "services/hardware/sane.nix" ];

and imported a local version of the module

   imports = [ ./sane.nix ];

and in my local version I did an overrideAttrs

  pkg = (pkgs.sane-backends.override {
    scanSnapDriversUnfree = config.hardware.sane.drivers.scanSnap.enable;
    scanSnapDriversPackage = config.hardware.sane.drivers.scanSnap.package;
  }).overrideAttrs (final: prev: {
    postInstall = ''
      ${prev.postInstall}
      echo "tcp 192.168.1.240" >> $out/etc/sane.d/xerox_mfp.conf
    '';
  });