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/cgit.scm13
-rw-r--r--gnu/services/databases.scm9
-rw-r--r--gnu/services/messaging.scm9
-rw-r--r--gnu/services/security-token.scm84
-rw-r--r--gnu/services/web.scm11
5 files changed, 112 insertions, 14 deletions
diff --git a/gnu/services/cgit.scm b/gnu/services/cgit.scm
index 3289d37333..a84a2dadb2 100644
--- a/gnu/services/cgit.scm
+++ b/gnu/services/cgit.scm
@@ -149,6 +149,7 @@
 
 (define (serialize-repo-boolean field-name val)
   (serialize-repo-integer field-name (if val 1 0)))
+(define-maybe repo-boolean)
 
 (define repo-list? list?)
 
@@ -239,27 +240,27 @@ is no suitable HEAD.")
    (repo-file-object "")
    "Override the default @code{email-filter}.")
   (enable-commit-graph?
-   (repo-boolean #f)
+   (maybe-repo-boolean 'disabled)
    "A flag which can be used to disable the global setting
 @code{enable-commit-graph?}.")
   (enable-log-filecount?
-   (repo-boolean #f)
+   (maybe-repo-boolean 'disabled)
    "A flag which can be used to disable the global setting
 @code{enable-log-filecount?}.")
   (enable-log-linecount?
-   (repo-boolean #f)
+   (maybe-repo-boolean 'disabled)
    "A flag which can be used to disable the global setting
 @code{enable-log-linecount?}.")
   (enable-remote-branches?
-   (repo-boolean #f)
+   (maybe-repo-boolean 'disabled)
    "Flag which, when set to @code{#t}, will make cgit display remote
 branches in the summary and refs views.")
   (enable-subject-links?
-   (repo-boolean #f)
+   (maybe-repo-boolean 'disabled)
    "A flag which can be used to override the global setting
 @code{enable-subject-links?}.")
   (enable-html-serving?
-   (repo-boolean #f)
+   (maybe-repo-boolean 'disabled)
    "A flag which can be used to override the global setting
 @code{enable-html-serving?}.")
   (hide?
diff --git a/gnu/services/databases.scm b/gnu/services/databases.scm
index 8ae248ebe4..aff78a0566 100644
--- a/gnu/services/databases.scm
+++ b/gnu/services/databases.scm
@@ -221,13 +221,20 @@ host	all	all	::1/128 	trust"))
                        (setuid (passwd:uid user))
                        (execl pg_ctl pg_ctl "-D" #$data-directory "-o" options
                               mode)))))))
+            (pid-file (in-vicinity data-directory "postmaster.pid"))
             (action (lambda args
                       #~(lambda _
-                          (invoke #$pg_ctl-wrapper #$@args)))))
+                          (invoke #$pg_ctl-wrapper #$@args)
+                          (match '#$args
+                            (("start")
+                             (call-with-input-file #$pid-file read))
+                            (_ #t))))))
        (list (shepherd-service
               (provision '(postgres))
               (documentation "Run the PostgreSQL daemon.")
               (requirement '(user-processes loopback syslogd))
+              (modules `((ice-9 match)
+                         ,@%default-modules))
               (start (action "start"))
               (stop (action "stop"))))))))
 
diff --git a/gnu/services/messaging.scm b/gnu/services/messaging.scm
index 4b7e724a78..1108006411 100644
--- a/gnu/services/messaging.scm
+++ b/gnu/services/messaging.scm
@@ -632,13 +632,20 @@ See also @url{https://prosody.im/doc/modules/mod_muc}."
                       (opaque-prosody-configuration-prosody config)
                       (prosody-configuration-prosody config)))
          (prosodyctl-bin (file-append prosody "/bin/prosodyctl"))
+         (pid-file (prosody-configuration-pidfile config))
          (prosodyctl-action (lambda args
                               #~(lambda _
-                                  (zero? (system* #$prosodyctl-bin #$@args))))))
+                                  (invoke #$prosodyctl-bin #$@args)
+                                  (match '#$args
+                                    (("start")
+                                     (call-with-input-file #$pid-file read))
+                                    (_ #t))))))
     (list (shepherd-service
            (documentation "Run the Prosody XMPP server")
            (provision '(prosody xmpp-daemon))
            (requirement '(networking syslogd user-processes))
+           (modules `((ice-9 match)
+                      ,@%default-modules))
            (start (prosodyctl-action "start"))
            (stop (prosodyctl-action "stop"))))))
 
diff --git a/gnu/services/security-token.scm b/gnu/services/security-token.scm
new file mode 100644
index 0000000000..7e7ea54a50
--- /dev/null
+++ b/gnu/services/security-token.scm
@@ -0,0 +1,84 @@
+;;; GNU Guix --- Functional package management for GNU
+;;; Copyright © 2018 Arun Isaac <arunisaac@systemreboot.net>
+;;;
+;;; This file is part of GNU Guix.
+;;;
+;;; GNU Guix is free software; you can redistribute it and/or modify it
+;;; under the terms of the GNU General Public License as published by
+;;; the Free Software Foundation; either version 3 of the License, or (at
+;;; your option) any later version.
+;;;
+;;; GNU Guix is distributed in the hope that it will be useful, but
+;;; WITHOUT ANY WARRANTY; without even the implied warranty of
+;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;;; GNU General Public License for more details.
+;;;
+;;; You should have received a copy of the GNU General Public License
+;;; along with GNU Guix.  If not, see <http://www.gnu.org/licenses/>.
+
+(define-module (gnu services security-token)
+  #:use-module (gnu services)
+  #:use-module (gnu services shepherd)
+  #:use-module (gnu packages admin)
+  #:use-module (gnu packages security-token)
+  #:use-module (gnu system shadow)
+  #:use-module (guix gexp)
+  #:use-module (guix modules)
+  #:use-module (guix records)
+  #:use-module (ice-9 match)
+  #:use-module (srfi srfi-26)
+  #:export (pcscd-configuration
+            pcscd-configuration?
+            pcscd-configuration-pcsc-lite
+            pcscd-configuration-usb-drivers
+            pcscd-service-type))
+
+;;;
+;;; PC/SC Smart Card Daemon
+;;;
+
+(define-record-type* <pcscd-configuration>
+  pcscd-configuration make-pcscd-configuration pcscd-configuration?
+  (pcsc-lite pcscd-configuration-pcsc-lite
+             (default pcsc-lite))
+  (usb-drivers pcscd-configuration-usb-drivers
+               (default (list ccid))))
+
+(define pcscd-shepherd-service
+  (match-lambda
+    (($ <pcscd-configuration> pcsc-lite)
+     (with-imported-modules (source-module-closure
+                             '((gnu build shepherd)))
+       (shepherd-service
+        (documentation "PC/SC Smart Card Daemon")
+        (provision '(pcscd))
+        (requirement '(syslogd))
+        (modules '((gnu build shepherd)))
+        (start #~(lambda _
+                   (invoke #$(file-append pcsc-lite "/sbin/pcscd"))
+                   (call-with-input-file "/var/run/pcscd/pcscd.pid" read)))
+        (stop #~(make-kill-destructor)))))))
+
+(define pcscd-activation
+  (match-lambda
+    (($ <pcscd-configuration> pcsc-lite usb-drivers)
+     #~(begin
+         (use-modules (guix build utils))
+         (mkdir-p "/var/lib")
+         (symlink #$(directory-union
+                     "pcsc"
+                     (map (cut file-append <> "/pcsc")
+                          usb-drivers))
+                  "/var/lib/pcsc")))))
+
+(define pcscd-service-type
+  (service-type
+   (name 'pcscd)
+   (description
+    "Run @command{pcscd}, the PC/SC smart card daemon.")
+   (extensions
+    (list (service-extension shepherd-root-service-type
+                             (compose list pcscd-shepherd-service))
+          (service-extension activation-service-type
+                             pcscd-activation)))
+   (default-value (pcscd-configuration))))
diff --git a/gnu/services/web.scm b/gnu/services/web.scm
index 9a58eff5ef..97976509b6 100644
--- a/gnu/services/web.scm
+++ b/gnu/services/web.scm
@@ -5,7 +5,7 @@
 ;;; Copyright © 2016, 2017, 2018 Julien Lepiller <julien@lepiller.eu>
 ;;; Copyright © 2017 Christopher Baines <mail@cbaines.net>
 ;;; Copyright © 2017 nee <nee-git@hidamari.blue>
-;;; Copyright © 2017 Clément Lassieur <clement@lassieur.org>
+;;; Copyright © 2017, 2018 Clément Lassieur <clement@lassieur.org>
 ;;; Copyright © 2018 Pierre-Antoine Rouby <pierre-antoine.rouby@inria.fr>
 ;;;
 ;;; This file is part of GNU Guix.
@@ -602,11 +602,10 @@ of index files."
           (nginx-action
            (lambda args
              #~(lambda _
-                 (zero?
-                  (system* #$nginx-binary "-c"
-                           #$(or file
-                                 (default-nginx-config config))
-                           #$@args))))))
+                 (invoke #$nginx-binary "-c"
+                         #$(or file
+                               (default-nginx-config config))
+                         #$@args)))))
 
      ;; TODO: Add 'reload' action.
      (list (shepherd-service