From 116244df95faf664fd6f106ac8c3117674f81310 Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Mon, 9 Mar 2015 23:49:18 +0100 Subject: services: Statically report duplicate dmd service identifiers. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Reported by 白い熊 @相撲道 at . * gnu/services/dmd.scm (assert-no-duplicates): New procedure. (dmd-configuration-file): Use it. * po/guix/POTFILES.in: Add gnu/services/dmd.scm. * tests/guix-system.sh (errorfile): Add test. --- gnu/services/dmd.scm | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) (limited to 'gnu/services') diff --git a/gnu/services/dmd.scm b/gnu/services/dmd.scm index 4bf76e01ec..618df91c5e 100644 --- a/gnu/services/dmd.scm +++ b/gnu/services/dmd.scm @@ -17,6 +17,8 @@ ;;; along with GNU Guix. If not, see . (define-module (gnu services dmd) + #:use-module (guix ui) + #:use-module (guix sets) #:use-module (guix gexp) #:use-module (guix store) #:use-module (guix monads) @@ -24,6 +26,8 @@ #:use-module (gnu services) #:use-module (ice-9 match) #:use-module (srfi srfi-1) + #:use-module (srfi srfi-34) + #:use-module (srfi srfi-35) #:export (dmd-configuration-file)) ;;; Commentary: @@ -32,6 +36,26 @@ ;;; ;;; Code: +(define (assert-no-duplicates services) + "Raise an error if SERVICES provide the same dmd service more than once. + +This is a constraint that dmd's 'register-service' verifies but we'd better +verify it here statically than wait until PID 1 halts with an assertion +failure." + (fold (lambda (service set) + (define (assert-unique symbol) + (when (set-contains? set symbol) + (raise (condition + (&message + (message + (format #f (_ "service '~a' provided more than once") + symbol))))))) + + (for-each assert-unique (service-provision service)) + (fold set-insert set (service-provision service))) + (setq) + services)) + (define (dmd-configuration-file services) "Return the dmd configuration file for SERVICES." (define modules @@ -40,6 +64,8 @@ (gnu build file-systems) (guix build utils))) + (assert-no-duplicates services) + (mlet %store-monad ((modules (imported-modules modules)) (compiled (compiled-modules modules))) (define config -- cgit 1.4.1 From 9751c39a6d493535d3866f536fed8b16b5a4f1f8 Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Thu, 12 Mar 2015 19:10:44 +0100 Subject: services: bitlbee: Make /var/lib/bitlbee when activating. * gnu/services/networking.scm (bitlbee-service): Add 'activate' field. --- gnu/services/networking.scm | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'gnu/services') diff --git a/gnu/services/networking.scm b/gnu/services/networking.scm index a2d8e3a045..af8dd43bd6 100644 --- a/gnu/services/networking.scm +++ b/gnu/services/networking.scm @@ -286,6 +286,14 @@ configuration file." (service (provision '(bitlbee)) (requirement '(user-processes loopback)) + (activate #~(begin + (use-modules (guix build utils)) + + ;; This directory is used to store OTR data. + (mkdir-p "/var/lib/bitlbee") + (let ((user (getpwnam "bitlbee"))) + (chown "/var/lib/bitlbee" + (passwd:uid user) (passwd:gid user))))) (start #~(make-forkexec-constructor (list (string-append #$bitlbee "/sbin/bitlbee") "-n" "-F" "-u" "bitlbee" "-c" #$conf))) -- cgit 1.4.1 From 4bd43bbe73cfa5b6082078b9849fc09877e604df Mon Sep 17 00:00:00 2001 From: 宋文武 Date: Sun, 8 Mar 2015 20:39:26 +0800 Subject: services: slim: Use /run/current-system/profile/share/xsessions as sessiondir. * gnu/services/xorg.scm (, %windowmaker-session-type) (%ratposion-session-type, %sawfish-session-type, %default-xsessions) (xsessions-directory): Remove. (slim-service): Remove #:sessions parameter. [slim.cfg]: Use /run/current-system/profile/share/xsessions as sessiondir. * doc/guix.texi : Adjust accordingly. --- doc/guix.texi | 23 +-------------- gnu/services/xorg.scm | 78 +++------------------------------------------------ 2 files changed, 5 insertions(+), 96 deletions(-) (limited to 'gnu/services') diff --git a/doc/guix.texi b/doc/guix.texi index b605c5b192..fa8d3ab49e 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -4619,8 +4619,7 @@ started by the @dfn{login manager}, currently SLiM. @deffn {Monadic Procedure} slim-service [#:allow-empty-passwords? #f] @ [#:auto-login? #f] [#:default-user ""] [#:startx] @ [#:theme @var{%default-slim-theme}] @ - [#:theme-name @var{%default-slim-theme-name}] @ - [#:sessions @var{%default-sessions}] + [#:theme-name @var{%default-slim-theme-name}] Return a service that spawns the SLiM graphical login manager, which in turn starts the X display server with @var{startx}, a command as returned by @code{xorg-start-command}. @@ -4633,28 +4632,8 @@ If @var{theme} is @code{#f}, the use the default log-in theme; otherwise @var{theme} must be a gexp denoting the name of a directory containing the theme to use. In that case, @var{theme-name} specifies the name of the theme. - -Last, @var{session} is a list of @code{} objects denoting the -available session types that can be chosen from the log-in screen. The first -one is chosen by default. @end deffn -@defvr {Scheme Variable} %default-sessions -The list of default session types used by SLiM. -@end defvr - -@defvr {Scheme Variable} %ratpoison-session-type -Session type using the Ratpoison window manager. -@end defvr - -@defvr {Scheme Variable} %windowmaker-session-type -Session type using the WindowMaker window manager. -@end defvr - -@defvr {Scheme Variable} %sawfish-session-type -Session type using the Sawfish window manager. -@end defvr - @defvr {Scheme Variable} %default-theme @defvrx {Scheme Variable} %default-theme-name The G-Expression denoting the default SLiM theme and its name. diff --git a/gnu/services/xorg.scm b/gnu/services/xorg.scm index 562f57ffa0..912cbd3885 100644 --- a/gnu/services/xorg.scm +++ b/gnu/services/xorg.scm @@ -1,5 +1,6 @@ ;;; GNU Guix --- Functional package management for GNU ;;; Copyright © 2013, 2014, 2015 Ludovic Courtès +;;; Copyright © 2015 Sou Bunnbu ;;; ;;; This file is part of GNU Guix. ;;; @@ -25,9 +26,7 @@ #:use-module (gnu packages xorg) #:use-module (gnu packages gl) #:use-module (gnu packages slim) - #:use-module (gnu packages ratpoison) #:use-module (gnu packages gnustep) - #:use-module (gnu packages sawfish) #:use-module (gnu packages admin) #:use-module (gnu packages bash) #:use-module (guix gexp) @@ -39,14 +38,6 @@ #:use-module (srfi srfi-26) #:use-module (ice-9 match) #:export (xorg-start-command - %default-xsessions - %ratpoison-session-type - %windowmaker-session-type - %sawfish-session-type - - session-type? - session-type-name - %default-slim-theme %default-slim-theme-name slim-service)) @@ -194,61 +185,6 @@ which should be passed to this script as the first argument. If not, the ;;; SLiM log-in manager. ;;; -(define-record-type* session-type make-session-type - session-type? - (name session-type-name) ;string - (executable session-type-executable)) ;string-valued gexp - -(define %windowmaker-session-type - (session-type - (name "WindowMaker") - (executable #~(string-append #$windowmaker "/bin/wmaker")))) - -(define %ratpoison-session-type - (session-type - (name "Ratpoison") - (executable #~(string-append #$ratpoison "/bin/ratpoison")))) - -(define %sawfish-session-type - (session-type - (name "Sawfish") - (executable #~(string-append #$sawfish "/bin/sawfish")))) - -(define %default-xsessions - ;; Default session types available to the log-in manager. - (list %windowmaker-session-type %ratpoison-session-type)) - -(define (xsessions-directory sessions) - "Return a directory containing SESSIONS, a list of objects. -The alphabetical order of the files in that directory match the order of the -elements in SESSIONS." - (define builder - #~(begin - (use-modules (srfi srfi-1) - (ice-9 format)) - - (mkdir #$output) - (chdir #$output) - (fold (lambda (name executable number) - ;; Create file names such that the order of the items in - ;; SESSION is respected. SLiM gets them in lexicographic - ;; order and uses the first one as the default session. - (let ((file (format #f "~2,'0d-~a.desktop" - number (string-downcase name)))) - (call-with-output-file file - (lambda (port) - (format port "[Desktop Entry] -Name=~a -Exec=~a -Type=Application~%" - name executable))) - (+ 1 number))) - 1 - '#$(map session-type-name sessions) - (list #$@(map session-type-executable sessions))))) - - (gexp->derivation "xsessions-dir" builder)) - (define %default-slim-theme ;; Theme based on work by Felipe López. #~(string-append #$%artwork-repository "/slim")) @@ -264,7 +200,6 @@ Type=Application~%" (theme %default-slim-theme) (theme-name %default-slim-theme-name) (xauth xauth) (dmd dmd) (bash bash) - (sessions %default-xsessions) (auto-login-session #~(string-append #$windowmaker "/bin/wmaker")) startx) @@ -279,17 +214,12 @@ password. When @var{auto-login?} is true, log in automatically as If @var{theme} is @code{#f}, the use the default log-in theme; otherwise @var{theme} must be a gexp denoting the name of a directory containing the theme to use. In that case, @var{theme-name} specifies the name of the -theme. - -Last, @var{session} is a list of @code{} objects denoting the -available session types that can be chosen from the log-in screen. The first -one is chosen by default." +theme." (define (slim.cfg) (mlet %store-monad ((startx (or startx (xorg-start-command))) (xinitrc (xinitrc #:fallback-session - auto-login-session)) - (sessiondir (xsessions-directory sessions))) + auto-login-session))) (text-file* "slim.cfg" " default_path /run/current-system/profile/bin default_xserver " startx " @@ -300,7 +230,7 @@ authfile /var/run/slim.auth # The login command. '%session' is replaced by the chosen session name, one # of the names specified in the 'sessions' setting: 'wmaker', 'xfce', etc. login_cmd exec " xinitrc " %session -sessiondir " sessiondir " +sessiondir /run/current-system/profile/share/xsessions session_msg session (F1 to change): halt_cmd " dmd "/sbin/halt -- cgit 1.4.1 From e0b85670cf29899edb0c23477301e10bb43831ef Mon Sep 17 00:00:00 2001 From: 宋文武 Date: Sun, 8 Mar 2015 20:57:53 +0800 Subject: services: slim: Allow non-absolute path to be used as session command. * gnu/services/xorg.scm (xinitrc)[builder]: Don't check the existence of COMMAND. Only run ~/.xsession when it exists. --- gnu/services/xorg.scm | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) (limited to 'gnu/services') diff --git a/gnu/services/xorg.scm b/gnu/services/xorg.scm index 912cbd3885..14edf8cc04 100644 --- a/gnu/services/xorg.scm +++ b/gnu/services/xorg.scm @@ -158,26 +158,26 @@ which should be passed to this script as the first argument. If not, the ;; environment variables that one gets when logging in on a tty, for ;; instance. (let* ((pw (getpw (getuid))) - (shell (passwd:shell pw)) - (st (stat command #f))) - (when (and st (not (zero? (logand (stat:mode st) #o100)))) - ;; Close any open file descriptors. This is all the more - ;; important that SLiM itself exec's us directly without closing - ;; its own file descriptors! - (close-all-fdes) + (shell (passwd:shell pw))) + ;; Close any open file descriptors. This is all the more + ;; important that SLiM itself exec's us directly without closing + ;; its own file descriptors! + (close-all-fdes) - ;; The '--login' option is supported at least by Bash and zsh. - (execl shell shell "--login" "-c" - (string-join (cons command args)))))) + ;; The '--login' option is supported at least by Bash and zsh. + (execl shell shell "--login" "-c" + (string-join (cons command args))))) - (let ((home (getenv "HOME")) - (session (match (command-line) - ((_ x) x) - (_ #$fallback-session)))) - ;; First, try to run ~/.xsession. - (exec-from-login-shell (string-append home "/.xsession")) - ;; Then try to start the specified session. - (exec-from-login-shell session)))) + (let* ((home (getenv "HOME")) + (xsession-file (string-append home "/.xsession")) + (session (match (command-line) + ((_ x) x) + (_ #$fallback-session)))) + (if (file-exists? xsession-file) + ;; Run ~/.xsession when it exists. + (exec-from-login-shell xsession-file) + ;; Otherwise, start the specified session. + (exec-from-login-shell session))))) (gexp->script "xinitrc" builder)) -- cgit 1.4.1 From 482dbe6a1622dce33b1c4b83775a0e6c53008686 Mon Sep 17 00:00:00 2001 From: 宋文武 Date: Fri, 13 Mar 2015 22:57:22 +0800 Subject: services: slim: Pass SESSION to ~/.xsession as "$1". * gnu/services/xorg.scm (xinitrc)[builder]: Pass SESSION to ~/.xsession. --- gnu/services/xorg.scm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'gnu/services') diff --git a/gnu/services/xorg.scm b/gnu/services/xorg.scm index 14edf8cc04..c687b46bc2 100644 --- a/gnu/services/xorg.scm +++ b/gnu/services/xorg.scm @@ -175,7 +175,7 @@ which should be passed to this script as the first argument. If not, the (_ #$fallback-session)))) (if (file-exists? xsession-file) ;; Run ~/.xsession when it exists. - (exec-from-login-shell xsession-file) + (exec-from-login-shell xsession-file session) ;; Otherwise, start the specified session. (exec-from-login-shell session))))) (gexp->script "xinitrc" builder)) -- cgit 1.4.1 From 5250a4f215de414f516850e48af2f91c9c17c066 Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Tue, 17 Mar 2015 22:25:03 +0100 Subject: services: guix-service: Remove extraneous monadism. * gnu/services/base.scm (guix-build-accounts): Remove unneeded 'with-monad'. (guix-service): Adjust accordingly. --- gnu/services/base.scm | 43 +++++++++++++++++++++---------------------- 1 file changed, 21 insertions(+), 22 deletions(-) (limited to 'gnu/services') diff --git a/gnu/services/base.scm b/gnu/services/base.scm index 40d4740d46..84bac94d9f 100644 --- a/gnu/services/base.scm +++ b/gnu/services/base.scm @@ -568,25 +568,24 @@ given @var{config}---an @code{} object. Optionally, (shadow shadow)) "Return a list of COUNT user accounts for Guix build users, with UIDs starting at FIRST-UID, and under GID." - (with-monad %store-monad - (return (unfold (cut > <> count) - (lambda (n) - (user-account - (name (format #f "guixbuilder~2,'0d" n)) - (system? #t) - (uid (+ first-uid n -1)) - (group group) - - ;; guix-daemon expects GROUP to be listed as a - ;; supplementary group too: - ;; . - (supplementary-groups (list group "kvm")) - - (comment (format #f "Guix Build User ~2d" n)) - (home-directory "/var/empty") - (shell #~(string-append #$shadow "/sbin/nologin")))) - 1+ - 1)))) + (unfold (cut > <> count) + (lambda (n) + (user-account + (name (format #f "guixbuilder~2,'0d" n)) + (system? #t) + (uid (+ first-uid n -1)) + (group group) + + ;; guix-daemon expects GROUP to be listed as a + ;; supplementary group too: + ;; . + (supplementary-groups (list group "kvm")) + + (comment (format #f "Guix Build User ~2d" n)) + (home-directory "/var/empty") + (shell #~(string-append #$shadow "/sbin/nologin")))) + 1+ + 1)) (define (hydra-key-authorization guix) "Return a gexp with code to register the hydra.gnu.org public key with @@ -636,8 +635,7 @@ passed to @command{guix-daemon}." (and authorize-hydra-key? (hydra-key-authorization guix))) - (mlet %store-monad ((accounts (guix-build-accounts build-accounts - #:group builder-group))) + (with-monad %store-monad (return (service (provision '(guix-daemon)) (requirement '(user-processes)) @@ -650,7 +648,8 @@ passed to @command{guix-daemon}." '("--no-substitutes")) #$@extra-options))) (stop #~(make-kill-destructor)) - (user-accounts accounts) + (user-accounts (guix-build-accounts build-accounts + #:group builder-group)) (user-groups (list (user-group (name builder-group) (system? #t) -- cgit 1.4.1