mirror of
https://codeberg.org/guix/guix.git
synced 2025-10-02 02:15:12 +00:00
services: sane: Support pluggable backends.
* gnu/services/desktop.scm (sane-configuration): New record. (sane-service-type): Add native search paths to environment. Change-Id: Ia7b66b62cf027200dd94533f32c1e4bc0ed373d3
This commit is contained in:
parent
79e40be05d
commit
3fdf7981fc
2 changed files with 83 additions and 19 deletions
|
@ -26957,23 +26957,46 @@ site} for more information.
|
||||||
@defvar sane-service-type
|
@defvar sane-service-type
|
||||||
This service provides access to scanners @i{via}
|
This service provides access to scanners @i{via}
|
||||||
@uref{http://www.sane-project.org, SANE} by installing the necessary
|
@uref{http://www.sane-project.org, SANE} by installing the necessary
|
||||||
udev rules. It is included in @code{%desktop-services} (@pxref{Desktop
|
udev rules and pluggable backends. It is included in
|
||||||
Services}) and relies by default on @code{sane-backends-minimal} package
|
@code{%desktop-services} (@pxref{Desktop Services}) and relies by
|
||||||
(see below) for hardware support.
|
default on @code{sane-backends} package (see below) for hardware
|
||||||
|
support.
|
||||||
@end defvar
|
@end defvar
|
||||||
|
|
||||||
@defvar sane-backends-minimal
|
@deftp {Data Type} sane-configuration
|
||||||
The default package which the @code{sane-service-type} installs. It
|
Data type representing the configuration for SANE.
|
||||||
supports many recent scanners.
|
|
||||||
@end defvar
|
|
||||||
|
|
||||||
@defvar sane-backends
|
@table @asis
|
||||||
This package includes support for all scanners that
|
|
||||||
@code{sane-backends-minimal} supports, plus older Hewlett-Packard
|
@item @code{sane} (default: @code{sane})
|
||||||
scanners supported by @code{hplip} package. In order to use this on
|
Package containing SANE library.
|
||||||
a system which relies on @code{%desktop-services}, you may use
|
|
||||||
@code{modify-services} (@pxref{Service Reference,
|
@item @code{backends} (default: @code{(sane-backends)})
|
||||||
@code{modify-services}}) as illustrated below:
|
List of packages with pluggable SANE backends:
|
||||||
|
|
||||||
|
@itemize @bullet
|
||||||
|
@item
|
||||||
|
@code{sane-backends}: The default backend collection which supports many recent scanners,
|
||||||
|
|
||||||
|
@item
|
||||||
|
@code{sane-airscan}: A backend that enables network scanners supporting eSCL (Apple) or WSD,
|
||||||
|
(Microsoft) protocols
|
||||||
|
|
||||||
|
@item
|
||||||
|
@code{hplip}: A backend containing drivers for older Hewlett-Packard scanners,
|
||||||
|
|
||||||
|
@item
|
||||||
|
@code{utsushi}: A backend containing drivers for older Epson devices.
|
||||||
|
|
||||||
|
@end itemize
|
||||||
|
|
||||||
|
@end table
|
||||||
|
@end deftp
|
||||||
|
|
||||||
|
In order to use additional backends on a system which relies on
|
||||||
|
@code{%desktop-services}, you may use @code{modify-services}
|
||||||
|
(@pxref{Service Reference, @code{modify-services}}) as illustrated
|
||||||
|
below:
|
||||||
|
|
||||||
@lisp
|
@lisp
|
||||||
(use-modules (gnu))
|
(use-modules (gnu))
|
||||||
|
@ -26987,13 +27010,14 @@ a system which relies on @code{%desktop-services}, you may use
|
||||||
(define %my-desktop-services
|
(define %my-desktop-services
|
||||||
;; List of desktop services that supports a broader range of scanners.
|
;; List of desktop services that supports a broader range of scanners.
|
||||||
(modify-services %desktop-services
|
(modify-services %desktop-services
|
||||||
(sane-service-type _ => sane-backends)))
|
(sane-service-type _ =>
|
||||||
|
(sane-configuration
|
||||||
|
(backends (list sane-backends sane-airscan))))))
|
||||||
|
|
||||||
(operating-system
|
(operating-system
|
||||||
@dots{}
|
@dots{}
|
||||||
(services %my-desktop-services))
|
(services %my-desktop-services))
|
||||||
@end lisp
|
@end lisp
|
||||||
@end defvar
|
|
||||||
|
|
||||||
@deffn {Procedure} geoclue-application name [#:allowed? #t] [#:system? #f] [#:users '()]
|
@deffn {Procedure} geoclue-application name [#:allowed? #t] [#:system? #f] [#:users '()]
|
||||||
Return a configuration allowing an application to access GeoClue
|
Return a configuration allowing an application to access GeoClue
|
||||||
|
|
|
@ -80,8 +80,10 @@
|
||||||
#:use-module (gnu packages nfs)
|
#:use-module (gnu packages nfs)
|
||||||
#:use-module (gnu packages enlightenment)
|
#:use-module (gnu packages enlightenment)
|
||||||
#:use-module (guix deprecation)
|
#:use-module (guix deprecation)
|
||||||
|
#:use-module (guix i18n)
|
||||||
#:use-module (guix records)
|
#:use-module (guix records)
|
||||||
#:use-module (guix packages)
|
#:use-module (guix packages)
|
||||||
|
#:use-module (guix search-paths)
|
||||||
#:use-module (guix store)
|
#:use-module (guix store)
|
||||||
#:use-module (guix ui)
|
#:use-module (guix ui)
|
||||||
#:use-module (guix utils)
|
#:use-module (guix utils)
|
||||||
|
@ -147,6 +149,11 @@
|
||||||
accountsservice-service ; deprecated
|
accountsservice-service ; deprecated
|
||||||
|
|
||||||
cups-pk-helper-service-type
|
cups-pk-helper-service-type
|
||||||
|
|
||||||
|
sane-configuration
|
||||||
|
sane-configuration?
|
||||||
|
sane-configuration-backends
|
||||||
|
sane-configuration-sane
|
||||||
sane-service-type
|
sane-service-type
|
||||||
|
|
||||||
gnome-desktop-configuration
|
gnome-desktop-configuration
|
||||||
|
@ -1681,6 +1688,33 @@ accountsservice web site} for more information."
|
||||||
;; The '60-libsane.rules' udev rules refers to the "scanner" group.
|
;; The '60-libsane.rules' udev rules refers to the "scanner" group.
|
||||||
(list (user-group (name "scanner") (system? #t))))
|
(list (user-group (name "scanner") (system? #t))))
|
||||||
|
|
||||||
|
(define (non-empty-list-of-packages? val)
|
||||||
|
(and (not (null? val)) (list-of-packages? val)))
|
||||||
|
|
||||||
|
(define-configuration/no-serialization sane-configuration
|
||||||
|
(sane
|
||||||
|
(package sane)
|
||||||
|
"The package that provides the SANE library.")
|
||||||
|
(backends
|
||||||
|
(non-empty-list-of-packages (list sane-backends))
|
||||||
|
"A list of packages containing SANE backends."))
|
||||||
|
|
||||||
|
(define (sane-search-paths config)
|
||||||
|
(match-record config <sane-configuration> (sane backends)
|
||||||
|
(let ((backend-union (directory-union "sane-backends" backends)))
|
||||||
|
(map (match-lambda
|
||||||
|
(($ <search-path-specification> variable (files))
|
||||||
|
(cons variable (file-append backend-union "/" files))))
|
||||||
|
(package-native-search-paths sane)))))
|
||||||
|
|
||||||
|
(define* (lift-sane-configuration config #:key warn?)
|
||||||
|
(if (sane-configuration? config)
|
||||||
|
config
|
||||||
|
(begin
|
||||||
|
(when warn?
|
||||||
|
(warning (G_ "'sane' service now expects a 'sane-configuration' record~%")))
|
||||||
|
(sane-configuration (backends (list config))))))
|
||||||
|
|
||||||
(define sane-service-type
|
(define sane-service-type
|
||||||
(service-type
|
(service-type
|
||||||
(name 'sane)
|
(name 'sane)
|
||||||
|
@ -1688,9 +1722,15 @@ accountsservice web site} for more information."
|
||||||
"This service provides access to scanners @i{via}
|
"This service provides access to scanners @i{via}
|
||||||
@uref{http://www.sane-project.org, SANE} by installing the necessary udev
|
@uref{http://www.sane-project.org, SANE} by installing the necessary udev
|
||||||
rules.")
|
rules.")
|
||||||
(default-value sane-backends-minimal)
|
(default-value (sane-configuration))
|
||||||
(extensions
|
(extensions
|
||||||
(list (service-extension udev-service-type list)
|
(list (service-extension udev-service-type
|
||||||
|
(lambda (c)
|
||||||
|
(sane-configuration-backends
|
||||||
|
(lift-sane-configuration c #:warn? #t))))
|
||||||
|
(service-extension session-environment-service-type
|
||||||
|
(lambda (c)
|
||||||
|
(sane-search-paths (lift-sane-configuration c))))
|
||||||
(service-extension account-service-type
|
(service-extension account-service-type
|
||||||
(const %sane-accounts))))))
|
(const %sane-accounts))))))
|
||||||
|
|
||||||
|
@ -2445,7 +2485,7 @@ applications needing access to be root.")
|
||||||
;; Add udev rules for MTP devices so that non-root users can access
|
;; Add udev rules for MTP devices so that non-root users can access
|
||||||
;; them.
|
;; them.
|
||||||
(simple-service 'mtp udev-service-type (list libmtp))
|
(simple-service 'mtp udev-service-type (list libmtp))
|
||||||
;; Add udev rules for scanners.
|
;; Add udev rules and default backends for scanners.
|
||||||
(service sane-service-type)
|
(service sane-service-type)
|
||||||
;; Add polkit rules, so that non-root users in the wheel group can
|
;; Add polkit rules, so that non-root users in the wheel group can
|
||||||
;; perform administrative tasks (similar to "sudo").
|
;; perform administrative tasks (similar to "sudo").
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue