diff options
Diffstat (limited to 'gnu/services')
-rw-r--r-- | gnu/services/audio.scm | 6 | ||||
-rw-r--r-- | gnu/services/avahi.scm | 4 | ||||
-rw-r--r-- | gnu/services/base.scm | 36 | ||||
-rw-r--r-- | gnu/services/cuirass.scm | 4 | ||||
-rw-r--r-- | gnu/services/monitoring.scm | 81 | ||||
-rw-r--r-- | gnu/services/science.scm | 18 | ||||
-rw-r--r-- | gnu/services/security-token.scm | 3 | ||||
-rw-r--r-- | gnu/services/virtualization.scm | 15 |
8 files changed, 134 insertions, 33 deletions
diff --git a/gnu/services/audio.scm b/gnu/services/audio.scm index 627b941871..c60053f33c 100644 --- a/gnu/services/audio.scm +++ b/gnu/services/audio.scm @@ -163,7 +163,11 @@ audio_output { (let ((directory #$(mpd-file-name config ".mpd"))) (mkdir-p directory) - (chown directory (passwd:uid %user) (passwd:gid %user)))))) + (chown directory (passwd:uid %user) (passwd:gid %user)) + + ;; Make /var/run/mpd/USER user-owned as well. + (chown (dirname directory) + (passwd:uid %user) (passwd:gid %user)))))) (define %mpd-accounts diff --git a/gnu/services/avahi.scm b/gnu/services/avahi.scm index 54656708ca..7812191cb2 100644 --- a/gnu/services/avahi.scm +++ b/gnu/services/avahi.scm @@ -1,5 +1,5 @@ ;;; GNU Guix --- Functional package management for GNU -;;; Copyright © 2014, 2015, 2016, 2017, 2018, 2019 Ludovic Courtès <ludo@gnu.org> +;;; Copyright © 2014, 2015, 2016, 2017, 2018, 2019, 2020 Ludovic Courtès <ludo@gnu.org> ;;; ;;; This file is part of GNU Guix. ;;; @@ -130,7 +130,7 @@ (list (shepherd-service (documentation "Run the Avahi mDNS/DNS-SD responder.") (provision '(avahi-daemon)) - (requirement '(dbus-system networking)) + (requirement '(user-processes dbus-system networking)) (start #~(make-forkexec-constructor (list #$(file-append avahi "/sbin/avahi-daemon") diff --git a/gnu/services/base.scm b/gnu/services/base.scm index d0d88e18a6..8449d924af 100644 --- a/gnu/services/base.scm +++ b/gnu/services/base.scm @@ -1568,6 +1568,27 @@ proxy of 'guix-daemon'...~%") (environ environment) #t))))) +(define shepherd-discover-action + ;; Shepherd action to enable or disable substitute servers discovery. + (shepherd-action + (name 'discover) + (documentation + "Enable or disable substitute servers discovery and restart the +'guix-daemon'.") + (procedure #~(lambda* (_ status) + (let ((environment (environ))) + (if (and status + (string=? status "on")) + (begin + (format #t "enable substitute servers discovery~%") + (setenv "discover" "on")) + (begin + (format #t "disable substitute servers discovery~%") + (unsetenv "discover"))) + (action 'guix-daemon 'restart) + (environ environment) + #t))))) + (define (guix-shepherd-service config) "Return a <shepherd-service> for the Guix daemon service with CONFIG." (match-record config <guix-configuration> @@ -1579,7 +1600,8 @@ proxy of 'guix-daemon'...~%") (documentation "Run the Guix daemon.") (provision '(guix-daemon)) (requirement '(user-processes)) - (actions (list shepherd-set-http-proxy-action)) + (actions (list shepherd-set-http-proxy-action + shepherd-discover-action)) (modules '((srfi srfi-1) (ice-9 match) (gnu build shepherd))) @@ -1594,6 +1616,9 @@ proxy of 'guix-daemon'...~%") ;; the 'set-http-proxy' action. (or (getenv "http_proxy") #$http-proxy)) + (define discover? + (or (getenv "discover") #$discover?)) + ;; Start the guix-daemon from a container, when supported, ;; to solve an installation issue. See the comment below for ;; more details. @@ -1608,9 +1633,8 @@ proxy of 'guix-daemon'...~%") #$@(if use-substitutes? '() '("--no-substitutes")) - #$@(if discover? - '("--discover=yes") - '()) + (string-append "--discover=" + (if discover? "yes" "no")) "--substitute-urls" #$(string-join substitute-urls) #$@extra-options @@ -1801,7 +1825,9 @@ raise a deprecation warning if the 'compression-level' field was used." advertise?) (list (shepherd-service (provision '(guix-publish)) - (requirement '(guix-daemon)) + (requirement `(user-processes + guix-daemon + ,@(if advertise? '(avahi-daemon) '()))) (start #~(make-forkexec-constructor (list #$(file-append guix "/bin/guix") "publish" "-u" "guix-publish" diff --git a/gnu/services/cuirass.scm b/gnu/services/cuirass.scm index a50f583807..7706ed41c6 100644 --- a/gnu/services/cuirass.scm +++ b/gnu/services/cuirass.scm @@ -69,6 +69,8 @@ (default "cuirass")) (interval cuirass-configuration-interval ;integer (seconds) (default 60)) + (queue-size cuirass-configuration-queue-size + (default 1)) (database cuirass-configuration-database ;string (file-name) (default "/var/lib/cuirass/cuirass.db")) (port cuirass-configuration-port ;integer (port) @@ -98,6 +100,7 @@ (user (cuirass-configuration-user config)) (group (cuirass-configuration-group config)) (interval (cuirass-configuration-interval config)) + (queue-size (cuirass-configuration-queue-size config)) (database (cuirass-configuration-database config)) (ttl (cuirass-configuration-ttl config)) (port (cuirass-configuration-port config)) @@ -119,6 +122,7 @@ "--database" #$database "--ttl" #$(string-append (number->string ttl) "s") "--interval" #$(number->string interval) + "--queue-size" #$(number->string queue-size) #$@(if queries-log-file (list (string-append "--log-queries=" queries-log-file)) diff --git a/gnu/services/monitoring.scm b/gnu/services/monitoring.scm index ac68bce8ac..5123a8c441 100644 --- a/gnu/services/monitoring.scm +++ b/gnu/services/monitoring.scm @@ -36,8 +36,12 @@ #:use-module (srfi srfi-26) #:use-module (srfi srfi-35) #:export (darkstat-configuration - prometheus-node-exporter-configuration darkstat-service-type + + prometheus-node-exporter-configuration + prometheus-node-exporter-configuration? + prometheus-node-exporter-configuration-package + prometheus-node-exporter-web-listen-address prometheus-node-exporter-service-type zabbix-server-configuration @@ -110,6 +114,11 @@ HTTP.") (service-extension shepherd-root-service-type (compose list darkstat-shepherd-service)))))) + +;;; +;;; Prometheus node exporter +;;; + (define-record-type* <prometheus-node-exporter-configuration> prometheus-node-exporter-configuration make-prometheus-node-exporter-configuration @@ -117,31 +126,73 @@ HTTP.") (package prometheus-node-exporter-configuration-package (default go-github-com-prometheus-node-exporter)) (web-listen-address prometheus-node-exporter-web-listen-address - (default ":9100"))) + (default ":9100")) + (textfile-directory prometheus-node-exporter-textfile-directory + (default "/var/lib/prometheus/node-exporter")) + (extra-options prometheus-node-exporter-extra-options + (default '()))) + +(define %prometheus-node-exporter-accounts + (list (user-account + (name "prometheus-node-exporter") + (group "prometheus-node-exporter") + (system? #t) + (comment "Prometheus node exporter daemon user") + (home-directory "/var/empty") + (shell (file-append shadow "/sbin/nologin"))) + (user-group + (name "prometheus-node-exporter") + (system? #t)))) (define prometheus-node-exporter-shepherd-service (match-lambda (( $ <prometheus-node-exporter-configuration> - package web-listen-address) - (shepherd-service - (documentation "Prometheus node exporter.") - (provision '(prometheus-node-exporter)) - (requirement '(networking)) - (start #~(make-forkexec-constructor - (list #$(file-append package "/bin/node_exporter") - "--web.listen-address" #$web-listen-address))) - (stop #~(make-kill-destructor)))))) + package web-listen-address textfile-directory extra-options) + (list + (shepherd-service + (documentation "Prometheus node exporter.") + (provision '(prometheus-node-exporter)) + (requirement '(networking)) + (start #~(make-forkexec-constructor + (list #$(file-append package "/bin/node_exporter") + "--web.listen-address" #$web-listen-address + #$@(if textfile-directory + (list "--collector.textfile.directory" + textfile-directory) + '()) + #$@extra-options) + #:user "prometheus-node-exporter" + #:group "prometheus-node-exporter" + #:log-file "/var/log/prometheus-node-exporter.log")) + (stop #~(make-kill-destructor))))))) + +(define (prometheus-node-exporter-activation config) + (with-imported-modules '((guix build utils)) + #~(let ((textfile-directory + #$(prometheus-node-exporter-textfile-directory config))) + (use-modules (guix build utils)) + + (when textfile-directory + (let ((user (getpw "prometheus-node-exporter"))) + #t + (mkdir-p textfile-directory) + (chown textfile-directory (passwd:uid user) (passwd:gid user)) + (chmod textfile-directory #o775)))))) (define prometheus-node-exporter-service-type (service-type (name 'prometheus-node-exporter) (description "Run @command{node_exporter} to serve hardware and OS metrics to -prometheus.") +Prometheus.") (extensions - (list (service-extension - shepherd-root-service-type - (compose list prometheus-node-exporter-shepherd-service)))) + (list + (service-extension account-service-type + (const %prometheus-node-exporter-accounts)) + (service-extension activation-service-type + prometheus-node-exporter-activation) + (service-extension shepherd-root-service-type + prometheus-node-exporter-shepherd-service))) (default-value (prometheus-node-exporter-configuration)))) diff --git a/gnu/services/science.scm b/gnu/services/science.scm index 94ff0f36f2..6f7ac91154 100644 --- a/gnu/services/science.scm +++ b/gnu/services/science.scm @@ -1,3 +1,21 @@ +;;; GNU Guix --- Functional package management for GNU +;;; Copyright © 2020 Efraim Flashner <efraim@flashner.co.il> +;;; +;;; 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 science) #:export (<rshiny-configuration> rshiny-configuration diff --git a/gnu/services/security-token.scm b/gnu/services/security-token.scm index 354549b33c..ec26006538 100644 --- a/gnu/services/security-token.scm +++ b/gnu/services/security-token.scm @@ -1,5 +1,6 @@ ;;; GNU Guix --- Functional package management for GNU ;;; Copyright © 2018 Arun Isaac <arunisaac@systemreboot.net> +;;; Copyright © 2020 Tobias Geerinckx-Rice <me@tobias.gr> ;;; ;;; This file is part of GNU Guix. ;;; @@ -57,7 +58,7 @@ (modules '((gnu build shepherd))) (start #~(lambda _ (invoke #$(file-append pcsc-lite "/sbin/pcscd")) - (call-with-input-file "/var/run/pcscd/pcscd.pid" read))) + (call-with-input-file "/run/pcscd/pcscd.pid" read))) (stop #~(make-kill-destructor))))))) (define pcscd-activation diff --git a/gnu/services/virtualization.scm b/gnu/services/virtualization.scm index eaf0bbde43..f435630faf 100644 --- a/gnu/services/virtualization.scm +++ b/gnu/services/virtualization.scm @@ -36,7 +36,6 @@ #:use-module (gnu system file-systems) #:use-module (gnu system hurd) #:use-module (gnu system image) - #:use-module (gnu system images hurd) #:use-module (gnu system shadow) #:use-module (gnu system) #:use-module (guix derivations) @@ -913,14 +912,12 @@ that will be listening to receive secret keys on port 1004, TCP." (define (hurd-vm-disk-image config) "Return a disk-image for the Hurd according to CONFIG. The secret-service is added to the OS specified in CONFIG." - (let ((os (secret-service-operating-system (hurd-vm-configuration-os config))) - (disk-size (hurd-vm-configuration-disk-size config))) - (system-image - (image - (inherit hurd-disk-image) - (format 'compressed-qcow2) - (size disk-size) - (operating-system os))))) + (let* ((os (secret-service-operating-system + (hurd-vm-configuration-os config))) + (disk-size (hurd-vm-configuration-disk-size config)) + (type (lookup-image-type-by-name 'hurd-qcow2)) + (os->image (image-type-constructor type))) + (system-image (os->image os)))) (define (hurd-vm-port config base) "Return the forwarded vm port for this childhurd config." |