summaryrefslogtreecommitdiff
path: root/gnu/services
diff options
context:
space:
mode:
Diffstat (limited to 'gnu/services')
-rw-r--r--gnu/services/mail.scm4
-rw-r--r--gnu/services/networking.scm4
-rw-r--r--gnu/services/nfs.scm38
-rw-r--r--gnu/services/web.scm16
4 files changed, 38 insertions, 24 deletions
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/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 <ludo@gnu.org>
+;;; Copyright © 2013, 2014, 2015, 2016, 2017, 2018, 2019, 2020 Ludovic Courtès <ludo@gnu.org>
;;; Copyright © 2015 Mark H Weaver <mhw@netris.org>
;;; Copyright © 2016, 2018 Efraim Flashner <efraim@flashner.co.il>
;;; Copyright © 2016 John Darrington <jmd@gnu.org>
@@ -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))))))
diff --git a/gnu/services/nfs.scm b/gnu/services/nfs.scm
index 140a11856a..c90984387e 100644
--- a/gnu/services/nfs.scm
+++ b/gnu/services/nfs.scm
@@ -360,31 +360,31 @@
#t))
(respawn? #f)))))
+(define %nfs-activation
+ (with-imported-modules '((guix build utils))
+ #~(begin
+ (use-modules (guix build utils))
+
+ ;; 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"
diff --git a/gnu/services/web.scm b/gnu/services/web.scm
index d093f60c8d..fa5c34d5af 100644
--- a/gnu/services/web.scm
+++ b/gnu/services/web.scm
@@ -11,6 +11,7 @@
;;; Copyright © 2018 Marius Bakke <mbakke@fastmail.com>
;;; Copyright © 2019 Florian Pelz <pelzflorian@pelzflorian.de>
;;; Copyright © 2020 Ricardo Wurmus <rekado@elephly.net>
+;;; Copyright © 2020 Tobias Geerinckx-Rice <me@tobias.gr>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -99,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
@@ -529,6 +531,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 '((events . ()))))
(extra-content nginx-configuration-extra-content
(default ""))
(file nginx-configuration-file ;#f | string | file-like
@@ -552,6 +556,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
(($ <nginx-location-configuration> uri body)
@@ -626,12 +637,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"
@@ -657,8 +670,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))