(define-module (tw packages scanner) #:use-module (gnu packages avahi) #:use-module (gnu packages compression) #:use-module (gnu packages gnome) #:use-module (gnu packages golang) #:use-module (gnu packages libusb) #:use-module (gnu packages pkg-config) #:use-module (gnu packages scanner) #:use-module (guix build-system gnu) #:use-module (guix build-system go) #:use-module (guix git-download) #:use-module (guix packages) #:use-module ((guix utils) #:select (substitute-keyword-arguments)) #:use-module ((guix licenses) #:prefix license:)) (define-public go-github-com-openprinting-goipp (package (name "go-github-com-openprinting-goipp") (version "1.0.0") (source (origin (method git-fetch) (uri (git-reference (url "https://github.com/OpenPrinting/goipp") (commit (string-append "v" version)))) (file-name (git-file-name name version)) (sha256 (base32 "128bhqayglplcivvcvvdb2cclsfwmqdckaysij7j1k0r0b8sr2xw")))) (build-system go-build-system) (arguments '(#:import-path "github.com/OpenPrinting/goipp")) (home-page "https://github.com/OpenPrinting/goipp") (synopsis "IPP core protocol implementation in pure Go") (description "Implements the IPP core protocol, as defined by @url{https://rfc-editor.org/rfc/rfc8010.html,RFC 8010}.") (license license:bsd-2))) (define-public ipp-usb (package (name "ipp-usb") (version "0.9.23") (home-page "https://github.com/OpenPrinting/ipp-usb") (source (origin (method git-fetch) (uri (git-reference (url home-page) (commit version))) (file-name (git-file-name name version)) (sha256 (base32 "16nq0z24ifx3n85sa483rkshsc132mxd4v5kj3vs0kd4m9cd1cxi")))) (build-system go-build-system) ; written in Go, but controlled by Makefile (arguments `(#:install-source? #f ; binary-only package #:import-path "github.com/OpenPrinting/ipp-usb" #:phases (modify-phases %standard-phases (replace 'build (lambda* (#:key unpack-path import-path #:allow-other-keys) (with-directory-excursion (string-append "src/" (if (string-null? unpack-path) import-path unpack-path)) (invoke "make")))) (replace 'install (lambda* (#:key outputs unpack-path import-path #:allow-other-keys) (with-directory-excursion (string-append "src/" (if (string-null? unpack-path) import-path unpack-path)) (invoke "make" (string-append "PREFIX=" (assoc-ref outputs "out")) "install")))) (add-after 'install 'guix-directories (lambda* (#:key outputs #:allow-other-keys) (let ((out (assoc-ref outputs "out"))) (rename-file (string-append out "/sbin") (string-append out "/bin")) (rename-file (string-append out "/usr/share") (string-append out "/share")) (rmdir (string-append out "/usr")) ;; The .service file isn't useful in Guix. (delete-file-recursively (string-append out "/lib/systemd")) ;; The udev .rules file refers to the systemd .service file only. (delete-file-recursively (string-append out "/lib/udev")) (rmdir (string-append out "/lib")))))))) (inputs (list avahi libusb)) ; avahi for libavahi-client and libavahi-common (native-inputs (list go pkg-config go-github-com-openprinting-goipp gzip)) (synopsis "HTTP reverse proxy, backed by IPP-over-USB connection to device") (description "IPP-over-USB allows using the IPP protocol, normally designed for network printers, to be used with USB printers as well. The idea behind this standard is simple: It allows to send HTTP requests to the device via a USB connection, so enabling IPP, eSCL (AirScan) and web console on devices without Ethernet or WiFi connections.") (license license:bsd-2))) (define-public sane-backends/airscan (package/inherit sane-backends (name "sane-airscan-backends") (inputs (let ((inputs (list-copy (package-inputs sane-backends)))) (assq-remove! inputs "hplip") `(("sane-airscan" ,sane-airscan) ,@inputs))) (arguments (substitute-keyword-arguments (package-arguments sane-backends) ((#:phases phases) `(modify-phases ,phases (delete 'add-backends) ; for hplip (delete 'install-hpaio) ; for hplip (add-after 'install 'install-airscan (lambda* (#:key inputs outputs #:allow-other-keys) (let ((out (assoc-ref outputs "out")) (airscan (assoc-ref inputs "sane-airscan"))) (for-each (lambda (file) (symlink file (string-append out "/lib/sane/" (basename file)))) (find-files (string-append airscan "/lib/sane"))) (symlink (string-append airscan "/etc/sane.d/airscan.conf") (string-append out "/etc/sane.d/airscan.conf")) (symlink (string-append airscan "/etc/sane.d/dll.d/airscan") (string-append out "/etc/sane.d/dll.d/airscan"))))))))) (description "SANE stands for \"Scanner Access Now Easy\" and is an API proving access to any raster image scanner hardware (flatbed scanner, hand-held scanner, video- and still-cameras, frame-grabbers, etc.). The package contains the library and drivers, including the sane-airscan driver, but not the hpaio backend provided by hplip."))) (define-public simple-scan/airscan (package/inherit simple-scan (inputs (modify-inputs (package-inputs simple-scan) (replace "sane-backends" sane-backends/airscan)))))