From 0c5d0c57d370b34f3ba677838deaa8baf7bca58a Mon Sep 17 00:00:00 2001 From: Maxim Cournoyer Date: Fri, 6 Nov 2020 08:54:27 -0500 Subject: services: mpd: Do not eagerly look for a user. Running 'guix system search mpd' would throw a backtrace because the mpd-shepherd-service service start Gexp contained an unquoted call to 'getpwnam', which would look for a missing 'mpd' user and fail. * gnu/services/audio.scm (mpd-shepherd-service): gexp-unquote only the relevant variable rather than the whole expression. --- gnu/services/audio.scm | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'gnu/services') diff --git a/gnu/services/audio.scm b/gnu/services/audio.scm index 37f2efa479..5d33032501 100644 --- a/gnu/services/audio.scm +++ b/gnu/services/audio.scm @@ -143,11 +143,11 @@ audio_output { #:pid-file #$(mpd-file-name config "pid") #:environment-variables ;; Required to detect PulseAudio when run under a user account. - '(#$(string-append - "XDG_RUNTIME_DIR=/run/user/" - (number->string + (list (string-append + "XDG_RUNTIME_DIR=/run/user/" + (number->string (passwd:uid - (getpwnam (mpd-configuration-user config)))))) + (getpwnam #$(mpd-configuration-user config)))))) #:log-file #$(mpd-file-name config "log"))) (stop #~(make-kill-destructor)))) -- cgit v1.2.3 From 7209d7cbc37c108ca1148561a681258bb2222ab1 Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Fri, 6 Nov 2020 22:58:28 +0100 Subject: services: mpd: Always create the "mpd" user account. * gnu/services/audio.scm (%mpd-accounts): New variable. (mpd-service-type)[extensions]: Add ACCOUNT-SERVICE-TYPE extension. --- gnu/services/audio.scm | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'gnu/services') diff --git a/gnu/services/audio.scm b/gnu/services/audio.scm index 5d33032501..5729b6bb0e 100644 --- a/gnu/services/audio.scm +++ b/gnu/services/audio.scm @@ -1,6 +1,7 @@ ;;; GNU Guix --- Functional package management for GNU ;;; Copyright © 2017 Peter Mikkelsen ;;; Copyright © 2019 Ricardo Wurmus +;;; Copyright © 2020 Ludovic Courtès ;;; ;;; This file is part of GNU Guix. ;;; @@ -21,6 +22,8 @@ #:use-module (guix gexp) #:use-module (gnu services) #:use-module (gnu services shepherd) + #:use-module (gnu system shadow) + #:use-module (gnu packages admin) #:use-module (gnu packages mpd) #:use-module (guix records) #:use-module (ice-9 match) @@ -162,6 +165,22 @@ audio_output { (mkdir-p directory) (chown directory (passwd:uid %user) (passwd:gid %user)))))) + +(define %mpd-accounts + ;; Default account and group for MPD. + (list (user-group (name "mpd") (system? #t)) + (user-account + (name "mpd") + (group "mpd") + (system? #t) + (comment "Music Player Daemon (MPD) user") + + ;; Note: /var/run/mpd hosts one sub-directory per user, of which + ;; /var/run/mpd/mpd corresponds to the "mpd" user. + (home-directory "/var/run/mpd/mpd") + + (shell (file-append shadow "/sbin/nologin"))))) + (define mpd-service-type (service-type (name 'mpd) @@ -169,6 +188,8 @@ audio_output { (extensions (list (service-extension shepherd-root-service-type (compose list mpd-shepherd-service)) + (service-extension account-service-type + (const %mpd-accounts)) (service-extension activation-service-type mpd-service-activation))) (default-value (mpd-configuration)))) -- cgit v1.2.3 From bb124f6e9c0af0a23736f233c2ea2c9c9b4a40a6 Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Fri, 6 Nov 2020 23:10:18 +0100 Subject: services: mpd: Fix daemon startup. Until now it would wait for a PID file that'd never come. * gnu/services/audio.scm (mpd-shepherd-service): Add 'requirement'. Remove #:pid-file from 'start'. (mpd-service-activation): Create the ".mpd" directory since that's what the daemon expects. --- gnu/services/audio.scm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'gnu/services') diff --git a/gnu/services/audio.scm b/gnu/services/audio.scm index 5729b6bb0e..627b941871 100644 --- a/gnu/services/audio.scm +++ b/gnu/services/audio.scm @@ -138,12 +138,12 @@ audio_output { (define (mpd-shepherd-service config) (shepherd-service (documentation "Run the MPD (Music Player Daemon)") + (requirement '(user-processes)) (provision '(mpd)) (start #~(make-forkexec-constructor (list #$(file-append mpd "/bin/mpd") "--no-daemon" #$(mpd-config->file config)) - #:pid-file #$(mpd-file-name config "pid") #:environment-variables ;; Required to detect PulseAudio when run under a user account. (list (string-append @@ -161,7 +161,7 @@ audio_output { (define %user (getpw #$(mpd-configuration-user config))) - (let ((directory #$(mpd-file-name config ""))) + (let ((directory #$(mpd-file-name config ".mpd"))) (mkdir-p directory) (chown directory (passwd:uid %user) (passwd:gid %user)))))) -- cgit v1.2.3 From 86e9e5cb230c3c10272a223ea04e7564f3c1463b Mon Sep 17 00:00:00 2001 From: Julien Lepiller Date: Mon, 9 Nov 2020 22:44:18 +0100 Subject: services: nginx: Re-introduce server-names-hash-bucket-size. This was unintentionally removed in 00014f769233facebd84f13a00b10032a22cb440. * gnu/services/web.scm (default-nginx-config): Re-introduce processing of server-names-hash-bucket-size option. --- gnu/services/web.scm | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'gnu/services') diff --git a/gnu/services/web.scm b/gnu/services/web.scm index 7e17dac6e2..53858436fa 100644 --- a/gnu/services/web.scm +++ b/gnu/services/web.scm @@ -668,6 +668,12 @@ of index files." '#$lua-package-cpath) ";")) "") + (if server-names-hash-bucket-size + (string-append + " server_names_hash_bucket_size " + (number->string server-names-hash-bucket-size) + ";\n") + "") (if server-names-hash-bucket-max-size (string-append " server_names_hash_bucket_max_size " -- cgit v1.2.3