1
Fork 0
mirror of https://https.git.savannah.gnu.org/git/guix.git/ synced 2025-07-12 18:10:47 +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:
Ludovic Courtès 2022-11-19 17:37:24 +01:00
parent 883aa80b45
commit 93d37985da
No known key found for this signature in database
GPG key ID: 090B11993D9AEBB5
3 changed files with 72 additions and 72 deletions

View file

@ -77,11 +77,11 @@ 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.")

View file

@ -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,9 +480,8 @@ 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
@ -503,7 +503,7 @@ with text blocks from other extensions and the base service."))
(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)

View file

@ -383,16 +383,16 @@ 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"))
@ -401,7 +401,7 @@ configuration."
,(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