Commit | Line | Data |
---|---|---|
aa4ed923 AK |
1 | ;;; GNU Guix --- Functional package management for GNU |
2 | ;;; Copyright © 2015 Alex Kost <alezost@gmail.com> | |
3 | ;;; | |
4 | ;;; This file is part of GNU Guix. | |
5 | ;;; | |
6 | ;;; GNU Guix is free software; you can redistribute it and/or modify it | |
7 | ;;; under the terms of the GNU General Public License as published by | |
8 | ;;; the Free Software Foundation; either version 3 of the License, or (at | |
9 | ;;; your option) any later version. | |
10 | ;;; | |
11 | ;;; GNU Guix is distributed in the hope that it will be useful, but | |
12 | ;;; WITHOUT ANY WARRANTY; without even the implied warranty of | |
13 | ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
14 | ;;; GNU General Public License for more details. | |
15 | ;;; | |
16 | ;;; You should have received a copy of the GNU General Public License | |
17 | ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>. | |
18 | ||
19 | (define-module (gnu services lirc) | |
20 | #:use-module (gnu services) | |
21 | #:use-module (gnu packages lirc) | |
aa4ed923 AK |
22 | #:use-module (guix store) |
23 | #:use-module (guix gexp) | |
24 | #:export (lirc-service)) | |
25 | ||
26 | ;;; Commentary: | |
27 | ;;; | |
28 | ;;; LIRC services. | |
29 | ;;; | |
30 | ;;; Code: | |
31 | ||
32 | (define* (lirc-service #:key (lirc lirc) | |
33 | device driver config-file | |
34 | (extra-options '())) | |
35 | "Return a service that runs @url{http://www.lirc.org,LIRC}, a daemon that | |
36 | decodes infrared signals from remote controls. | |
37 | ||
38 | The daemon will use specified @var{device}, @var{driver} and | |
39 | @var{config-file} (configuration file name). | |
40 | ||
41 | Finally, @var{extra-options} is a list of additional command-line options | |
42 | passed to @command{lircd}." | |
be1c2c54 LC |
43 | (service |
44 | (provision '(lircd)) | |
45 | (documentation "Run the LIRC daemon.") | |
46 | (requirement '(user-processes)) | |
47 | (start #~(make-forkexec-constructor | |
48 | (list (string-append #$lirc "/sbin/lircd") | |
49 | "--nodaemon" | |
50 | #$@(if device | |
51 | #~("--device" #$device) | |
52 | #~()) | |
53 | #$@(if driver | |
54 | #~("--driver" #$driver) | |
55 | #~()) | |
56 | #$@(if config-file | |
57 | #~(#$config-file) | |
58 | #~()) | |
59 | #$@extra-options))) | |
60 | (stop #~(make-kill-destructor)) | |
61 | (activate #~(begin | |
62 | (use-modules (guix build utils)) | |
63 | (mkdir-p "/var/run/lirc"))))) | |
aa4ed923 AK |
64 | |
65 | ;;; lirc.scm ends here |