mirror of
https://git.in.rschanz.org/ryan77627/guix.git
synced 2024-12-24 13:28:12 -05:00
home: services: kodi, znc, ssh-agent: Use 'match-record'.
* gnu/home/services/media.scm (home-kodi-services): Use 'match-record' instead of 'match'. * gnu/home/services/messaging.scm (home-znc-services): Likewise. * gnu/home/services/ssh.scm (home-ssh-agent-services): Likewise.
This commit is contained in:
parent
9cb1746467
commit
8f219e658d
3 changed files with 42 additions and 45 deletions
|
@ -18,7 +18,6 @@
|
|||
|
||||
(define-module (gnu home services media)
|
||||
#:use-module (srfi srfi-26)
|
||||
#:use-module (ice-9 match)
|
||||
#:use-module (gnu home services)
|
||||
#:use-module (gnu home services shepherd)
|
||||
#:use-module (gnu packages kodi)
|
||||
|
@ -44,18 +43,18 @@ (define-record-type* <home-kodi-configuration>
|
|||
|
||||
(define (home-kodi-services config)
|
||||
"Return a <shepherd-service> for kodi with CONFIG."
|
||||
(match config
|
||||
(($ <home-kodi-configuration> kodi extra-options)
|
||||
(let* ((kodi (file-append kodi "/bin/kodi"))
|
||||
(command #~'(#$kodi "-fs" #$@extra-options))
|
||||
(log-file #~(string-append %user-log-dir "/kodi.log")))
|
||||
(list (shepherd-service
|
||||
(documentation "Run the kodi media center.")
|
||||
(provision '(kodi))
|
||||
(modules '((shepherd support))) ;for '%user-log-dir'
|
||||
(start #~(make-forkexec-constructor #$command
|
||||
#:log-file #$log-file))
|
||||
(stop #~(make-kill-destructor))))))))
|
||||
(match-record config <home-kodi-configuration>
|
||||
(kodi extra-options)
|
||||
(let* ((kodi (file-append kodi "/bin/kodi"))
|
||||
(command #~'(#$kodi "-fs" #$@extra-options))
|
||||
(log-file #~(string-append %user-log-dir "/kodi.log")))
|
||||
(list (shepherd-service
|
||||
(documentation "Run the kodi media center.")
|
||||
(provision '(kodi))
|
||||
(modules '((shepherd support))) ;for '%user-log-dir'
|
||||
(start #~(make-forkexec-constructor #$command
|
||||
#:log-file #$log-file))
|
||||
(stop #~(make-kill-destructor)))))))
|
||||
|
||||
(define home-kodi-service-type
|
||||
(service-type
|
||||
|
|
|
@ -18,7 +18,6 @@
|
|||
|
||||
(define-module (gnu home services messaging)
|
||||
#:use-module (srfi srfi-26)
|
||||
#:use-module (ice-9 match)
|
||||
#:use-module (gnu home services)
|
||||
#:use-module (gnu home services shepherd)
|
||||
#:use-module (gnu packages messaging)
|
||||
|
@ -42,18 +41,18 @@ (define-record-type* <home-znc-configuration>
|
|||
|
||||
(define (home-znc-services config)
|
||||
"Return a <shepherd-service> for znc with CONFIG."
|
||||
(match config
|
||||
(($ <home-znc-configuration> znc extra-options)
|
||||
(let* ((znc (file-append znc "/bin/znc"))
|
||||
(command #~'(#$znc "--foreground" #$@extra-options))
|
||||
(log-file #~(string-append %user-log-dir "/znc.log")))
|
||||
(list (shepherd-service
|
||||
(documentation "Run the znc IRC bouncer.")
|
||||
(provision '(znc))
|
||||
(modules '((shepherd support))) ;for '%user-log-dir'
|
||||
(start #~(make-forkexec-constructor #$command
|
||||
#:log-file #$log-file))
|
||||
(stop #~(make-kill-destructor))))))))
|
||||
(match-record config <home-znc-configuration>
|
||||
(znc extra-options)
|
||||
(let* ((znc (file-append znc "/bin/znc"))
|
||||
(command #~'(#$znc "--foreground" #$@extra-options))
|
||||
(log-file #~(string-append %user-log-dir "/znc.log")))
|
||||
(list (shepherd-service
|
||||
(documentation "Run the znc IRC bouncer.")
|
||||
(provision '(znc))
|
||||
(modules '((shepherd support))) ;for '%user-log-dir'
|
||||
(start #~(make-forkexec-constructor #$command
|
||||
#:log-file #$log-file))
|
||||
(stop #~(make-kill-destructor)))))))
|
||||
|
||||
(define home-znc-service-type
|
||||
(service-type
|
||||
|
|
|
@ -276,25 +276,24 @@ (define-record-type* <home-ssh-agent-configuration>
|
|||
|
||||
(define (home-ssh-agent-services config)
|
||||
"Return a <shepherd-service> for an ssh-agent with CONFIG."
|
||||
(match config
|
||||
(($ <home-ssh-agent-configuration>
|
||||
openssh socket-directory extra-options)
|
||||
(let* ((ssh-agent (file-append openssh "/bin/ssh-agent"))
|
||||
(socket-file #~(string-append #$socket-directory "/socket"))
|
||||
(command #~`(#$ssh-agent
|
||||
"-D" "-a" ,#$socket-file
|
||||
#$@extra-options))
|
||||
(log-file #~(string-append %user-log-dir "/ssh-agent.log")))
|
||||
(list (shepherd-service
|
||||
(documentation "Run the ssh-agent.")
|
||||
(provision '(ssh-agent))
|
||||
(modules '((shepherd support))) ;for '%user-runtime-dir', etc.
|
||||
(start #~(lambda _
|
||||
(unless (file-exists? #$socket-directory)
|
||||
(mkdir-p #$socket-directory)
|
||||
(chmod #$socket-directory #o700))
|
||||
(fork+exec-command #$command #:log-file #$log-file)))
|
||||
(stop #~(make-kill-destructor))))))))
|
||||
(match-record config <home-ssh-agent-configuration>
|
||||
(openssh socket-directory extra-options)
|
||||
(let* ((ssh-agent (file-append openssh "/bin/ssh-agent"))
|
||||
(socket-file #~(string-append #$socket-directory "/socket"))
|
||||
(command #~`(#$ssh-agent
|
||||
"-D" "-a" ,#$socket-file
|
||||
#$@extra-options))
|
||||
(log-file #~(string-append %user-log-dir "/ssh-agent.log")))
|
||||
(list (shepherd-service
|
||||
(documentation "Run the ssh-agent.")
|
||||
(provision '(ssh-agent))
|
||||
(modules '((shepherd support))) ;for '%user-runtime-dir', etc.
|
||||
(start #~(lambda _
|
||||
(unless (file-exists? #$socket-directory)
|
||||
(mkdir-p #$socket-directory)
|
||||
(chmod #$socket-directory #o700))
|
||||
(fork+exec-command #$command #:log-file #$log-file)))
|
||||
(stop #~(make-kill-destructor)))))))
|
||||
|
||||
(define home-ssh-agent-service-type
|
||||
(service-type
|
||||
|
|
Loading…
Reference in a new issue