Closed tex closed 4 years ago
@doronbehar Thanks Doron, as you use airscan, do you see in this my config something wrong?
it is interesting that there is no /etc/sane
That's not ideal but it's the current way things are designed: When you build your system, it writes to /etc/set-environment
or alike, a export SANE_CONFIG_DIR=/nix/store/...
which should contain the files sane uses to find the configs.
Me and others have noticed this is bad design, see https://github.com/NixOS/nixpkgs/issues/90184 and https://github.com/NixOS/nixpkgs/issues/90201 . Perhaps we should write wrappers for simple-scan
and similar packages that would contain the requested sane config via SANE_CONFIG_DIR
in these packages' wrappers' environment.
Could you please try running this command, on the same shell you run scanimage -L
:
grep airscan -R $SANE_CONFIG_DIR
@tex, did you logout/login after switching the config? Sane relies on LD_LIBRARY_PATH
, which will be updated next time you initialize your session (inaccurate explanation, but it's too keep it simple)
Thanks all! It detects scanner after restart. Sorry I didn't try, I am long term user of Linux so I almost forget that restart may sometime help :) It is detected only when running as root, but I remember some tip in NixOS wiki about that.
But my scanner doesn't work out of the box even it is detected:
[root@nixos nixpkgs]# scanimage -L
device `airscan:w0:Xerox WorkCentre 3025 (XRX9C934E3E92AF)' is a WSD Xerox WorkCentre 3025 (XRX9C934E3E92AF) WSD network scanner
It connects, scanner is scanning, but xsane complains: Error during read: Error during device I/O.
I am trying to provide debug info so author of sane-airscan can help me, it is neccessary to modify /etc/sane.d/airscan.conf file:
[debug]
trace = ~/airscan/trace
enable = true
Do you have idea how to do that in NixOS? Modify package of sane-airscan directly (I have local clone of nixpkgs)?
Do you have idea how to do that in NixOS? Modify package of sane-airscan directly (I have local clone of nixpkgs)?
That's not possible without some hacking. Try this ugly patch to Nixpkgs:
diff --git i/pkgs/applications/graphics/sane/config.nix w/pkgs/applications/graphics/sane/config.nix
index 2ef1e26f5ac..a7c8db8d39b 100644
--- i/pkgs/applications/graphics/sane/config.nix
+++ w/pkgs/applications/graphics/sane/config.nix
@@ -16,7 +16,14 @@ let installSanePath = path: ''
if [ "$name" = "dll.conf" ] || [ "$name" = "saned.conf" ] || [ "$name" = "net.conf" ]; then
cat "$conf" >> "$out/etc/sane.d/$name"
else
- symlink "$conf" "$out/etc/sane.d/$name"
+ if [ "$name" = airscan.conf ]; then
+ cat "$conf" > "$out/etc/sane.d/$name"
+ echo '[debug]' >> "$out/etc/sane.d/$name"
+ echo 'trace = ~/airscan/trace' >> "$out/etc/sane.d/$name"
+ echo 'enable = true' >> "$out/etc/sane.d/$name"
+ else
+ symlink "$conf" "$out/etc/sane.d/$name"
+ fi
fi
done
fi
diff --git i/pkgs/top-level/all-packages.nix w/pkgs/top-level/all-packages.nix
index 04e10fd7c1b..4569d5fb399 100644
--- i/pkgs/top-level/all-packages.nix
+++ w/pkgs/top-level/all-packages.nix
@@ -27066,6 +27066,8 @@ in
mkSaneConfig = callPackage ../applications/graphics/sane/config.nix { };
+ mySaneConf = mkSaneConfig { paths = [ sane-airscan ]; };
+
sane-frontends = callPackage ../applications/graphics/sane/frontends.nix { };
sanoid = callPackage ../tools/backup/sanoid { };
And then, run whatever command you need to run with:
env SANE_CONFIG_DIR=$(nix-build -A mySaneConf)/etc/sane.d
/etc/nixos/configuration.nix:
After switching to this config, it is interesting that there is no /etc/sane folder in resulting system...
But scanimage doesn't see the scanner, because it doesn't see sane-airscan:
@zaninime