From 543d971ed2a1d9eb934af1f51930741d7cc4e7ef Mon Sep 17 00:00:00 2001 From: Maxim Cournoyer Date: Fri, 28 Oct 2022 17:06:16 -0400 Subject: services: configuration: Re-order generated record fields. This is so that the first field of the generated record matches the first one declared, which makes 'define-configuration' record API compatible with define-record-type* ones. * gnu/services/configuration.scm (define-configuration-helper): Move the %location field below the ones declared by the user. * gnu/services/monitoring.scm (zabbix-front-end-config): Adjust match pattern accordingly. --- gnu/services/monitoring.scm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'gnu/services/monitoring.scm') diff --git a/gnu/services/monitoring.scm b/gnu/services/monitoring.scm index 9c8704092c..b19c6c9f18 100644 --- a/gnu/services/monitoring.scm +++ b/gnu/services/monitoring.scm @@ -622,8 +622,8 @@ (define-configuration zabbix-front-end-configuration (define (zabbix-front-end-config config) (match-record config - (%location db-host db-port db-name db-user db-password db-secret-file - zabbix-host zabbix-port) + (db-host db-port db-name db-user db-password db-secret-file + zabbix-host zabbix-port %location) (mixed-text-file "zabbix.conf.php" "\ Date: Sun, 13 Nov 2022 01:00:00 +0100 Subject: services: configuration: Revert to a working ‘guix home’. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This reverts commit 543d971ed2a1d9eb934af1f51930741d7cc4e7ef, and its dependent commit 9b21cd2e9a614f1937769caf3917a791b151d841, which appear to have triggered a recent wave of ‘guix home’ regressions involving (services (list (service home-bash-service-type))): In gnu/home/services/shells.scm: 504:7 3 (home-bash-extensions #< package: # …) In unknown file: 2 (append #< file: "…" line: 14 column: 12> ()) In ice-9/boot-9.scm: 1685:16 1 (raise-exception _ #:continuable? _) 1685:16 0 (raise-exception _ #:continuable? _) ice-9/boot-9.scm:1685:16: In procedure raise-exception: In procedure append: Wrong type argument in position 1 (expecting empty list): #< file: "…" line: 14 column: 12> I should love to dive in & fix this rather than revert, but urgently need sleep. --- doc/guix.texi | 45 ++++++++-------------------------------- gnu/home/services/mcron.scm | 47 ++++++++++-------------------------------- gnu/services/configuration.scm | 10 ++++----- gnu/services/mcron.scm | 47 ++++++++++-------------------------------- gnu/services/monitoring.scm | 4 ++-- 5 files changed, 38 insertions(+), 115 deletions(-) (limited to 'gnu/services/monitoring.scm') diff --git a/doc/guix.texi b/doc/guix.texi index ef3b8e127e..4d974be53e 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -19019,33 +19019,20 @@ words, it is possible to define services that provide additional mcron jobs to run. @end defvr -@c Generated via (generate-documentation) at the bottom of (gnu services -@c mcron). -@c %start of fragment @deftp {Data Type} mcron-configuration -Available @code{mcron-configuration} fields are: +Data type representing the configuration of mcron. @table @asis -@item @code{mcron} (default: @code{mcron}) (type: file-like) +@item @code{mcron} (default: @var{mcron}) The mcron package to use. -@item @code{jobs} (default: @code{()}) (type: list-of-gexps) +@item @code{jobs} This is a list of gexps (@pxref{G-Expressions}), where each gexp corresponds to an mcron job specification (@pxref{Syntax, mcron job -specifications,, mcron,GNU@tie{}mcron}). - -@item @code{log?} (default: @code{#t}) (type: boolean) -Log messages to standard output. - -@item @code{log-format} (default: @code{"~1@@*~a ~a: ~a~%"}) (type: string) -@code{(ice-9 format)} format string for log messages. The default value -produces messages like "@samp{@var{pid} @var{name}: @var{message}"} -(@pxref{Invoking mcron, Invoking,, mcron,GNU@tie{}mcron}). Each message -is also prefixed by a timestamp by GNU Shepherd. - +specifications,, mcron, GNU@tie{}mcron}). @end table @end deftp -@c %end of fragment + @node Log Rotation @subsection Log Rotation @@ -41081,32 +41068,18 @@ jobs to run. @end defvr @deftp {Data Type} home-mcron-configuration -Available @code{home-mcron-configuration} fields are: +Data type representing the configuration of mcron. -@c Auto-generated with (gnu home services mcron)'s -@c generate-documentation procedure. -@c %start of fragment @table @asis -@item @code{mcron} (default: @code{mcron}) (type: file-like) +@item @code{mcron} (default: @var{mcron}) The mcron package to use. -@item @code{jobs} (default: @code{()}) (type: list-of-gexps) +@item @code{jobs} This is a list of gexps (@pxref{G-Expressions}), where each gexp corresponds to an mcron job specification (@pxref{Syntax, mcron job -specifications,, mcron,GNU@tie{}mcron}). - -@item @code{log?} (default: @code{#t}) (type: boolean) -Log messages to standard output. - -@item @code{log-format} (default: @code{"~1@@*~a ~a: ~a~%"}) (type: string) -@code{(ice-9 format)} format string for log messages. The default value -produces messages like "@samp{@var{pid} @var{name}: @var{message}"} -(@pxref{Invoking mcron, Invoking,, mcron,GNU@tie{}mcron}). Each message -is also prefixed by a timestamp by GNU Shepherd. - +specifications,, mcron, GNU@tie{}mcron}). @end table @end deftp -@c %end of fragment @node Power Management Home Services @subsection Power Management Home Services diff --git a/gnu/home/services/mcron.scm b/gnu/home/services/mcron.scm index 1d294a997c..0b3dbb810b 100644 --- a/gnu/home/services/mcron.scm +++ b/gnu/home/services/mcron.scm @@ -1,7 +1,6 @@ ;;; GNU Guix --- Functional package management for GNU ;;; Copyright © 2021 Andrew Tropin ;;; Copyright © 2021 Xinglu Chen -;;; Copyright © 2022 Maxim Cournoyer ;;; ;;; This file is part of GNU Guix. ;;; @@ -21,7 +20,6 @@ (define-module (gnu home services mcron) #:use-module (gnu packages guile-xyz) #:use-module (gnu home services) - #:use-module (gnu services configuration) #:use-module (gnu services shepherd) #:use-module (gnu home services shepherd) #:use-module (guix records) @@ -55,23 +53,13 @@ (define-module (gnu home services mcron) ;; ;;; Code: -(define list-of-gexps? - (list-of gexp?)) - -(define-configuration/no-serialization home-mcron-configuration - (mcron (file-like mcron) "The mcron package to use.") - (jobs - (list-of-gexps '()) - "This is a list of gexps (@pxref{G-Expressions}), where each gexp -corresponds to an mcron job specification (@pxref{Syntax, mcron job -specifications,, mcron, GNU@tie{}mcron}).") - (log? (boolean #t) "Log messages to standard output.") - (log-format - (string "~1@*~a ~a: ~a~%") - "@code{(ice-9 format)} format string for log messages. The default value -produces messages like \"@samp{@var{pid} @var{name}: -@var{message}\"} (@pxref{Invoking mcron, Invoking,, mcron, GNU@tie{}mcron}). -Each message is also prefixed by a timestamp by GNU Shepherd.")) +(define-record-type* home-mcron-configuration + make-home-mcron-configuration + home-mcron-configuration? + (package home-mcron-configuration-package ; package + (default mcron)) + (jobs home-mcron-configuration-jobs ; list of jobs + (default '()))) (define job-files (@@ (gnu services mcron) job-files)) (define shepherd-schedule-action @@ -81,23 +69,19 @@ (define home-mcron-shepherd-services (match-lambda (($ mcron '()) ; no jobs to run '()) - (($ mcron jobs log? log-format) + (($ mcron jobs) (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 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) + (list #$(file-append mcron "/bin/mcron") #$@files) #:log-file (string-append (or (getenv "XDG_LOG_HOME") (format #f "~a/.local/var/log" @@ -107,7 +91,7 @@ (define home-mcron-shepherd-services (actions (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-package)) (define (home-mcron-extend config jobs) (home-mcron-configuration @@ -129,12 +113,3 @@ (define home-mcron-service-type (default-value (home-mcron-configuration)) (description "Install and configure the GNU mcron cron job manager."))) - - -;;; -;;; Generate documentation. -;;; -(define (generate-doc) - (configuration->documentation 'home-mcron-configuration)) - -;;; mcron.scm ends here diff --git a/gnu/services/configuration.scm b/gnu/services/configuration.scm index dacfc52ba9..636c49ccba 100644 --- a/gnu/services/configuration.scm +++ b/gnu/services/configuration.scm @@ -242,17 +242,17 @@ (define-record-type* #,(id #'stem #'< #'stem #'>) stem #,(id #'stem #'make- #'stem) #,(id #'stem #'stem #'?) + (%location #,(id #'stem #'stem #'-location) + (default (and=> (current-source-location) + source-properties->location)) + (innate)) #,@(map (lambda (name getter def) #`(#,name #,getter (default #,def) (sanitize #,(id #'stem #'validate- #'stem #'- name)))) #'(field ...) #'(field-getter ...) - #'(field-default ...)) - (%location #,(id #'stem #'stem #'-location) - (default (and=> (current-source-location) - source-properties->location)) - (innate))) + #'(field-default ...))) (define #,(id #'stem #'stem #'-fields) (list (configuration-field diff --git a/gnu/services/mcron.scm b/gnu/services/mcron.scm index 52332d6123..23760ebda4 100644 --- a/gnu/services/mcron.scm +++ b/gnu/services/mcron.scm @@ -1,6 +1,5 @@ ;;; GNU Guix --- Functional package management for GNU ;;; Copyright © 2016, 2017, 2018, 2019, 2020 Ludovic Courtès -;;; Copyright © 2022 Maxim Cournoyer ;;; ;;; This file is part of GNU Guix. ;;; @@ -19,7 +18,6 @@ (define-module (gnu services mcron) #:use-module (gnu services) - #:use-module (gnu services configuration) #:use-module (gnu services shepherd) #:use-module (gnu packages guile-xyz) #:use-module (guix deprecation) @@ -32,8 +30,6 @@ (define-module (gnu services mcron) mcron-configuration? mcron-configuration-mcron mcron-configuration-jobs - mcron-configuration-log? - mcron-configuration-log-format mcron-service-type)) @@ -52,23 +48,13 @@ (define-module (gnu services mcron) ;;; ;;; Code: -(define list-of-gexps? - (list-of gexp?)) - -(define-configuration/no-serialization mcron-configuration - (mcron (file-like mcron) "The mcron package to use.") - (jobs - (list-of-gexps '()) - "This is a list of gexps (@pxref{G-Expressions}), where each gexp -corresponds to an mcron job specification (@pxref{Syntax, mcron job -specifications,, mcron, GNU@tie{}mcron}).") - (log? (boolean #t) "Log messages to standard output.") - (log-format - (string "~1@*~a ~a: ~a~%") - "@code{(ice-9 format)} format string for log messages. The default value -produces messages like \"@samp{@var{pid} @var{name}: -@var{message}\"} (@pxref{Invoking mcron, Invoking,, mcron, GNU@tie{}mcron}). -Each message is also prefixed by a timestamp by GNU Shepherd.")) +(define-record-type* mcron-configuration + make-mcron-configuration + mcron-configuration? + (mcron mcron-configuration-mcron ;file-like + (default mcron)) + (jobs mcron-configuration-jobs ;list of + (default '()))) (define (job-files mcron jobs) "Return a list of file-like object for JOBS, a list of gexps." @@ -138,25 +124,21 @@ (define (shepherd-schedule-action mcron files) (define mcron-shepherd-services (match-lambda - (($ mcron ()) ;nothing to do! + (($ mcron ()) ;nothing to do! '()) - (($ mcron jobs log? log-format) + (($ mcron jobs) (let ((files (job-files mcron jobs))) (list (shepherd-service (provision '(mcron)) (requirement '(user-processes)) (modules `((srfi srfi-1) (srfi srfi-26) - (ice-9 popen) ;for the 'schedule' action + (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) + (list (string-append #$mcron "/bin/mcron") #$@files) ;; Disable auto-compilation of the job files and set a ;; sane value for 'PATH'. @@ -190,11 +172,4 @@ (define mcron-service-type jobs))))) (default-value (mcron-configuration)))) ;empty job list - -;;; -;;; Generate documentation. -;;; -(define (generate-doc) - (configuration->documentation 'mcron-configuration)) - ;;; mcron.scm ends here diff --git a/gnu/services/monitoring.scm b/gnu/services/monitoring.scm index b19c6c9f18..9c8704092c 100644 --- a/gnu/services/monitoring.scm +++ b/gnu/services/monitoring.scm @@ -622,8 +622,8 @@ (define-configuration zabbix-front-end-configuration (define (zabbix-front-end-config config) (match-record config - (db-host db-port db-name db-user db-password db-secret-file - zabbix-host zabbix-port %location) + (%location db-host db-port db-name db-user db-password db-secret-file + zabbix-host zabbix-port) (mixed-text-file "zabbix.conf.php" "\ Date: Wed, 16 Nov 2022 23:09:17 -0500 Subject: Revert "services: configuration: Revert to a working ‘guix home’." MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This reverts commit 39e4e00f75be8055300cb0afffb8bd4b4d35f2cc, with fixes for the guix home issues reported and another one found while reconfiguring berlin in the subsequent commit. --- doc/guix.texi | 45 ++++++++++++++++++++++++++++++++-------- gnu/home/services/mcron.scm | 47 ++++++++++++++++++++++++++++++++---------- gnu/services/configuration.scm | 10 ++++----- gnu/services/mcron.scm | 47 ++++++++++++++++++++++++++++++++---------- gnu/services/monitoring.scm | 4 ++-- 5 files changed, 115 insertions(+), 38 deletions(-) (limited to 'gnu/services/monitoring.scm') diff --git a/doc/guix.texi b/doc/guix.texi index 4d974be53e..ef3b8e127e 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -19019,20 +19019,33 @@ words, it is possible to define services that provide additional mcron jobs to run. @end defvr +@c Generated via (generate-documentation) at the bottom of (gnu services +@c mcron). +@c %start of fragment @deftp {Data Type} mcron-configuration -Data type representing the configuration of mcron. +Available @code{mcron-configuration} fields are: @table @asis -@item @code{mcron} (default: @var{mcron}) +@item @code{mcron} (default: @code{mcron}) (type: file-like) The mcron package to use. -@item @code{jobs} +@item @code{jobs} (default: @code{()}) (type: list-of-gexps) This is a list of gexps (@pxref{G-Expressions}), where each gexp corresponds to an mcron job specification (@pxref{Syntax, mcron job -specifications,, mcron, GNU@tie{}mcron}). +specifications,, mcron,GNU@tie{}mcron}). + +@item @code{log?} (default: @code{#t}) (type: boolean) +Log messages to standard output. + +@item @code{log-format} (default: @code{"~1@@*~a ~a: ~a~%"}) (type: string) +@code{(ice-9 format)} format string for log messages. The default value +produces messages like "@samp{@var{pid} @var{name}: @var{message}"} +(@pxref{Invoking mcron, Invoking,, mcron,GNU@tie{}mcron}). Each message +is also prefixed by a timestamp by GNU Shepherd. + @end table @end deftp - +@c %end of fragment @node Log Rotation @subsection Log Rotation @@ -41068,18 +41081,32 @@ jobs to run. @end defvr @deftp {Data Type} home-mcron-configuration -Data type representing the configuration of mcron. +Available @code{home-mcron-configuration} fields are: +@c Auto-generated with (gnu home services mcron)'s +@c generate-documentation procedure. +@c %start of fragment @table @asis -@item @code{mcron} (default: @var{mcron}) +@item @code{mcron} (default: @code{mcron}) (type: file-like) The mcron package to use. -@item @code{jobs} +@item @code{jobs} (default: @code{()}) (type: list-of-gexps) This is a list of gexps (@pxref{G-Expressions}), where each gexp corresponds to an mcron job specification (@pxref{Syntax, mcron job -specifications,, mcron, GNU@tie{}mcron}). +specifications,, mcron,GNU@tie{}mcron}). + +@item @code{log?} (default: @code{#t}) (type: boolean) +Log messages to standard output. + +@item @code{log-format} (default: @code{"~1@@*~a ~a: ~a~%"}) (type: string) +@code{(ice-9 format)} format string for log messages. The default value +produces messages like "@samp{@var{pid} @var{name}: @var{message}"} +(@pxref{Invoking mcron, Invoking,, mcron,GNU@tie{}mcron}). Each message +is also prefixed by a timestamp by GNU Shepherd. + @end table @end deftp +@c %end of fragment @node Power Management Home Services @subsection Power Management Home Services diff --git a/gnu/home/services/mcron.scm b/gnu/home/services/mcron.scm index 0b3dbb810b..1d294a997c 100644 --- a/gnu/home/services/mcron.scm +++ b/gnu/home/services/mcron.scm @@ -1,6 +1,7 @@ ;;; GNU Guix --- Functional package management for GNU ;;; Copyright © 2021 Andrew Tropin ;;; Copyright © 2021 Xinglu Chen +;;; Copyright © 2022 Maxim Cournoyer ;;; ;;; This file is part of GNU Guix. ;;; @@ -20,6 +21,7 @@ (define-module (gnu home services mcron) #:use-module (gnu packages guile-xyz) #:use-module (gnu home services) + #:use-module (gnu services configuration) #:use-module (gnu services shepherd) #:use-module (gnu home services shepherd) #:use-module (guix records) @@ -53,13 +55,23 @@ (define-module (gnu home services mcron) ;; ;;; Code: -(define-record-type* home-mcron-configuration - make-home-mcron-configuration - home-mcron-configuration? - (package home-mcron-configuration-package ; package - (default mcron)) - (jobs home-mcron-configuration-jobs ; list of jobs - (default '()))) +(define list-of-gexps? + (list-of gexp?)) + +(define-configuration/no-serialization home-mcron-configuration + (mcron (file-like mcron) "The mcron package to use.") + (jobs + (list-of-gexps '()) + "This is a list of gexps (@pxref{G-Expressions}), where each gexp +corresponds to an mcron job specification (@pxref{Syntax, mcron job +specifications,, mcron, GNU@tie{}mcron}).") + (log? (boolean #t) "Log messages to standard output.") + (log-format + (string "~1@*~a ~a: ~a~%") + "@code{(ice-9 format)} format string for log messages. The default value +produces messages like \"@samp{@var{pid} @var{name}: +@var{message}\"} (@pxref{Invoking mcron, Invoking,, mcron, GNU@tie{}mcron}). +Each message is also prefixed by a timestamp by GNU Shepherd.")) (define job-files (@@ (gnu services mcron) job-files)) (define shepherd-schedule-action @@ -69,19 +81,23 @@ (define home-mcron-shepherd-services (match-lambda (($ mcron '()) ; no jobs to run '()) - (($ mcron jobs) + (($ 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 popen) ; for the 'schedule' action (ice-9 rdelim) (ice-9 match) ,@%default-modules)) (start #~(make-forkexec-constructor - (list #$(file-append mcron "/bin/mcron") #$@files) + (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" @@ -91,7 +107,7 @@ (define home-mcron-shepherd-services (actions (list (shepherd-schedule-action mcron files))))))))) -(define home-mcron-profile (compose list home-mcron-configuration-package)) +(define home-mcron-profile (compose list home-mcron-configuration-mcron)) (define (home-mcron-extend config jobs) (home-mcron-configuration @@ -113,3 +129,12 @@ (define home-mcron-service-type (default-value (home-mcron-configuration)) (description "Install and configure the GNU mcron cron job manager."))) + + +;;; +;;; Generate documentation. +;;; +(define (generate-doc) + (configuration->documentation 'home-mcron-configuration)) + +;;; mcron.scm ends here diff --git a/gnu/services/configuration.scm b/gnu/services/configuration.scm index 636c49ccba..dacfc52ba9 100644 --- a/gnu/services/configuration.scm +++ b/gnu/services/configuration.scm @@ -242,17 +242,17 @@ (define-record-type* #,(id #'stem #'< #'stem #'>) stem #,(id #'stem #'make- #'stem) #,(id #'stem #'stem #'?) - (%location #,(id #'stem #'stem #'-location) - (default (and=> (current-source-location) - source-properties->location)) - (innate)) #,@(map (lambda (name getter def) #`(#,name #,getter (default #,def) (sanitize #,(id #'stem #'validate- #'stem #'- name)))) #'(field ...) #'(field-getter ...) - #'(field-default ...))) + #'(field-default ...)) + (%location #,(id #'stem #'stem #'-location) + (default (and=> (current-source-location) + source-properties->location)) + (innate))) (define #,(id #'stem #'stem #'-fields) (list (configuration-field diff --git a/gnu/services/mcron.scm b/gnu/services/mcron.scm index 23760ebda4..52332d6123 100644 --- a/gnu/services/mcron.scm +++ b/gnu/services/mcron.scm @@ -1,5 +1,6 @@ ;;; GNU Guix --- Functional package management for GNU ;;; Copyright © 2016, 2017, 2018, 2019, 2020 Ludovic Courtès +;;; Copyright © 2022 Maxim Cournoyer ;;; ;;; This file is part of GNU Guix. ;;; @@ -18,6 +19,7 @@ (define-module (gnu services mcron) #:use-module (gnu services) + #:use-module (gnu services configuration) #:use-module (gnu services shepherd) #:use-module (gnu packages guile-xyz) #:use-module (guix deprecation) @@ -30,6 +32,8 @@ (define-module (gnu services mcron) mcron-configuration? mcron-configuration-mcron mcron-configuration-jobs + mcron-configuration-log? + mcron-configuration-log-format mcron-service-type)) @@ -48,13 +52,23 @@ (define-module (gnu services mcron) ;;; ;;; Code: -(define-record-type* mcron-configuration - make-mcron-configuration - mcron-configuration? - (mcron mcron-configuration-mcron ;file-like - (default mcron)) - (jobs mcron-configuration-jobs ;list of - (default '()))) +(define list-of-gexps? + (list-of gexp?)) + +(define-configuration/no-serialization mcron-configuration + (mcron (file-like mcron) "The mcron package to use.") + (jobs + (list-of-gexps '()) + "This is a list of gexps (@pxref{G-Expressions}), where each gexp +corresponds to an mcron job specification (@pxref{Syntax, mcron job +specifications,, mcron, GNU@tie{}mcron}).") + (log? (boolean #t) "Log messages to standard output.") + (log-format + (string "~1@*~a ~a: ~a~%") + "@code{(ice-9 format)} format string for log messages. The default value +produces messages like \"@samp{@var{pid} @var{name}: +@var{message}\"} (@pxref{Invoking mcron, Invoking,, mcron, GNU@tie{}mcron}). +Each message is also prefixed by a timestamp by GNU Shepherd.")) (define (job-files mcron jobs) "Return a list of file-like object for JOBS, a list of gexps." @@ -124,21 +138,25 @@ (define (shepherd-schedule-action mcron files) (define mcron-shepherd-services (match-lambda - (($ mcron ()) ;nothing to do! + (($ mcron ()) ;nothing to do! '()) - (($ mcron jobs) + (($ mcron jobs log? log-format) (let ((files (job-files mcron jobs))) (list (shepherd-service (provision '(mcron)) (requirement '(user-processes)) (modules `((srfi srfi-1) (srfi srfi-26) - (ice-9 popen) ;for the 'schedule' action + (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") #$@files) + (list (string-append #$mcron "/bin/mcron") + #$@(if log? + #~("--log" "--log-format" #$log-format) + #~()) + #$@files) ;; Disable auto-compilation of the job files and set a ;; sane value for 'PATH'. @@ -172,4 +190,11 @@ (define mcron-service-type jobs))))) (default-value (mcron-configuration)))) ;empty job list + +;;; +;;; Generate documentation. +;;; +(define (generate-doc) + (configuration->documentation 'mcron-configuration)) + ;;; mcron.scm ends here diff --git a/gnu/services/monitoring.scm b/gnu/services/monitoring.scm index 9c8704092c..b19c6c9f18 100644 --- a/gnu/services/monitoring.scm +++ b/gnu/services/monitoring.scm @@ -622,8 +622,8 @@ (define-configuration zabbix-front-end-configuration (define (zabbix-front-end-config config) (match-record config - (%location db-host db-port db-name db-user db-password db-secret-file - zabbix-host zabbix-port) + (db-host db-port db-name db-user db-password db-secret-file + zabbix-host zabbix-port %location) (mixed-text-file "zabbix.conf.php" "\ Date: Wed, 16 Nov 2022 23:10:39 -0500 Subject: Fix problems initially introduced in commit 543d971ed2, now reinstated. Commit 543d971ed2 ("services: configuration: Re-order generated record fields") introduced two regressions, one in guix home and another one in the zabbix service. * gnu/home/services/shells.scm (home-bash-extensions): Remove the first pattern in the match, which used to be to ignore %location. * gnu/services/monitoring.scm (zabbix-front-end-nginx-extension): Likewise. --- gnu/home/services/shells.scm | 2 +- gnu/services/monitoring.scm | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'gnu/services/monitoring.scm') diff --git a/gnu/home/services/shells.scm b/gnu/home/services/shells.scm index 172e58a9ff..3e346c3813 100644 --- a/gnu/home/services/shells.scm +++ b/gnu/home/services/shells.scm @@ -480,7 +480,7 @@ (define-configuration/no-serialization home-bash-extension (define (home-bash-extensions original-config extension-configs) (match original-config - (($ _ _ _ environment-variables aliases + (($ _ _ environment-variables aliases bash-profile bashrc bash-logout) (home-bash-configuration (inherit original-config) diff --git a/gnu/services/monitoring.scm b/gnu/services/monitoring.scm index b19c6c9f18..d6dc2c1e03 100644 --- a/gnu/services/monitoring.scm +++ b/gnu/services/monitoring.scm @@ -576,7 +576,7 @@ (define %zabbix-front-end-configuration-nginx (define (zabbix-front-end-nginx-extension config) (match config - (($ _ server nginx) + (($ server nginx) (if (null? nginx) (list (nginx-server-configuration -- cgit v1.2.3 From 10251c4456c4ec97a1f3604431241128f3e04729 Mon Sep 17 00:00:00 2001 From: Marius Bakke Date: Wed, 7 Dec 2022 18:40:42 +0100 Subject: services: zabbix: Don't write user to configuration file. The service already runs with the specified user and group, so there is no use in writing it to the configuration files. This change is mainly done for compatibility with 'zabbix-agent2' which does not understand the User= setting, but also to document the correct data type for the "group" setting. * gnu/services/monitoring.scm (serialize-string): Filter USER and GROUP fields. (group?, serialize-group): Remove variables. (zabbix-server-configuration, zabbix-agent-configuration): Document the GROUP field as 'string'. * doc/guix.texi (Monitoring Services): Adjust accordingly. --- doc/guix.texi | 4 ++-- gnu/services/monitoring.scm | 15 ++++++--------- 2 files changed, 8 insertions(+), 11 deletions(-) (limited to 'gnu/services/monitoring.scm') diff --git a/doc/guix.texi b/doc/guix.texi index a79b777826..50487a5172 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -28126,7 +28126,7 @@ The zabbix-server package. @item @code{user} (default: @code{"zabbix"}) (type: string) User who will run the Zabbix server. -@item @code{group} (default: @code{"zabbix"}) (type: group) +@item @code{group} (default: @code{"zabbix"}) (type: string) Group who will run the Zabbix server. @item @code{db-host} (default: @code{"127.0.0.1"}) (type: string) @@ -28212,7 +28212,7 @@ The zabbix-agent package. @item @code{user} (default: @code{"zabbix"}) (type: string) User who will run the Zabbix agent. -@item @code{group} (default: @code{"zabbix"}) (type: group) +@item @code{group} (default: @code{"zabbix"}) (type: string) Group who will run the Zabbix agent. @item @code{hostname} (default: @code{""}) (type: string) diff --git a/gnu/services/monitoring.scm b/gnu/services/monitoring.scm index d6dc2c1e03..f12b7acb1f 100644 --- a/gnu/services/monitoring.scm +++ b/gnu/services/monitoring.scm @@ -224,15 +224,12 @@ (define (serialize-list field-name val) (define (serialize-string field-name val) - (if (and (string? val) (string=? val "")) + (if (or (eq? 'user field-name) + (eq? 'group field-name) + (and (string? val) (string=? val ""))) "" (serialize-field field-name val))) -(define group? string?) - -(define serialize-group - (const "")) - (define include-files? list?) (define (serialize-include-files field-name val) @@ -256,8 +253,8 @@ (define-configuration zabbix-server-configuration (user (string "zabbix") "User who will run the Zabbix server.") - (group ;for zabbix-server-account procedure - (group "zabbix") + (group + (string "zabbix") "Group who will run the Zabbix server.") (db-host (string "127.0.0.1") @@ -438,7 +435,7 @@ (define-configuration zabbix-agent-configuration (string "zabbix") "User who will run the Zabbix agent.") (group - (group "zabbix") + (string "zabbix") "Group who will run the Zabbix agent.") (hostname (string "") -- cgit v1.2.3 From 40153fe03358a69c1b2f53237511f73ee83910a2 Mon Sep 17 00:00:00 2001 From: Marius Bakke Date: Wed, 7 Dec 2022 18:47:10 +0100 Subject: services: zabbix-agent: Adjust command-line when using zabbix_agent2. * gnu/services/monitoring.scm (zabbix-agent-arguments): New procedure. (zabbix-agent-shepherd-service): Use that to determine command line arguments. --- gnu/services/monitoring.scm | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) (limited to 'gnu/services/monitoring.scm') diff --git a/gnu/services/monitoring.scm b/gnu/services/monitoring.scm index f12b7acb1f..9a88351566 100644 --- a/gnu/services/monitoring.scm +++ b/gnu/services/monitoring.scm @@ -513,6 +513,18 @@ (define (zabbix-agent-config-file config) (format port #$(serialize-configuration config zabbix-agent-configuration-fields))))))) +(define (zabbix-agent-arguments config) + #~(let* ((config-file #$(zabbix-agent-config-file config)) + (agent #$(zabbix-agent-configuration-zabbix-agent config)) + (agent2? (file-exists? (string-append agent "/sbin/zabbix_agent2")))) + (if agent2? + (list (string-append agent "/sbin/zabbix_agent2") + "-config" config-file + "-foreground") + (list (string-append agent "/sbin/zabbix_agentd") + "--config" config-file + "--foreground")))) + (define (zabbix-agent-shepherd-service config) "Return a for Zabbix agent with CONFIG." (list (shepherd-service @@ -520,10 +532,7 @@ (define (zabbix-agent-shepherd-service config) (requirement '(user-processes)) (documentation "Run Zabbix agent daemon.") (start #~(make-forkexec-constructor - (list #$(file-append (zabbix-agent-configuration-zabbix-agent config) - "/sbin/zabbix_agentd") - "--config" #$(zabbix-agent-config-file config) - "--foreground") + #$(zabbix-agent-arguments config) #:user #$(zabbix-agent-configuration-user config) #:group #$(zabbix-agent-configuration-group config) #:pid-file #$(zabbix-agent-configuration-pid-file config) -- cgit v1.2.3 From 16f87d883b79b38da7d4297e8eb30c8f6eb735c1 Mon Sep 17 00:00:00 2001 From: Marius Bakke Date: Mon, 12 Dec 2022 14:57:02 +0100 Subject: services: zabbix-server: Increase Shepherd grace period. * gnu/services/monitoring.scm (zabbix-server-shepherd-service)[stop]: Add #:grace-period. --- gnu/services/monitoring.scm | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'gnu/services/monitoring.scm') diff --git a/gnu/services/monitoring.scm b/gnu/services/monitoring.scm index 9a88351566..44e2e8886c 100644 --- a/gnu/services/monitoring.scm +++ b/gnu/services/monitoring.scm @@ -404,7 +404,10 @@ (define (zabbix-server-shepherd-service config) /etc/ssl/certs" "SSL_CERT_FILE=/run/current-system/profile\ /etc/ssl/certs/ca-certificates.crt"))) - (stop #~(make-kill-destructor)))))) + (stop #~(make-kill-destructor + ;; The server needs to finish database work on shutdown + ;; which can take a while for big or busy databases. + #:grace-period 60)))))) (define zabbix-server-service-type (service-type -- cgit v1.2.3