From 995b391013aa61c6e7d8d6b89d822542e155286b Mon Sep 17 00:00:00 2001 From: Ricardo Wurmus Date: Sun, 15 Mar 2020 12:03:19 +0100 Subject: services/web: Remove empty events directive from default-nginx-config. * gnu/services/web.scm (default-nginx-config): Remove empty events directive. --- gnu/services/web.scm | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'gnu/services') diff --git a/gnu/services/web.scm b/gnu/services/web.scm index d093f60c8d..e2178faeb8 100644 --- a/gnu/services/web.scm +++ b/gnu/services/web.scm @@ -657,8 +657,7 @@ of index files." (map emit-nginx-upstream-config upstream-blocks) (map emit-nginx-server-config server-blocks) extra-content - "\n}\n" - "events {}\n")))) + "\n}\n")))) (define %nginx-accounts (list (user-group (name "nginx") (system? #t)) -- cgit v1.2.3 From b420e6deb96e0760f12e3d941b76e690c4235e47 Mon Sep 17 00:00:00 2001 From: Ricardo Wurmus Date: Sun, 15 Mar 2020 12:03:57 +0100 Subject: services/web: nginx-configuration: Add support for global directives. * gnu/services/web.scm ()[global-directives]: Add field. (emit-global-directive): New procedure. (default-nginx-config): Use it. * doc/guix.texi (Web Services): Document it. --- doc/guix.texi | 11 +++++++++++ gnu/services/web.scm | 10 ++++++++++ 2 files changed, 21 insertions(+) (limited to 'gnu/services') diff --git a/doc/guix.texi b/doc/guix.texi index 4658c6f5eb..28808b0cd5 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -20272,6 +20272,17 @@ names of loadable modules, as in this example: /etc/nginx/modules/ngx_http_accept_language_module.so"))) @end lisp +@item @code{global-directives} (default: @code{'()}) +Association list of global directives for the top level of the nginx +configuration. Values may themselves be association lists. + +@lisp +(global-directives + `((worker_processes . 16) + (pcre_jit . on) + (events . ((worker_connections . 1024))))) +@end lisp + @item @code{extra-content} (default: @code{""}) Extra content for the @code{http} block. Should be string or a string valued G-expression. diff --git a/gnu/services/web.scm b/gnu/services/web.scm index e2178faeb8..3edc751ea2 100644 --- a/gnu/services/web.scm +++ b/gnu/services/web.scm @@ -529,6 +529,7 @@ (server-names-hash-bucket-max-size nginx-configuration-server-names-hash-bucket-max-size (default #f)) (modules nginx-configuration-modules (default '())) + (global-directives nginx-configuration-global-directives (default '())) (extra-content nginx-configuration-extra-content (default "")) (file nginx-configuration-file ;#f | string | file-like @@ -552,6 +553,13 @@ of index files." (define (emit-load-module module) (list "load_module " module ";\n")) +(define emit-global-directive + (match-lambda + ((key . (? list? alist)) + (format #f "~a { ~{~a~}}~%" key (map emit-global-directive alist))) + ((key . value) + (format #f "~a ~a;~%" key value)))) + (define emit-nginx-location-config (match-lambda (($ uri body) @@ -626,12 +634,14 @@ of index files." server-names-hash-bucket-size server-names-hash-bucket-max-size modules + global-directives extra-content) (apply mixed-text-file "nginx.conf" (flatten "user nginx nginx;\n" "pid " run-directory "/pid;\n" "error_log " log-directory "/error.log info;\n" + (map emit-global-directive global-directives) (map emit-load-module modules) "http {\n" " client_body_temp_path " run-directory "/client_body_temp;\n" -- cgit v1.2.3 From 2ec46078630a09b326822a7565fc7764fd9957a7 Mon Sep 17 00:00:00 2001 From: Tobias Geerinckx-Rice Date: Mon, 16 Mar 2020 02:16:38 +0100 Subject: services: nginx: Fix broken default configuration. * gnu/services/web.scm (nginx-configuration): Emit an empty events{} block by default. * doc/guix.texi (Web Services): Document it. --- doc/guix.texi | 2 +- gnu/services/web.scm | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) (limited to 'gnu/services') diff --git a/doc/guix.texi b/doc/guix.texi index 28808b0cd5..202d1347f7 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -20272,7 +20272,7 @@ names of loadable modules, as in this example: /etc/nginx/modules/ngx_http_accept_language_module.so"))) @end lisp -@item @code{global-directives} (default: @code{'()}) +@item @code{global-directives} (default: @code{'((events . ()))}) Association list of global directives for the top level of the nginx configuration. Values may themselves be association lists. diff --git a/gnu/services/web.scm b/gnu/services/web.scm index 3edc751ea2..ac247ec39a 100644 --- a/gnu/services/web.scm +++ b/gnu/services/web.scm @@ -11,6 +11,7 @@ ;;; Copyright © 2018 Marius Bakke ;;; Copyright © 2019 Florian Pelz ;;; Copyright © 2020 Ricardo Wurmus +;;; Copyright © 2020 Tobias Geerinckx-Rice ;;; ;;; This file is part of GNU Guix. ;;; @@ -529,7 +530,8 @@ (server-names-hash-bucket-max-size nginx-configuration-server-names-hash-bucket-max-size (default #f)) (modules nginx-configuration-modules (default '())) - (global-directives nginx-configuration-global-directives (default '())) + (global-directives nginx-configuration-global-directives + (default '((events . ())))) (extra-content nginx-configuration-extra-content (default "")) (file nginx-configuration-file ;#f | string | file-like -- cgit v1.2.3 From 85f0958693588191852b3f3c04c413fc089b0c81 Mon Sep 17 00:00:00 2001 From: Ricardo Wurmus Date: Mon, 16 Mar 2020 09:58:56 +0100 Subject: services/web: Export nginx-configuration-global-directives. This is a follow-up to commit b420e6deb96e0760f12e3d941b76e690c4235e47. * gnu/services/web.scm (nginx-configuration-global-directives): Export procedure. --- gnu/services/web.scm | 1 + 1 file changed, 1 insertion(+) (limited to 'gnu/services') diff --git a/gnu/services/web.scm b/gnu/services/web.scm index ac247ec39a..fa5c34d5af 100644 --- a/gnu/services/web.scm +++ b/gnu/services/web.scm @@ -100,6 +100,7 @@ nginx-configuration-server-names-hash-bucket-size nginx-configuration-server-names-hash-bucket-max-size nginx-configuration-modules + nginx-configuration-global-directives nginx-configuration-extra-content nginx-configuration-file -- cgit v1.2.3 From 0f13dd2b7f7675310e4a9bbfd37ee946b9f0dea3 Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Mon, 16 Mar 2020 11:25:57 +0100 Subject: services: dhcpd: Use 'invoke/quiet' when validating the config file. This avoids the lengthy copyright/config message from dhcpd. * gnu/services/networking.scm (dhcpd-activation): Use 'invoke/quiet' instead of 'invoke'. --- gnu/services/networking.scm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'gnu/services') diff --git a/gnu/services/networking.scm b/gnu/services/networking.scm index 59b895d60b..618dd95969 100644 --- a/gnu/services/networking.scm +++ b/gnu/services/networking.scm @@ -1,5 +1,5 @@ ;;; GNU Guix --- Functional package management for GNU -;;; Copyright © 2013, 2014, 2015, 2016, 2017, 2018, 2019 Ludovic Courtès +;;; Copyright © 2013, 2014, 2015, 2016, 2017, 2018, 2019, 2020 Ludovic Courtès ;;; Copyright © 2015 Mark H Weaver ;;; Copyright © 2016, 2018 Efraim Flashner ;;; Copyright © 2016 John Darrington @@ -313,7 +313,7 @@ Protocol (DHCP) client, on all the non-loopback network interfaces." (with-output-to-file #$lease-file (lambda _ (display "")))) ;; Validate the config. - (invoke + (invoke/quiet #$(file-append package "/sbin/dhcpd") "-t" "-cf" #$config-file)))))) -- cgit v1.2.3 From a37e03d60e18dfcf119d0b92d9008e54fc350bf1 Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Mon, 16 Mar 2020 12:21:05 +0100 Subject: tests: opensmtpd: Check /var/spool/mail instead of /var/mail. The test had been failing since the upgrade to 6.6.3p1 in commit 2dbfd8eec43b602d23cee3fdd2842cc333e36c24. * gnu/services/mail.scm (opensmtpd-activation): Create /var/spool/mail. * gnu/tests/mail.scm (run-opensmtpd-test): Check /var/spool/mail instead of /var/mail. --- gnu/services/mail.scm | 4 +++- gnu/tests/mail.scm | 6 +++--- 2 files changed, 6 insertions(+), 4 deletions(-) (limited to 'gnu/services') diff --git a/gnu/services/mail.scm b/gnu/services/mail.scm index d97316512f..7791780dfc 100644 --- a/gnu/services/mail.scm +++ b/gnu/services/mail.scm @@ -1670,7 +1670,9 @@ match from local for any action outbound ;; Create mbox and spool directories. (mkdir-p "/var/mail") (mkdir-p "/var/spool/smtpd") - (chmod "/var/spool/smtpd" #o711)))))) + (chmod "/var/spool/smtpd" #o711) + (mkdir-p "/var/spool/mail") + (chmod "/var/spool/mail" #o711)))))) (define %opensmtpd-pam-services (list (unix-pam-service "smtpd"))) diff --git a/gnu/tests/mail.scm b/gnu/tests/mail.scm index 58172cd1d6..a50fb1dbca 100644 --- a/gnu/tests/mail.scm +++ b/gnu/tests/mail.scm @@ -99,8 +99,8 @@ match from any for local action inbound (test-assert "mbox is empty" (marionette-eval - '(and (file-exists? "/var/mail") - (not (file-exists? "/var/mail/root"))) + '(and (file-exists? "/var/spool/mail") + (not (file-exists? "/var/spool/mail/root"))) marionette)) (test-eq "accept an email" @@ -150,7 +150,7 @@ match from any for local action inbound (let wait ((n 20)) (cond ((queue-empty?) - (file-exists? "/var/mail/root")) + (file-exists? "/var/spool/mail/root")) ((zero? n) (error "root mailbox didn't show up")) (else -- cgit v1.2.3 From e28770df718b733959a4cae933e9c2e8d32715be Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Mon, 16 Mar 2020 17:45:32 +0100 Subject: services: nfs: Move activation snippet out of line. * gnu/services/nfs.scm (%nfs-activation): New variable. (nfs-service-type)[extensions]: Refer to %NFS-ACTIVATION. --- gnu/services/nfs.scm | 42 +++++++++++++++++++++++------------------- 1 file changed, 23 insertions(+), 19 deletions(-) (limited to 'gnu/services') diff --git a/gnu/services/nfs.scm b/gnu/services/nfs.scm index 140a11856a..3b7dd78eca 100644 --- a/gnu/services/nfs.scm +++ b/gnu/services/nfs.scm @@ -360,31 +360,35 @@ #t)) (respawn? #f))))) +(define %nfs-activation + (with-imported-modules '((guix build utils)) + #~(begin + (use-modules (guix build utils)) + + (system* "mount" "-t" "nfsd" + "nfsd" "/proc/fs/nfsd") + + (mkdir-p "/var/lib/nfs") + ;; directory containing monitor list + (mkdir-p "/var/lib/nfs/sm") + ;; Needed for client recovery tracking + (mkdir-p "/var/lib/nfs/v4recovery") + (let ((user (getpw "nobody"))) + (chown "/var/lib/nfs" + (passwd:uid user) + (passwd:gid user)) + (chown "/var/lib/nfs/v4recovery" + (passwd:uid user) + (passwd:gid user))) + #t))) + (define nfs-service-type (service-type (name 'nfs) (extensions (list (service-extension shepherd-root-service-type nfs-shepherd-services) - (service-extension activation-service-type - (const #~(begin - (use-modules (guix build utils)) - (system* "mount" "-t" "nfsd" - "nfsd" "/proc/fs/nfsd") - - (mkdir-p "/var/lib/nfs") - ;; directory containing monitor list - (mkdir-p "/var/lib/nfs/sm") - ;; Needed for client recovery tracking - (mkdir-p "/var/lib/nfs/v4recovery") - (let ((user (getpw "nobody"))) - (chown "/var/lib/nfs" - (passwd:uid user) - (passwd:gid user)) - (chown "/var/lib/nfs/v4recovery" - (passwd:uid user) - (passwd:gid user))) - #t))) + (service-extension activation-service-type (const %nfs-activation)) (service-extension etc-service-type (lambda (config) `(("exports" -- cgit v1.2.3 From 70526bdbe0221ed9077df31cb24374100685725b Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Mon, 16 Mar 2020 18:31:09 +0100 Subject: services: nfs: Remove unnecessary "mount" invocation. * gnu/services/nfs.scm (%nfs-activation): Remove unnecessary "mount" invocation (/proc/fs/nfsd is automatically mounted, somehow). Remove unnecessary 'mkdir-p' call. --- gnu/services/nfs.scm | 4 ---- 1 file changed, 4 deletions(-) (limited to 'gnu/services') diff --git a/gnu/services/nfs.scm b/gnu/services/nfs.scm index 3b7dd78eca..c90984387e 100644 --- a/gnu/services/nfs.scm +++ b/gnu/services/nfs.scm @@ -365,10 +365,6 @@ #~(begin (use-modules (guix build utils)) - (system* "mount" "-t" "nfsd" - "nfsd" "/proc/fs/nfsd") - - (mkdir-p "/var/lib/nfs") ;; directory containing monitor list (mkdir-p "/var/lib/nfs/sm") ;; Needed for client recovery tracking -- cgit v1.2.3