summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2022-11-19 17:37:24 +0100
committerLudovic Courtès <ludo@gnu.org>2022-12-08 13:21:46 +0100
commit93d37985da59fbd5a42c0d868dc3616b0f8d05cc (patch)
tree5f984b4119385d0211f1dc0e452585581d45a739
parent883aa80b45c10628322c52f9912188d3a85b5639 (diff)
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.
-rw-r--r--gnu/home/services/mcron.scm58
-rw-r--r--gnu/home/services/shells.scm50
-rw-r--r--gnu/home/services/xdg.scm38
3 files changed, 73 insertions, 73 deletions
diff --git a/gnu/home/services/mcron.scm b/gnu/home/services/mcron.scm
index 1d294a997c5..5f35bfe0545 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."))
77(define shepherd-schedule-action 77(define shepherd-schedule-action
78 (@@ (gnu services mcron) shepherd-schedule-action)) 78 (@@ (gnu services mcron) shepherd-schedule-action))
79 79
80(define home-mcron-shepherd-services 80(define (home-mcron-shepherd-services config)
81 (match-lambda 81 (match-record config <home-mcron-configuration>
82 (($ <home-mcron-configuration> mcron '()) ; no jobs to run 82 (mcron jobs log? log-format)
83 '()) 83 (if (null? jobs)
84 (($ <home-mcron-configuration> mcron jobs log? log-format) 84 '() ;no jobs to run
85 (let ((files (job-files mcron jobs))) 85 (let ((files (job-files mcron jobs)))
86 (list (shepherd-service 86 (list (shepherd-service
87 (documentation "User cron jobs.") 87 (documentation "User cron jobs.")
88 (provision '(mcron)) 88 (provision '(mcron))
89 (modules `((srfi srfi-1) 89 (modules `((srfi srfi-1)
90 (srfi srfi-26) 90 (srfi srfi-26)
91 (ice-9 popen) ; for the 'schedule' action 91 (ice-9 popen) ;for the 'schedule' action
92 (ice-9 rdelim) 92 (ice-9 rdelim)
93 (ice-9 match) 93 (ice-9 match)
94 ,@%default-modules)) 94 ,@%default-modules))
95 (start #~(make-forkexec-constructor 95 (start #~(make-forkexec-constructor
96 (list (string-append #$mcron "/bin/mcron") 96 (list (string-append #$mcron "/bin/mcron")
97 #$@(if log? 97 #$@(if log?
98 #~("--log" "--log-format" #$log-format) 98 #~("--log" "--log-format" #$log-format)
99 #~()) 99 #~())
100 #$@files) 100 #$@files)
101 #:log-file (string-append 101 #:log-file (string-append
102 (or (getenv "XDG_LOG_HOME") 102 (or (getenv "XDG_LOG_HOME")
103 (format #f "~a/.local/var/log" 103 (format #f "~a/.local/var/log"
104 (getenv "HOME"))) 104 (getenv "HOME")))
105 "/mcron.log"))) 105 "/mcron.log")))
106 (stop #~(make-kill-destructor)) 106 (stop #~(make-kill-destructor))
107 (actions 107 (actions
108 (list (shepherd-schedule-action mcron files))))))))) 108 (list (shepherd-schedule-action mcron files)))))))))
109 109
110(define home-mcron-profile (compose list home-mcron-configuration-mcron)) 110(define home-mcron-profile (compose list home-mcron-configuration-mcron))
111 111
diff --git a/gnu/home/services/shells.scm b/gnu/home/services/shells.scm
index 3e346c3813d..b529c8e798e 100644
--- a/gnu/home/services/shells.scm
+++ b/gnu/home/services/shells.scm
@@ -25,6 +25,7 @@
25 #:use-module (gnu packages bash) 25 #:use-module (gnu packages bash)
26 #:use-module (guix gexp) 26 #:use-module (guix gexp)
27 #:use-module (guix packages) 27 #:use-module (guix packages)
28 #:use-module (guix records)
28 #:use-module (srfi srfi-1) 29 #:use-module (srfi srfi-1)
29 #:use-module (srfi srfi-26) 30 #:use-module (srfi srfi-26)
30 #:use-module (ice-9 match) 31 #:use-module (ice-9 match)
@@ -479,31 +480,30 @@ with text blocks from other extensions and the base service.")
479with text blocks from other extensions and the base service.")) 480with text blocks from other extensions and the base service."))
480 481
481(define (home-bash-extensions original-config extension-configs) 482(define (home-bash-extensions original-config extension-configs)
482 (match original-config 483 (match-record original-config <home-bash-configuration>
483 (($ <home-bash-configuration> _ _ environment-variables aliases 484 (environment-variables aliases bash-profile bashrc bash-logout)
484 bash-profile bashrc bash-logout) 485 (home-bash-configuration
485 (home-bash-configuration 486 (inherit original-config)
486 (inherit original-config) 487 (environment-variables
487 (environment-variables 488 (append environment-variables
488 (append environment-variables 489 (append-map
489 (append-map 490 home-bash-extension-environment-variables extension-configs)))
490 home-bash-extension-environment-variables extension-configs))) 491 (aliases
491 (aliases 492 (append aliases
492 (append aliases 493 (append-map
493 (append-map 494 home-bash-extension-aliases extension-configs)))
494 home-bash-extension-aliases extension-configs))) 495 (bash-profile
495 (bash-profile 496 (append bash-profile
496 (append bash-profile 497 (append-map
497 (append-map 498 home-bash-extension-bash-profile extension-configs)))
498 home-bash-extension-bash-profile extension-configs))) 499 (bashrc
499 (bashrc 500 (append bashrc
500 (append bashrc 501 (append-map
501 (append-map 502 home-bash-extension-bashrc extension-configs)))
502 home-bash-extension-bashrc extension-configs))) 503 (bash-logout
503 (bash-logout 504 (append bash-logout
504 (append bash-logout 505 (append-map
505 (append-map 506 home-bash-extension-bash-logout extension-configs))))))
506 home-bash-extension-bash-logout extension-configs)))))))
507 507
508(define home-bash-service-type 508(define home-bash-service-type
509 (service-type (name 'home-bash) 509 (service-type (name 'home-bash)
diff --git a/gnu/home/services/xdg.scm b/gnu/home/services/xdg.scm
index 63c6041cd49..3c6cb773adc 100644
--- a/gnu/home/services/xdg.scm
+++ b/gnu/home/services/xdg.scm
@@ -383,25 +383,25 @@ configuration."
383 (define (serialize-alist config) 383 (define (serialize-alist config)
384 (generic-serialize-alist append format-config config)) 384 (generic-serialize-alist append format-config config))
385 385
386 (define (serialize-xdg-desktop-action action) 386 (define (serialize-xdg-desktop-action desktop-action)
387 (match action 387 (match-record desktop-action <xdg-desktop-action>
388 (($ <xdg-desktop-action> action name config) 388 (action name config)
389 `(,(format #f "[Desktop Action ~a]\n" 389 `(,(format #f "[Desktop Action ~a]\n"
390 (string-capitalize (maybe-object->string action))) 390 (string-capitalize (maybe-object->string action)))
391 ,(format #f "Name=~a\n" name) 391 ,(format #f "Name=~a\n" name)
392 ,@(serialize-alist config))))) 392 ,@(serialize-alist config))))
393 393
394 (match entry 394 (match-record entry <xdg-desktop-entry>
395 (($ <xdg-desktop-entry> file name type config actions) 395 (file name type config actions)
396 (list (if (string-suffix? file ".desktop") 396 (list (if (string-suffix? file ".desktop")
397 file 397 file
398 (string-append file ".desktop")) 398 (string-append file ".desktop"))
399 `("[Desktop Entry]\n" 399 `("[Desktop Entry]\n"
400 ,(format #f "Name=~a\n" name) 400 ,(format #f "Name=~a\n" name)
401 ,(format #f "Type=~a\n" 401 ,(format #f "Type=~a\n"
402 (string-capitalize (symbol->string type))) 402 (string-capitalize (symbol->string type)))
403 ,@(serialize-alist config) 403 ,@(serialize-alist config)
404 ,@(append-map serialize-xdg-desktop-action actions)))))) 404 ,@(append-map serialize-xdg-desktop-action actions)))))
405 405
406(define-configuration home-xdg-mime-applications-configuration 406(define-configuration home-xdg-mime-applications-configuration
407 (added 407 (added