guix-play/gnu/services/lirc.scm
Alex Kost d4053c710b services: Rename 'dmd' services to 'shepherd'.
* gnu/services/shepherd.scm (dmd-root-service-type, %dmd-root-service)
  (dmd-service-type, <dmd-service>, dmd-service, dmd-service?)
  (make-dmd-service, dmd-service-documentation, dmd-service-provision)
  (dmd-service-requirement, dmd-service-respawn, dmd-service-start)
  (dmd-service-stop, dmd-service-auto-start?, dmd-service-modules)
  (dmd-service-imported-modules, dmd-service-file-name, dmd-service-file)
  (dmd-service-back-edges): Rename to...
  (shepherd-root-service-type, %shepherd-root-service, shepherd-service-type)
  (<shepherd-service>, shepherd-service, shepherd-service?)
  (make-shepherd-service, shepherd-service-documentation)
  (shepherd-service-provision, shepherd-service-requirement)
  (shepherd-service-respawn, shepherd-service-start)
  (shepherd-service-stop, shepherd-service-auto-start?)
  (shepherd-service-modules, shepherd-service-imported-modules)
  (shepherd-service-file-name, shepherd-service-file)
  (shepherd-service-back-edges): ...this
* gnu/services.scm: Adjust comments.
* gnu/services/avahi.scm (avahi-dmd-service): Rename to...
  (avahi-shepherd-service): ... this.
* gnu/services/base.scm (%root-file-system-dmd-service)
  (file-system->dmd-service-name, mapped-device->dmd-service-name)
  (dependency->dmd-service-name, file-system-dmd-service)
  (mingetty-dmd-service, nscd-dmd-service, guix-dmd-service)
  (guix-publish-dmd-service, udev-dmd-service, gpm-dmd-service): Rename to...
  (%root-file-system-shepherd-service)
  (file-system->shepherd-service-name, mapped-device->shepherd-service-name)
  (dependency->shepherd-service-name, file-system-shepherd-service)
  (mingetty-shepherd-service, nscd-shepherd-service, guix-shepherd-service)
  (guix-publish-shepherd-service, udev-shepherd-service)
  (gpm-shepherd-service): ... this.
* gnu/services/databases.scm (postgresql-dmd-service): Rename to...
  (postgresql-shepherd-service): ... this.
* gnu/services/desktop.scm (upower-dmd-service, elogind-dmd-service):
  Rename to...
  (upower-shepherd-service, elogind-shepherd-service): ... this.
* gnu/services/dbus.scm (dbus-dmd-service): Rename to...
  (dbus-shepherd-service): ... this.
* gnu/services/lirc.scm (lirc-dmd-service): Rename to...
  (lirc-shepherd-service): ... this.
* gnu/services/mail.scm (dovecot-dmd-service): Rename to...
  (dovecot-shepherd-service): ... this.
* gnu/services/networking.scm (ntp-dmd-service, tor-dmd-service)
  (bitlbee-dmd-service, wicd-dmd-service, network-manager-dmd-service): Rename to...
  (dbus-shepherd-service): ... this.
* gnu/services/ssh.scm (lsh-dmd-service): Rename to...
  (lsh-shepherd-service): ... this.
* gnu/services/web.scm (nginx-dmd-service): Rename to...
  (nginx-shepherd-service): ... this.
* gnu/services/xorg.scm (slim-dmd-service): Rename to...
  (slim-shepherd-service): ... this.
* gnu/system.scm (essential-services): Use '%shepherd-root-service'.
* gnu/system/install.scm (cow-store-service-type): Adjust accordingly.
* guix/scripts/system.scm (dmd-service-node-label, dmd-service-node-type)
  (export-dmd-graph): Likewise.
* tests/guix-system.sh: Likewise.
* tests/services.scm ("dmd-service-back-edges"): Rename to...
  ("shepherd-service-back-edges"): Adjust accordingly.
* doc/guix.texi: Likewise.
* doc/images/service-graph.dot: Use 'shepherd' service name.
2016-01-29 20:21:53 +03:00

100 lines
3.7 KiB
Scheme

;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2015 Alex Kost <alezost@gmail.com>
;;; Copyright © 2015 Ludovic Courtès <ludo@gnu.org>
;;;
;;; This file is part of GNU Guix.
;;;
;;; GNU Guix is free software; you can redistribute it and/or modify it
;;; under the terms of the GNU General Public License as published by
;;; the Free Software Foundation; either version 3 of the License, or (at
;;; your option) any later version.
;;;
;;; GNU Guix is distributed in the hope that it will be useful, but
;;; WITHOUT ANY WARRANTY; without even the implied warranty of
;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;;; GNU General Public License for more details.
;;;
;;; You should have received a copy of the GNU General Public License
;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
(define-module (gnu services lirc)
#:use-module (gnu services)
#:use-module (gnu services shepherd)
#:use-module (gnu packages lirc)
#:use-module (guix gexp)
#:use-module (guix records)
#:use-module (ice-9 match)
#:export (lirc-service))
;;; Commentary:
;;;
;;; LIRC service.
;;;
;;; Code:
(define-record-type* <lirc-configuration>
lirc-configuration make-lirc-configuration
lirc-configuation?
(lirc lirc-configuration-lirc ;<package>
(default lirc))
(device lirc-configuration-device) ;string
(driver lirc-configuration-driver) ;string
(config-file lirc-configuration-file) ;string | file-like object
(extra-options lirc-configuration-options ;list of strings
(default '())))
(define %lirc-activation
#~(begin
(use-modules (guix build utils))
(mkdir-p "/var/run/lirc")))
(define lirc-shepherd-service
(match-lambda
(($ <lirc-configuration> lirc device driver config-file options)
(list (shepherd-service
(provision '(lircd))
(documentation "Run the LIRC daemon.")
(requirement '(user-processes))
(start #~(make-forkexec-constructor
(list (string-append #$lirc "/sbin/lircd")
"--nodaemon"
#$@(if device
#~("--device" #$device)
#~())
#$@(if driver
#~("--driver" #$driver)
#~())
#$@(if config-file
#~(#$config-file)
#~())
#$@options)))
(stop #~(make-kill-destructor)))))))
(define lirc-service-type
(service-type (name 'lirc)
(extensions
(list (service-extension shepherd-root-service-type
lirc-shepherd-service)
(service-extension activation-service-type
(const %lirc-activation))))))
(define* (lirc-service #:key (lirc lirc)
device driver config-file
(extra-options '()))
"Return a service that runs @url{http://www.lirc.org,LIRC}, a daemon that
decodes infrared signals from remote controls.
The daemon will use specified @var{device}, @var{driver} and
@var{config-file} (configuration file name).
Finally, @var{extra-options} is a list of additional command-line options
passed to @command{lircd}."
(service lirc-service-type
(lirc-configuration
(lirc lirc)
(device device) (driver driver)
(config-file config-file)
(extra-options extra-options))))
;;; lirc.scm ends here