mirror of
https://https.git.savannah.gnu.org/git/guix.git/
synced 2025-07-12 01:50:46 +02:00
home: services: Use 'match-record' instead of 'match'.
* gnu/home/services/mcron.scm (home-mcron-shepherd-services): Use 'match-record' instead of 'match'. * gnu/home/services/shells.scm (home-bash-extensions): Likewise. * gnu/home/services/xdg.scm (serialize-xdg-desktop-entry): Likewise.
This commit is contained in:
parent
883aa80b45
commit
93d37985da
3 changed files with 72 additions and 72 deletions
|
@ -77,35 +77,35 @@ Each message is also prefixed by a timestamp by GNU Shepherd."))
|
||||||
(define shepherd-schedule-action
|
(define shepherd-schedule-action
|
||||||
(@@ (gnu services mcron) shepherd-schedule-action))
|
(@@ (gnu services mcron) shepherd-schedule-action))
|
||||||
|
|
||||||
(define home-mcron-shepherd-services
|
(define (home-mcron-shepherd-services config)
|
||||||
(match-lambda
|
(match-record config <home-mcron-configuration>
|
||||||
(($ <home-mcron-configuration> mcron '()) ; no jobs to run
|
(mcron jobs log? log-format)
|
||||||
'())
|
(if (null? jobs)
|
||||||
(($ <home-mcron-configuration> mcron jobs log? log-format)
|
'() ;no jobs to run
|
||||||
(let ((files (job-files mcron jobs)))
|
(let ((files (job-files mcron jobs)))
|
||||||
(list (shepherd-service
|
(list (shepherd-service
|
||||||
(documentation "User cron jobs.")
|
(documentation "User cron jobs.")
|
||||||
(provision '(mcron))
|
(provision '(mcron))
|
||||||
(modules `((srfi srfi-1)
|
(modules `((srfi srfi-1)
|
||||||
(srfi srfi-26)
|
(srfi srfi-26)
|
||||||
(ice-9 popen) ; for the 'schedule' action
|
(ice-9 popen) ;for the 'schedule' action
|
||||||
(ice-9 rdelim)
|
(ice-9 rdelim)
|
||||||
(ice-9 match)
|
(ice-9 match)
|
||||||
,@%default-modules))
|
,@%default-modules))
|
||||||
(start #~(make-forkexec-constructor
|
(start #~(make-forkexec-constructor
|
||||||
(list (string-append #$mcron "/bin/mcron")
|
(list (string-append #$mcron "/bin/mcron")
|
||||||
#$@(if log?
|
#$@(if log?
|
||||||
#~("--log" "--log-format" #$log-format)
|
#~("--log" "--log-format" #$log-format)
|
||||||
#~())
|
#~())
|
||||||
#$@files)
|
#$@files)
|
||||||
#:log-file (string-append
|
#:log-file (string-append
|
||||||
(or (getenv "XDG_LOG_HOME")
|
(or (getenv "XDG_LOG_HOME")
|
||||||
(format #f "~a/.local/var/log"
|
(format #f "~a/.local/var/log"
|
||||||
(getenv "HOME")))
|
(getenv "HOME")))
|
||||||
"/mcron.log")))
|
"/mcron.log")))
|
||||||
(stop #~(make-kill-destructor))
|
(stop #~(make-kill-destructor))
|
||||||
(actions
|
(actions
|
||||||
(list (shepherd-schedule-action mcron files)))))))))
|
(list (shepherd-schedule-action mcron files)))))))))
|
||||||
|
|
||||||
(define home-mcron-profile (compose list home-mcron-configuration-mcron))
|
(define home-mcron-profile (compose list home-mcron-configuration-mcron))
|
||||||
|
|
||||||
|
|
|
@ -25,6 +25,7 @@
|
||||||
#:use-module (gnu packages bash)
|
#:use-module (gnu packages bash)
|
||||||
#:use-module (guix gexp)
|
#:use-module (guix gexp)
|
||||||
#:use-module (guix packages)
|
#:use-module (guix packages)
|
||||||
|
#:use-module (guix records)
|
||||||
#:use-module (srfi srfi-1)
|
#:use-module (srfi srfi-1)
|
||||||
#:use-module (srfi srfi-26)
|
#:use-module (srfi srfi-26)
|
||||||
#:use-module (ice-9 match)
|
#:use-module (ice-9 match)
|
||||||
|
@ -479,31 +480,30 @@ with text blocks from other extensions and the base service.")
|
||||||
with text blocks from other extensions and the base service."))
|
with text blocks from other extensions and the base service."))
|
||||||
|
|
||||||
(define (home-bash-extensions original-config extension-configs)
|
(define (home-bash-extensions original-config extension-configs)
|
||||||
(match original-config
|
(match-record original-config <home-bash-configuration>
|
||||||
(($ <home-bash-configuration> _ _ environment-variables aliases
|
(environment-variables aliases bash-profile bashrc bash-logout)
|
||||||
bash-profile bashrc bash-logout)
|
(home-bash-configuration
|
||||||
(home-bash-configuration
|
(inherit original-config)
|
||||||
(inherit original-config)
|
(environment-variables
|
||||||
(environment-variables
|
(append environment-variables
|
||||||
(append environment-variables
|
(append-map
|
||||||
(append-map
|
home-bash-extension-environment-variables extension-configs)))
|
||||||
home-bash-extension-environment-variables extension-configs)))
|
(aliases
|
||||||
(aliases
|
(append aliases
|
||||||
(append aliases
|
(append-map
|
||||||
(append-map
|
home-bash-extension-aliases extension-configs)))
|
||||||
home-bash-extension-aliases extension-configs)))
|
(bash-profile
|
||||||
(bash-profile
|
(append bash-profile
|
||||||
(append bash-profile
|
(append-map
|
||||||
(append-map
|
home-bash-extension-bash-profile extension-configs)))
|
||||||
home-bash-extension-bash-profile extension-configs)))
|
(bashrc
|
||||||
(bashrc
|
(append bashrc
|
||||||
(append bashrc
|
(append-map
|
||||||
(append-map
|
home-bash-extension-bashrc extension-configs)))
|
||||||
home-bash-extension-bashrc extension-configs)))
|
(bash-logout
|
||||||
(bash-logout
|
(append bash-logout
|
||||||
(append bash-logout
|
(append-map
|
||||||
(append-map
|
home-bash-extension-bash-logout extension-configs))))))
|
||||||
home-bash-extension-bash-logout extension-configs)))))))
|
|
||||||
|
|
||||||
(define home-bash-service-type
|
(define home-bash-service-type
|
||||||
(service-type (name 'home-bash)
|
(service-type (name 'home-bash)
|
||||||
|
|
|
@ -383,25 +383,25 @@ configuration."
|
||||||
(define (serialize-alist config)
|
(define (serialize-alist config)
|
||||||
(generic-serialize-alist append format-config config))
|
(generic-serialize-alist append format-config config))
|
||||||
|
|
||||||
(define (serialize-xdg-desktop-action action)
|
(define (serialize-xdg-desktop-action desktop-action)
|
||||||
(match action
|
(match-record desktop-action <xdg-desktop-action>
|
||||||
(($ <xdg-desktop-action> action name config)
|
(action name config)
|
||||||
`(,(format #f "[Desktop Action ~a]\n"
|
`(,(format #f "[Desktop Action ~a]\n"
|
||||||
(string-capitalize (maybe-object->string action)))
|
(string-capitalize (maybe-object->string action)))
|
||||||
,(format #f "Name=~a\n" name)
|
,(format #f "Name=~a\n" name)
|
||||||
,@(serialize-alist config)))))
|
,@(serialize-alist config))))
|
||||||
|
|
||||||
(match entry
|
(match-record entry <xdg-desktop-entry>
|
||||||
(($ <xdg-desktop-entry> file name type config actions)
|
(file name type config actions)
|
||||||
(list (if (string-suffix? file ".desktop")
|
(list (if (string-suffix? file ".desktop")
|
||||||
file
|
file
|
||||||
(string-append file ".desktop"))
|
(string-append file ".desktop"))
|
||||||
`("[Desktop Entry]\n"
|
`("[Desktop Entry]\n"
|
||||||
,(format #f "Name=~a\n" name)
|
,(format #f "Name=~a\n" name)
|
||||||
,(format #f "Type=~a\n"
|
,(format #f "Type=~a\n"
|
||||||
(string-capitalize (symbol->string type)))
|
(string-capitalize (symbol->string type)))
|
||||||
,@(serialize-alist config)
|
,@(serialize-alist config)
|
||||||
,@(append-map serialize-xdg-desktop-action actions))))))
|
,@(append-map serialize-xdg-desktop-action actions)))))
|
||||||
|
|
||||||
(define-configuration home-xdg-mime-applications-configuration
|
(define-configuration home-xdg-mime-applications-configuration
|
||||||
(added
|
(added
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue