summary refs log tree commit diff
path: root/gnu/services
diff options
context:
space:
mode:
Diffstat (limited to 'gnu/services')
-rw-r--r--gnu/services/admin.scm5
-rw-r--r--gnu/services/base.scm68
-rw-r--r--gnu/services/cuirass.scm2
-rw-r--r--gnu/services/cups.scm4
-rw-r--r--gnu/services/dict.scm3
-rw-r--r--gnu/services/herd.scm9
-rw-r--r--gnu/services/mail.scm52
-rw-r--r--gnu/services/mcron.scm5
-rw-r--r--gnu/services/networking.scm53
-rw-r--r--gnu/services/pm.scm44
-rw-r--r--gnu/services/shepherd.scm4
-rw-r--r--gnu/services/ssh.scm7
-rw-r--r--gnu/services/web.scm24
13 files changed, 210 insertions, 70 deletions
diff --git a/gnu/services/admin.scm b/gnu/services/admin.scm
index deaf677bd9..6ac24e32b0 100644
--- a/gnu/services/admin.scm
+++ b/gnu/services/admin.scm
@@ -1,6 +1,6 @@
 ;;; GNU Guix --- Functional package management for GNU
 ;;; Copyright © 2016 Jan Nieuwenhuizen <janneke@gnu.org>
-;;; Copyright © 2016 Ludovic Courtès <ludo@gnu.org>
+;;; Copyright © 2016, 2017 Ludovic Courtès <ludo@gnu.org>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -115,6 +115,7 @@
                      ;; Add Rottlog to the global profile so users can access
                      ;; the documentation.
                      (service-extension profile-service-type
-                                        (compose list rottlog-rottlog))))))
+                                        (compose list rottlog-rottlog))))
+   (default-value (rottlog-configuration))))
 
 ;;; admin.scm ends here
diff --git a/gnu/services/base.scm b/gnu/services/base.scm
index 95a1ba2a6c..7cd9a34ca2 100644
--- a/gnu/services/base.scm
+++ b/gnu/services/base.scm
@@ -129,6 +129,8 @@
             guix-publish-configuration-host
             guix-publish-configuration-compression-level
             guix-publish-configuration-nar-path
+            guix-publish-configuration-cache
+            guix-publish-configuration-ttl
             guix-publish-service
             guix-publish-service-type
 
@@ -1147,7 +1149,16 @@ the tty to run, among other things."
   #~(begin
       (use-modules (guix build utils))
       (mkdir-p "/var/run/nscd")
-      (mkdir-p "/var/db/nscd")))                  ;for the persistent cache
+      (mkdir-p "/var/db/nscd")                    ;for the persistent cache
+
+      ;; In libc 2.25 nscd uses inotify to watch /etc/resolv.conf, but only if
+      ;; that file exists when it is started.  Thus create it here.  Note: on
+      ;; some systems, such as when NetworkManager is used, /etc/resolv.conf
+      ;; is a symlink, hence 'lstat'.
+      (unless (false-if-exception (lstat "/etc/resolv.conf"))
+        (call-with-output-file "/etc/resolv.conf"
+          (lambda (port)
+            (display "# This is a placeholder.\n" port))))))
 
 (define nscd-service-type
   (service-type (name 'nscd)
@@ -1321,7 +1332,8 @@ failed to register hydra.gnu.org public key: ~a~%" status))))))))
 
 (define %default-authorized-guix-keys
   ;; List of authorized substitute keys.
-  (list (file-append guix "/share/guix/hydra.gnu.org.pub")))
+  (list (file-append guix "/share/guix/hydra.gnu.org.pub")
+        (file-append guix "/share/guix/bayfront.guixsd.org.pub")))
 
 (define-record-type* <guix-configuration>
   guix-configuration make-guix-configuration
@@ -1424,7 +1436,8 @@ failed to register hydra.gnu.org public key: ~a~%" status))))))))
           (service-extension account-service-type guix-accounts)
           (service-extension activation-service-type guix-activation)
           (service-extension profile-service-type
-                             (compose list guix-configuration-guix))))))
+                             (compose list guix-configuration-guix))))
+   (default-value (guix-configuration))))
 
 (define* (guix-service #:optional (config %default-guix-configuration))
   "Return a service that runs the Guix build daemon according to
@@ -1441,14 +1454,21 @@ failed to register hydra.gnu.org public key: ~a~%" status))))))))
            (default 80))
   (host    guix-publish-configuration-host        ;string
            (default "localhost"))
-  (compression-level guix-publish-compression-level ;integer
+  (compression-level guix-publish-configuration-compression-level ;integer
                      (default 3))
-  (nar-path    guix-publish-nar-path              ;string
-               (default "nar")))
+  (nar-path    guix-publish-configuration-nar-path ;string
+               (default "nar"))
+  (cache       guix-publish-configuration-cache   ;#f | string
+               (default #f))
+  (workers     guix-publish-configuration-workers ;#f | integer
+               (default #f))
+  (ttl         guix-publish-configuration-ttl     ;#f | integer
+               (default #f)))
 
 (define guix-publish-shepherd-service
   (match-lambda
-    (($ <guix-publish-configuration> guix port host compression nar-path)
+    (($ <guix-publish-configuration> guix port host compression
+                                     nar-path cache workers ttl)
      (list (shepherd-service
             (provision '(guix-publish))
             (requirement '(guix-daemon))
@@ -1458,7 +1478,20 @@ failed to register hydra.gnu.org public key: ~a~%" status))))))))
                             "-p" #$(number->string port)
                             "-C" #$(number->string compression)
                             (string-append "--nar-path=" #$nar-path)
-                            (string-append "--listen=" #$host))))
+                            (string-append "--listen=" #$host)
+                            #$@(if workers
+                                   #~((string-append "--workers="
+                                                     #$(number->string
+                                                        workers)))
+                                   #~())
+                            #$@(if ttl
+                                   #~((string-append "--ttl="
+                                                     #$(number->string ttl)
+                                                     "s"))
+                                   #~())
+                            #$@(if cache
+                                   #~((string-append "--cache=" #$cache))
+                                   #~()))))
             (stop #~(make-kill-destructor)))))))
 
 (define %guix-publish-accounts
@@ -1471,13 +1504,30 @@ failed to register hydra.gnu.org public key: ~a~%" status))))))))
          (home-directory "/var/empty")
          (shell (file-append shadow "/sbin/nologin")))))
 
+(define (guix-publish-activation config)
+  (let ((cache (guix-publish-configuration-cache config)))
+    (if cache
+        (with-imported-modules '((guix build utils))
+          #~(begin
+              (use-modules (guix build utils))
+
+              (mkdir-p #$cache)
+              (let* ((pw  (getpw "guix-publish"))
+                     (uid (passwd:uid pw))
+                     (gid (passwd:gid pw)))
+                (chown #$cache uid gid))))
+        #t)))
+
 (define guix-publish-service-type
   (service-type (name 'guix-publish)
                 (extensions
                  (list (service-extension shepherd-root-service-type
                                           guix-publish-shepherd-service)
                        (service-extension account-service-type
-                                          (const %guix-publish-accounts))))))
+                                          (const %guix-publish-accounts))
+                       (service-extension activation-service-type
+                                          guix-publish-activation)))
+                (default-value (guix-publish-configuration))))
 
 (define* (guix-publish-service #:key (guix guix) (port 80) (host "localhost"))
   "Return a service that runs @command{guix publish} listening on @var{host}
diff --git a/gnu/services/cuirass.scm b/gnu/services/cuirass.scm
index 237f71a09b..6beabc4b3b 100644
--- a/gnu/services/cuirass.scm
+++ b/gnu/services/cuirass.scm
@@ -87,7 +87,7 @@
      (list (shepherd-service
             (documentation "Run Cuirass.")
             (provision '(cuirass))
-            (requirement '(guix-daemon))
+            (requirement '(guix-daemon networking))
             (start #~(make-forkexec-constructor
                       (list (string-append #$cuirass "/bin/cuirass")
                             "--cache-directory" #$cache-directory
diff --git a/gnu/services/cups.scm b/gnu/services/cups.scm
index 70a71eff0a..4c62e6a6f7 100644
--- a/gnu/services/cups.scm
+++ b/gnu/services/cups.scm
@@ -1022,7 +1022,9 @@ extensions that it uses."
                       (inherit config)
                       (extensions
                        (append (opaque-cups-configuration-extensions config)
-                               extensions)))))))))
+                               extensions)))))))
+
+                (default-value (cups-configuration))))
 
 ;; A little helper to make it easier to document all those fields.
 (define (generate-cups-documentation)
diff --git a/gnu/services/dict.scm b/gnu/services/dict.scm
index 64de111511..69eadafd2e 100644
--- a/gnu/services/dict.scm
+++ b/gnu/services/dict.scm
@@ -162,7 +162,8 @@ database {
           (service-extension activation-service-type
                              (const %dicod-activation))
           (service-extension shepherd-root-service-type
-                             dicod-shepherd-service)))))
+                             dicod-shepherd-service)))
+   (default-value (dicod-configuration))))
 
 (define* (dicod-service #:key (config (dicod-configuration)))
   "Return a service that runs the @command{dicod} daemon, an implementation
diff --git a/gnu/services/herd.scm b/gnu/services/herd.scm
index 03bfbf1d78..f8d60a4802 100644
--- a/gnu/services/herd.scm
+++ b/gnu/services/herd.scm
@@ -1,5 +1,6 @@
 ;;; GNU Guix --- Functional package management for GNU
 ;;; Copyright © 2016 Ludovic Courtès <ludo@gnu.org>
+;;; Copyright © 2017 Mathieu Othacehe <m.othacehe@gmail.com>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -23,7 +24,9 @@
   #:use-module (srfi srfi-34)
   #:use-module (srfi srfi-35)
   #:use-module (ice-9 match)
-  #:export (shepherd-error?
+  #:export (%shepherd-socket-file
+
+            shepherd-error?
             service-not-found-error?
             service-not-found-error-service
             action-not-found-error?
@@ -58,9 +61,9 @@
 ;;; Code:
 
 (define %shepherd-socket-file
-  "/var/run/shepherd/socket")
+  (make-parameter "/var/run/shepherd/socket"))
 
-(define* (open-connection #:optional (file %shepherd-socket-file))
+(define* (open-connection #:optional (file (%shepherd-socket-file)))
   "Open a connection to the daemon, using the Unix-domain socket at FILE, and
 return the socket."
   ;; The protocol is sexp-based and UTF-8-encoded.
diff --git a/gnu/services/mail.scm b/gnu/services/mail.scm
index 20043d7518..6305f06f85 100644
--- a/gnu/services/mail.scm
+++ b/gnu/services/mail.scm
@@ -35,6 +35,7 @@
   #:use-module (guix gexp)
   #:use-module (ice-9 match)
   #:use-module (ice-9 format)
+  #:use-module (srfi srfi-1)
   #:export (dovecot-service
             dovecot-service-type
             dovecot-configuration
@@ -57,6 +58,8 @@
             opensmtpd-service-type
             %default-opensmtpd-config-file
 
+            mail-aliases-service-type
+
             exim-configuration
             exim-configuration?
             exim-service-type
@@ -1662,6 +1665,31 @@ accept from local for any relay
 
 
 ;;;
+;;; mail aliases.
+;;;
+
+(define (mail-aliases-etc aliases)
+  `(("aliases" ,(plain-file "aliases"
+                            ;; Ideally we'd use a format string like
+                            ;; "~:{~a: ~{~a~^,~}\n~}", but it gives a
+                            ;; warning that I can't figure out how to fix,
+                            ;; so we'll just use string-join below instead.
+                            (format #f "~:{~a: ~a\n~}"
+                                    (map (match-lambda
+                                           ((alias addresses ...)
+                                            (list alias (string-join addresses ","))))
+                                         aliases))))))
+
+(define mail-aliases-service-type
+  (service-type
+   (name 'mail-aliases)
+   (extensions
+    (list (service-extension etc-service-type mail-aliases-etc)))
+   (compose concatenate)
+   (extend append)))
+
+
+;;;
 ;;; Exim.
 ;;;
 
@@ -1671,9 +1699,7 @@ accept from local for any relay
   (package       exim-configuration-package ;<package>
                  (default exim))
   (config-file   exim-configuration-config-file ;file-like
-                 (default #f))
-  (aliases       exim-configuration-aliases ;; list of lists
-                 (default '())))
+                 (default #f)))
 
 (define %exim-accounts
   (list (user-group
@@ -1700,7 +1726,7 @@ exim_group = exim
 
 (define exim-shepherd-service
   (match-lambda
-    (($ <exim-configuration> package config-file aliases)
+    (($ <exim-configuration> package config-file)
      (list (shepherd-service
             (provision '(exim mta))
             (documentation "Run the exim daemon.")
@@ -1713,7 +1739,7 @@ exim_group = exim
 
 (define exim-activation
   (match-lambda
-    (($ <exim-configuration> package config-file aliases)
+    (($ <exim-configuration> package config-file)
      (with-imported-modules '((guix build utils))
        #~(begin
            (use-modules (guix build utils))
@@ -1726,20 +1752,6 @@ exim_group = exim
            (zero? (system* #$(file-append package "/bin/exim")
                            "-bV" "-C" #$(exim-computed-config-file package config-file))))))))
 
-(define exim-etc
-  (match-lambda
-    (($ <exim-configuration> package config-file aliases)
-     `(("aliases" ,(plain-file "aliases"
-                               ;; Ideally we'd use a format string like
-                               ;; "~:{~a: ~{~a~^,~}\n~}", but it gives a
-                               ;; warning that I can't figure out how to fix,
-                               ;; so we'll just use string-join below instead.
-                               (format #f "~:{~a: ~a\n~}"
-                                       (map (lambda (entry)
-                                              (list (car entry)
-                                                    (string-join (cdr entry) ",")))
-                                            aliases))))))))
-
 (define exim-profile
   (compose list exim-configuration-package))
 
@@ -1751,4 +1763,4 @@ exim_group = exim
           (service-extension account-service-type (const %exim-accounts))
           (service-extension activation-service-type exim-activation)
           (service-extension profile-service-type exim-profile)
-          (service-extension etc-service-type exim-etc)))))
+          (service-extension mail-aliases-service-type (const '()))))))
diff --git a/gnu/services/mcron.scm b/gnu/services/mcron.scm
index 313c8364f8..b6cb8bc726 100644
--- a/gnu/services/mcron.scm
+++ b/gnu/services/mcron.scm
@@ -1,5 +1,5 @@
 ;;; GNU Guix --- Functional package management for GNU
-;;; Copyright © 2016 Ludovic Courtès <ludo@gnu.org>
+;;; Copyright © 2016, 2017 Ludovic Courtès <ludo@gnu.org>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -97,7 +97,8 @@
                           (mcron-configuration
                            (inherit config)
                            (jobs (append (mcron-configuration-jobs config)
-                                         jobs)))))))
+                                         jobs)))))
+                (default-value (mcron-configuration)))) ;empty job list
 
 (define* (mcron-service jobs #:optional (mcron mcron2))
   "Return an mcron service running @var{mcron} that schedules @var{jobs}, a
diff --git a/gnu/services/networking.scm b/gnu/services/networking.scm
index 85fc0b843a..99a3d493c5 100644
--- a/gnu/services/networking.scm
+++ b/gnu/services/networking.scm
@@ -529,7 +529,8 @@ make an initial adjustment of more than 1,000 seconds."
   tor-configuration?
   (tor              tor-configuration-tor
                     (default tor))
-  (config-file      tor-configuration-config-file)
+  (config-file      tor-configuration-config-file
+                    (default (plain-file "empty" "")))
   (hidden-services  tor-configuration-hidden-services
                     (default '())))
 
@@ -595,17 +596,31 @@ HiddenServicePort ~a ~a~%"
   (match config
     (($ <tor-configuration> tor)
      (let ((torrc (tor-configuration->torrc config)))
-       (list (shepherd-service
-              (provision '(tor))
+       (with-imported-modules (source-module-closure
+                               '((gnu build shepherd)
+                                 (gnu system file-systems)))
+         (list (shepherd-service
+                (provision '(tor))
 
-              ;; Tor needs at least one network interface to be up, hence the
-              ;; dependency on 'loopback'.
-              (requirement '(user-processes loopback syslogd))
+                ;; Tor needs at least one network interface to be up, hence the
+                ;; dependency on 'loopback'.
+                (requirement '(user-processes loopback syslogd))
 
-              (start #~(make-forkexec-constructor
-                        (list (string-append #$tor "/bin/tor") "-f" #$torrc)))
-              (stop #~(make-kill-destructor))
-              (documentation "Run the Tor anonymous network overlay.")))))))
+                (modules '((gnu build shepherd)
+                           (gnu system file-systems)))
+
+                (start #~(make-forkexec-constructor/container
+                          (list #$(file-append tor "/bin/tor") "-f" #$torrc)
+
+                          #:mappings (list (file-system-mapping
+                                            (source "/var/lib/tor")
+                                            (target source)
+                                            (writable? #t))
+                                           (file-system-mapping
+                                            (source "/dev/log") ;for syslog
+                                            (target source)))))
+                (stop #~(make-kill-destructor))
+                (documentation "Run the Tor anonymous network overlay."))))))))
 
 (define (tor-hidden-service-activation config)
   "Return the activation gexp for SERVICES, a list of hidden services."
@@ -652,7 +667,8 @@ HiddenServicePort ~a ~a~%"
                            (inherit config)
                            (hidden-services
                             (append (tor-configuration-hidden-services config)
-                                    services)))))))
+                                    services)))))
+                (default-value (tor-configuration))))
 
 (define* (tor-service #:optional
                       (config-file (plain-file "empty" ""))
@@ -705,9 +721,12 @@ project's documentation} for more information."
   bitlbee-configuration?
   (bitlbee bitlbee-configuration-bitlbee
            (default bitlbee))
-  (interface bitlbee-configuration-interface)
-  (port bitlbee-configuration-port)
-  (extra-settings bitlbee-configuration-extra-settings))
+  (interface bitlbee-configuration-interface
+             (default "127.0.0.1"))
+  (port bitlbee-configuration-port
+        (default 6667))
+  (extra-settings bitlbee-configuration-extra-settings
+                  (default "")))
 
 (define bitlbee-shepherd-service
   (match-lambda
@@ -775,7 +794,8 @@ project's documentation} for more information."
                        (service-extension account-service-type
                                           (const %bitlbee-accounts))
                        (service-extension activation-service-type
-                                          (const %bitlbee-activation))))))
+                                          (const %bitlbee-activation))))
+                (default-value (bitlbee-configuration))))
 
 (define* (bitlbee-service #:key (bitlbee bitlbee)
                           (interface "127.0.0.1") (port 6667)
@@ -988,7 +1008,8 @@ dns=" dns "
                  (list (service-extension shepherd-root-service-type
                                           wpa-supplicant-shepherd-service)
                        (service-extension dbus-root-service-type list)
-                       (service-extension profile-service-type list)))))
+                       (service-extension profile-service-type list)))
+                (default-value wpa-supplicant)))
 
 
 ;;;
diff --git a/gnu/services/pm.scm b/gnu/services/pm.scm
index fe55647eef..d40cb993e2 100644
--- a/gnu/services/pm.scm
+++ b/gnu/services/pm.scm
@@ -20,6 +20,7 @@
   #:use-module (guix gexp)
   #:use-module (guix packages)
   #:use-module (guix records)
+  #:use-module (gnu packages admin)
   #:use-module (gnu packages linux)
   #:use-module (gnu services)
   #:use-module (gnu services base)
@@ -27,7 +28,10 @@
   #:use-module (gnu services shepherd)
   #:use-module (gnu system shadow)
   #:export (tlp-service-type
-            tlp-configuration))
+            tlp-configuration
+
+            thermald-configuration
+            thermald-service-type))
 
 (define (uglify-field-name field-name)
   (let ((str (symbol->string field-name)))
@@ -396,9 +400,45 @@ shutdown on system startup."))
      (service-extension udev-service-type
                         (compose list tlp-configuration-tlp))
      (service-extension activation-service-type
-                        tlp-activation)))))
+                        tlp-activation)))
+   (default-value (tlp-configuration))))
 
 (define (generate-tlp-documentation)
   (generate-documentation
    `((tlp-configuration ,tlp-configuration-fields))
    'tlp-configuration))
+
+
+
+;;;
+;;; thermald
+;;;
+;;; This service implements cpu scaling.  Helps prevent overheating!
+
+(define-record-type* <thermald-configuration>
+  thermald-configuration make-thermald-configuration
+  thermald-configuration?
+  (ignore-cpuid-check? thermald-ignore-cpuid-check?    ;boolean
+                       (default #f))
+  (thermald            thermald-thermald               ;package
+                       (default thermald)))
+
+(define (thermald-shepherd-service config)
+  (list
+   (shepherd-service
+    (provision '(thermald))
+    (documentation "Run thermald cpu frequency scaling.")
+    (start #~(make-forkexec-constructor
+              '(#$(file-append (thermald-thermald config) "/sbin/thermald")
+                "--no-daemon"
+                #$@(if (thermald-ignore-cpuid-check? config)
+                       '("--ignore-cpuid-check")
+                       '()))))
+    (stop #~(make-kill-destructor)))))
+
+(define thermald-service-type
+  (service-type
+   (name 'thermald)
+   (extensions (list (service-extension shepherd-root-service-type
+                                        thermald-shepherd-service)))
+   (default-value (thermald-configuration))))
diff --git a/gnu/services/shepherd.scm b/gnu/services/shepherd.scm
index 5831220541..7281746ab2 100644
--- a/gnu/services/shepherd.scm
+++ b/gnu/services/shepherd.scm
@@ -163,7 +163,7 @@ assertion failure."
                 (raise (condition
                         (&message
                          (message
-                          (format #f (_ "service '~a' provided more than once")
+                          (format #f (G_ "service '~a' provided more than once")
                                   symbol)))))))
 
             (for-each assert-unique (shepherd-service-provision service))
@@ -178,7 +178,7 @@ assertion failure."
                   (raise (condition
                           (&message
                            (message
-                            (format #f (_ "service '~a' requires '~a', \
+                            (format #f (G_ "service '~a' requires '~a', \
 which is not provided by any service")
                                     (match (shepherd-service-provision service)
                                       ((head . _) head)
diff --git a/gnu/services/ssh.scm b/gnu/services/ssh.scm
index b7f9887b30..2a6c8d45c2 100644
--- a/gnu/services/ssh.scm
+++ b/gnu/services/ssh.scm
@@ -1,5 +1,5 @@
 ;;; GNU Guix --- Functional package management for GNU
-;;; Copyright © 2014, 2015, 2016 Ludovic Courtès <ludo@gnu.org>
+;;; Copyright © 2014, 2015, 2016, 2017 Ludovic Courtès <ludo@gnu.org>
 ;;; Copyright © 2016 David Craven <david@craven.ch>
 ;;; Copyright © 2016 Julien Lepiller <julien@lepiller.eu>
 ;;; Copyright © 2017 Clément Lassieur <clement@lassieur.org>
@@ -385,7 +385,7 @@ The other options should be self-descriptive."
 
   (list (shepherd-service
          (documentation "OpenSSH server.")
-         (requirement '(networking syslogd))
+         (requirement '(syslogd))
          (provision '(ssh-daemon))
          (start #~(make-forkexec-constructor #$openssh-command
                                              #:pid-file #$pid-file))
@@ -408,7 +408,8 @@ The other options should be self-descriptive."
                        (service-extension activation-service-type
                                           openssh-activation)
                        (service-extension account-service-type
-                                          (const %openssh-accounts))))))
+                                          (const %openssh-accounts))))
+                (default-value (openssh-configuration))))
 
 
 ;;;
diff --git a/gnu/services/web.scm b/gnu/services/web.scm
index 11408d7b0e..f85b412159 100644
--- a/gnu/services/web.scm
+++ b/gnu/services/web.scm
@@ -2,7 +2,7 @@
 ;;; Copyright © 2015 David Thompson <davet@gnu.org>
 ;;; Copyright © 2015, 2016, 2017 Ludovic Courtès <ludo@gnu.org>
 ;;; Copyright © 2016 ng0 <ng0@we.make.ritual.n0.is>
-;;; Copyright © 2016 Julien Lepiller <julien@lepiller.eu>
+;;; Copyright © 2016, 2017 Julien Lepiller <julien@lepiller.eu>
 ;;; Copyright © 2017 Christopher Baines <mail@cbaines.net>
 ;;;
 ;;; This file is part of GNU Guix.
@@ -154,12 +154,16 @@ of index files."
                          (nginx-server-configuration-server-name server))
                         ";\n"
    (if (nginx-server-configuration-ssl-certificate server)
-       (string-append "      ssl_certificate "
-                      (nginx-server-configuration-ssl-certificate server) ";\n")
+       (let ((certificate (nginx-server-configuration-ssl-certificate server)))
+         ;; lstat fails when the certificate file does not exist: it aborts
+         ;; and lets the user fix their configuration.
+         (lstat certificate)
+         (string-append "      ssl_certificate " certificate ";\n"))
        "")
    (if (nginx-server-configuration-ssl-certificate-key server)
-       (string-append "      ssl_certificate_key "
-                      (nginx-server-configuration-ssl-certificate-key server) ";\n")
+       (let ((key (nginx-server-configuration-ssl-certificate-key server)))
+         (lstat key)
+         (string-append "      ssl_certificate_key " key ";\n"))
        "")
    "      root " (nginx-server-configuration-root server) ";\n"
    "      index " (config-index-strings (nginx-server-configuration-index server)) ";\n"
@@ -180,7 +184,7 @@ of index files."
          (nginx-upstream-configuration-servers upstream)))
    "    }\n"))
 
-(define (default-nginx-config log-directory run-directory server-list upstream-list)
+(define (default-nginx-config nginx log-directory run-directory server-list upstream-list)
   (mixed-text-file "nginx.conf"
                "user nginx nginx;\n"
                "pid " run-directory "/pid;\n"
@@ -192,6 +196,7 @@ of index files."
                "    uwsgi_temp_path " run-directory "/uwsgi_temp;\n"
                "    scgi_temp_path " run-directory "/scgi_temp;\n"
                "    access_log " log-directory "/access.log;\n"
+               "    include " nginx "/share/nginx/conf/mime.types;\n"
                "\n"
                (string-join
                 (filter (lambda (section) (not (null? section)))
@@ -232,10 +237,13 @@ of index files."
          (mkdir-p (string-append #$run-directory "/fastcgi_temp"))
          (mkdir-p (string-append #$run-directory "/uwsgi_temp"))
          (mkdir-p (string-append #$run-directory "/scgi_temp"))
+         ;; Start-up logs. Once configuration is loaded, nginx switches to
+         ;; log-directory.
+         (mkdir-p (string-append #$run-directory "/logs"))
          ;; Check configuration file syntax.
          (system* (string-append #$nginx "/sbin/nginx")
                   "-c" #$(or config-file
-                             (default-nginx-config log-directory
+                             (default-nginx-config nginx log-directory
                                run-directory server-blocks upstream-blocks))
                   "-t")))))
 
@@ -250,7 +258,7 @@ of index files."
                    (zero?
                     (system* #$nginx-binary "-c"
                              #$(or config-file
-                                   (default-nginx-config log-directory
+                                   (default-nginx-config nginx log-directory
                                      run-directory server-blocks upstream-blocks))
                              #$@args))))))