Add scanner setup
This commit is contained in:
parent
3ed2998378
commit
efee26eb02
|
@ -132,7 +132,7 @@
|
|||
fend = inputs.fend.packages."${system}".fend;
|
||||
})
|
||||
# Some program adjustments
|
||||
#(import ./overlays/mosh.nix)
|
||||
(import ./overlays/sane-backends.nix)
|
||||
(import ./overlays/logisim.nix)
|
||||
(import ./overlays/cataclysm-dda.nix)
|
||||
];
|
||||
|
@ -144,6 +144,7 @@
|
|||
modules = [
|
||||
./system/helix-texta.nix
|
||||
./system/light-actkbd.nix
|
||||
./system/modules/scanner.nix
|
||||
self.nixosModules.helix-texta-hardware
|
||||
home-manager.nixosModules.home-manager
|
||||
self.nixosModules.home-manager
|
||||
|
|
17
overlays/sane-backends.nix
Normal file
17
overlays/sane-backends.nix
Normal file
|
@ -0,0 +1,17 @@
|
|||
self: super:
|
||||
|
||||
{
|
||||
sane-backends = (super.sane-backends.override {
|
||||
extraFirmware = [{
|
||||
src = super.fetchurl {
|
||||
url = "www.meier-geinitz.de/sane/gt68xx-backend/firmware/sbfw.usb";
|
||||
sha256 = "12hnacivpy153alfjyr7k92y90nmb5d7z1ca7aix5w7wi0w4jdjv";
|
||||
};
|
||||
name = "sbfw.usb";
|
||||
backend = "gt68xx";
|
||||
}];
|
||||
}).overrideAttrs (old: {
|
||||
patches = (old.patches or [ ]) ++ [ ../patches/gt68xx.conf.patch ];
|
||||
prePatch = "stat backend/gt68xx.conf.in";
|
||||
});
|
||||
}
|
15
patches/gt68xx.conf.patch
Normal file
15
patches/gt68xx.conf.patch
Normal file
|
@ -0,0 +1,15 @@
|
|||
--- a/backend/gt68xx.conf.in 2021-02-14 12:25:19.000000000 +0100
|
||||
+++ b/backend/gt68xx.conf.in 2021-11-05 14:43:41.077378018 +0100
|
||||
@@ -30,9 +30,9 @@
|
||||
#override "mustek-scanexpress-1200-ub-plus"
|
||||
|
||||
# Medion/Lifetec/Tevion LT 9452:
|
||||
-#override "mustek-scanexpress-1200-ub-plus"
|
||||
-#vendor "Lifetec"
|
||||
-#model "LT 9452"
|
||||
+override "mustek-scanexpress-1200-ub-plus"
|
||||
+vendor "Lifetec"
|
||||
+model "LT 9452"
|
||||
|
||||
# Trust Compact Scan USB 19200:
|
||||
#override "mustek-scanexpress-1200-ub-plus"
|
|
@ -123,8 +123,16 @@ in {
|
|||
hashedPassword =
|
||||
"$6$zqEC2iJJ98Ne$lRERO30msyjJm7oJCqRD/xj3NIm4De37gD.VUzfg7aceosE/6S6eNAaruIakgUtSC970MHRPoNlCEy1RoFuyh.";
|
||||
isNormalUser = true;
|
||||
extraGroups =
|
||||
[ "wheel" "networkmanager" "video" "lp" "kvm" "libvirtd" "podman" ];
|
||||
extraGroups = [
|
||||
"wheel"
|
||||
"networkmanager"
|
||||
"video"
|
||||
"lp"
|
||||
"kvm"
|
||||
"libvirtd"
|
||||
"podman"
|
||||
"scanner"
|
||||
];
|
||||
# Yes, use the best, please
|
||||
shell = pkgs.fish;
|
||||
};
|
||||
|
|
27
system/modules/scanner.nix
Normal file
27
system/modules/scanner.nix
Normal file
|
@ -0,0 +1,27 @@
|
|||
{ pkgs, ... }:
|
||||
|
||||
let
|
||||
scan = "${pkgs.sane-backends}/bin/scanimage";
|
||||
convert = "${pkgs.imagemagick}/bin/convert";
|
||||
# TODO: Can I specify this in a better way?
|
||||
device = "gt68xx";
|
||||
|
||||
scan-a4 = pkgs.writeScriptBin "scan-a4" ''
|
||||
#!${pkgs.stdenv.shell}
|
||||
if [[ -z $1 ]]; then
|
||||
echo "Missing filename"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
${scan} --device-name ${device} \
|
||||
-x 210 \
|
||||
-y 297 \
|
||||
-o /tmp/last-scan.png \
|
||||
--resolution 150 || exit 2
|
||||
${convert} /tmp/last-scan.png $1 || exit 3
|
||||
'';
|
||||
in {
|
||||
hardware.sane.enable = true;
|
||||
|
||||
environment.systemPackages = [ scan-a4 ];
|
||||
}
|
Loading…
Reference in a new issue