diff options
author | Ludovic Courtès <ludo@gnu.org> | 2022-11-19 17:37:24 +0100 |
---|---|---|
committer | Ludovic Courtès <ludo@gnu.org> | 2022-12-08 13:21:46 +0100 |
commit | 93d37985da59fbd5a42c0d868dc3616b0f8d05cc (patch) | |
tree | 5f984b4119385d0211f1dc0e452585581d45a739 /gnu | |
parent | 883aa80b45c10628322c52f9912188d3a85b5639 (diff) | |
download | guix-93d37985da59fbd5a42c0d868dc3616b0f8d05cc.tar.gz |
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.
Diffstat (limited to 'gnu')
-rw-r--r-- | gnu/home/services/mcron.scm | 58 | ||||
-rw-r--r-- | gnu/home/services/shells.scm | 50 | ||||
-rw-r--r-- | gnu/home/services/xdg.scm | 38 |
3 files changed, 73 insertions, 73 deletions
diff --git a/gnu/home/services/mcron.scm b/gnu/home/services/mcron.scm index 1d294a997c..5f35bfe054 100644 --- a/gnu/home/services/mcron.scm +++ b/gnu/home/services/mcron.scm @@ -77,35 +77,35 @@ Each message is also prefixed by a timestamp by GNU Shepherd.")) (define shepherd-schedule-action (@@ (gnu services mcron) shepherd-schedule-action)) -(define home-mcron-shepherd-services - (match-lambda - (($ <home-mcron-configuration> mcron '()) ; no jobs to run - '()) - (($ <home-mcron-configuration> mcron jobs log? log-format) - (let ((files (job-files mcron jobs))) - (list (shepherd-service - (documentation "User cron jobs.") - (provision '(mcron)) - (modules `((srfi srfi-1) - (srfi srfi-26) - (ice-9 popen) ; for the 'schedule' action - (ice-9 rdelim) - (ice-9 match) - ,@%default-modules)) - (start #~(make-forkexec-constructor - (list (string-append #$mcron "/bin/mcron") - #$@(if log? - #~("--log" "--log-format" #$log-format) - #~()) - #$@files) - #:log-file (string-append - (or (getenv "XDG_LOG_HOME") - (format #f "~a/.local/var/log" - (getenv "HOME"))) - "/mcron.log"))) - (stop #~(make-kill-destructor)) - (actions - (list (shepherd-schedule-action mcron files))))))))) +(define (home-mcron-shepherd-services config) + (match-record config <home-mcron-configuration> + (mcron jobs log? log-format) + (if (null? jobs) + '() ;no jobs to run + (let ((files (job-files mcron jobs))) + (list (shepherd-service + (documentation "User cron jobs.") + (provision '(mcron)) + (modules `((srfi srfi-1) + (srfi srfi-26) + (ice-9 popen) ;for the 'schedule' action + (ice-9 rdelim) + (ice-9 match) + ,@%default-modules)) + (start #~(make-forkexec-constructor + (list (string-append #$mcron "/bin/mcron") + #$@(if log? + #~("--log" "--log-format" #$log-format) + #~()) + #$@files) + #:log-file (string-append + (or (getenv "XDG_LOG_HOME") + (format #f "~a/.local/var/log" + (getenv "HOME"))) + "/mcron.log"))) + (stop #~(make-kill-destructor)) + (actions + (list (shepherd-schedule-action mcron files))))))))) (define home-mcron-profile (compose list home-mcron-configuration-mcron)) diff --git a/gnu/home/services/shells.scm b/gnu/home/services/shells.scm index 3e346c3813..b529c8e798 100644 --- a/gnu/home/services/shells.scm +++ b/gnu/home/services/shells.scm @@ -25,6 +25,7 @@ #:use-module (gnu packages bash) #:use-module (guix gexp) #:use-module (guix packages) + #:use-module (guix records) #:use-module (srfi srfi-1) #:use-module (srfi srfi-26) #: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.")) (define (home-bash-extensions original-config extension-configs) - (match original-config - (($ <home-bash-configuration> _ _ environment-variables aliases - bash-profile bashrc bash-logout) - (home-bash-configuration - (inherit original-config) - (environment-variables - (append environment-variables - (append-map - home-bash-extension-environment-variables extension-configs))) - (aliases - (append aliases - (append-map - home-bash-extension-aliases extension-configs))) - (bash-profile - (append bash-profile - (append-map - home-bash-extension-bash-profile extension-configs))) - (bashrc - (append bashrc - (append-map - home-bash-extension-bashrc extension-configs))) - (bash-logout - (append bash-logout - (append-map - home-bash-extension-bash-logout extension-configs))))))) + (match-record original-config <home-bash-configuration> + (environment-variables aliases bash-profile bashrc bash-logout) + (home-bash-configuration + (inherit original-config) + (environment-variables + (append environment-variables + (append-map + home-bash-extension-environment-variables extension-configs))) + (aliases + (append aliases + (append-map + home-bash-extension-aliases extension-configs))) + (bash-profile + (append bash-profile + (append-map + home-bash-extension-bash-profile extension-configs))) + (bashrc + (append bashrc + (append-map + home-bash-extension-bashrc extension-configs))) + (bash-logout + (append bash-logout + (append-map + home-bash-extension-bash-logout extension-configs)))))) (define home-bash-service-type (service-type (name 'home-bash) diff --git a/gnu/home/services/xdg.scm b/gnu/home/services/xdg.scm index 63c6041cd4..3c6cb773ad 100644 --- a/gnu/home/services/xdg.scm +++ b/gnu/home/services/xdg.scm @@ -383,25 +383,25 @@ configuration." (define (serialize-alist config) (generic-serialize-alist append format-config config)) - (define (serialize-xdg-desktop-action action) - (match action - (($ <xdg-desktop-action> action name config) - `(,(format #f "[Desktop Action ~a]\n" - (string-capitalize (maybe-object->string action))) - ,(format #f "Name=~a\n" name) - ,@(serialize-alist config))))) - - (match entry - (($ <xdg-desktop-entry> file name type config actions) - (list (if (string-suffix? file ".desktop") - file - (string-append file ".desktop")) - `("[Desktop Entry]\n" - ,(format #f "Name=~a\n" name) - ,(format #f "Type=~a\n" - (string-capitalize (symbol->string type))) - ,@(serialize-alist config) - ,@(append-map serialize-xdg-desktop-action actions)))))) + (define (serialize-xdg-desktop-action desktop-action) + (match-record desktop-action <xdg-desktop-action> + (action name config) + `(,(format #f "[Desktop Action ~a]\n" + (string-capitalize (maybe-object->string action))) + ,(format #f "Name=~a\n" name) + ,@(serialize-alist config)))) + + (match-record entry <xdg-desktop-entry> + (file name type config actions) + (list (if (string-suffix? file ".desktop") + file + (string-append file ".desktop")) + `("[Desktop Entry]\n" + ,(format #f "Name=~a\n" name) + ,(format #f "Type=~a\n" + (string-capitalize (symbol->string type))) + ,@(serialize-alist config) + ,@(append-map serialize-xdg-desktop-action actions))))) (define-configuration home-xdg-mime-applications-configuration (added |