NixOS / nixpkgs

Nix Packages collection & NixOS
MIT License
17.58k stars 13.74k forks source link

SANE module should allow editing backend configs #17411

Closed michalrus closed 4 years ago

michalrus commented 8 years ago

Issue description

Some SANE backends require additional configuration, e.g. an address of a network scanner.

Currently I’m using my custom module — https://github.com/michalrus/dotfiles/commit/d943be3089aa436e07cea5f22d829402936a9229 — to configure Sane on various devices. Using it, you can do:

{
  hardware.sane.extraConfig = {
    "some-backend" = ''
      # some lines that will be appended to
      # the `${config.hardware.sane.configDir}/some-backend.conf` file
    '';
  };
}

Technical details

makefu commented 7 years ago

I am currently doing the same. Until this feature is included into upstream i will document it into the nixos-users wiki: https://github.com/nixos-users/wiki/wiki/Scanners

stale[bot] commented 4 years ago

Thank you for your contributions.

This has been automatically marked as stale because it has had no activity for 180 days.

If this is still important to you, we ask that you leave a comment below. Your comment can be as simple as "still important to me". This lets people see that at least one person still cares about this. Someone will have to do this at most twice a year if there is no other activity.

Here are suggestions that might help resolve this more quickly:

  1. Search for maintainers and people that previously touched the related code and @ mention them in a comment.
  2. Ask on the NixOS Discourse.
  3. Ask on the #nixos channel on irc.freenode.net.
doronbehar commented 4 years ago

@michalrus There's this netConf option. This issue is ancient and stale so I'm closing.

makefu commented 4 years ago

fair enough, thanks for following up!

tex commented 4 years ago

How is netConf supposed to replace configuration of backend that user uses? For example, I am trying to use sane-airscan, it has its own config file in /etc/sane.d/airscan.conf. How netConf can know about it and create the config with my parameters which are not just simple IP address?

doronbehar commented 4 years ago

I'm using the airscan backend my self and I've just verified it works a few days ago. @tex look at this:

https://github.com/NixOS/nixpkgs/blob/ddb59ca5ccfefd97920db682e165d0e3f226b2ec/pkgs/applications/graphics/sane/config.nix#L7-L28

If a sane backend package has a either of the common files (see lines 16-17):

Their contents are merged by this derivation, and then, after a rebuild (and a logout-login) SANE_CONFIG_DIR should point to a derivation with this backend available, both thanks to the configs symlinked and the shared object libraries symlinked to $SANE_CONFIG_DIR/lib.

For sane-airscan, there's supposed to be $SANE_CONFIG_DIR/airscan.conf and $SANE_CONFIG_DIR/dll.conf which should contain at the end of it the lines:

# sane-dll entry for sane-airscan
airscan

Concatenated by the derivation's installPhase.

If you do not see this evidence that sane-airscan is configured, then there's something wrong with the way you use (or not use) the NixOS option hardware.sane.backends.

If you do see this evidence for airscan "installed" in $SANE_CONFIG_DIR, and you still don't see your airscan compatible scanner, then perhaps you are missing some avahi related settings. These work for me:

    services.avahi.enable = true;
    services.avahi.nssmdns = true;
    services.avahi.reflector = true;
pascalziegler commented 3 years ago

I'm quite new to NixOS and have quite a few difficulties installing my network scanner. With the sane-airscan backend and netConfoption I can configure my scanner but get an I/O Error while scanning. On Arch Linux I configured the backend as described by @michalrus, so I used the custom module method as described in NixosWiki. But a nixos-rebuild switch produces an BadStorePath Error. Has anyone the same problem, or can someone give me some hints how to debug these errors?

The scanner I'm using is a Samsung M2885FW and my system is on version 20.09.

tex commented 3 years ago

I have this and it works for me. Does your scanner works with sane-airscan on Arch? Is NixOS sane-airscan older version?

    hardware.sane =
      { enable = true;
      extraBackends = [ sane-airscan ];
    };
    services.saned.enable = true;
pascalziegler commented 3 years ago

On Arch I never tested the sane-airscan backend. But it worked with the samsung-unified-driver and with the static IP-Adress added to /etc/sane.d/xerox_mfp.conf. After reading the NixosWiki article I saw that my scanner should also support sane-airscan. So I tried that with the same settings you have. With that the scanner was found, but I get an I/O Error every time I try to scan.

tex commented 3 years ago

I have WorkCentre 3025 and that was not supported by sane-airscan, but I provided a communication dump during attempt to scan (via Ethernet and Wireshark) and author of sane-airscan was able to find out what is wrong and added support for it. He is very active and nice.

pascalziegler commented 3 years ago

Ahh dumb me. With the sane-airscan package from the unstable branch of nixpkgs it works. Thank you for your help.

returntoreality commented 6 months ago

@michalrus There's this netConf option. This issue is ancient and stale so I'm closing.

This is not the same. netConf/net.conf is for specifying other hosts running saned, not networked scanners. These need to be specified in their sane driver configs. Currently it is not possible to add lines to these config files (except for net.conf). This ticket suggests adding a config option to allow adding lines to the other drivers.

doronbehar commented 6 months ago

@returntoreality I'm not sure I understood what you were trying to explain. Could you please perhaps open a separate issue, explaining why netConf isn't what you need?

returntoreality commented 6 months ago

I created ticket #295008 which hopefully explains it a bit better.