diff options
author | Ludovic Courtès <ludo@gnu.org> | 2016-12-19 23:29:09 +0100 |
---|---|---|
committer | Ludovic Courtès <ludo@gnu.org> | 2016-12-19 23:57:19 +0100 |
commit | 463995da0c8ae95654a6184c0a7ff0d1e0914c83 (patch) | |
tree | 41434e5a7d4577e4929d6043b94bc3ac1d0e8f2f | |
parent | 831071b84fe168999a49e5987a479c847b27b3d6 (diff) | |
download | guix-463995da0c8ae95654a6184c0a7ff0d1e0914c83.tar guix-463995da0c8ae95654a6184c0a7ff0d1e0914c83.tar.gz |
services: cuirass: Cache defaults to /var/cache/cuirass.
The previous default value depended on the 'HOME' environment variable,
which happened to be unset. Thus, /.cache was being used.
* gnu/services/cuirass.scm (<cuirass-configuration>)[cache-directory]:
Change default value to "/var/cache/cuirass".
(cuirass-shepherd-service): Always pass "--cache-directory".
(cuirass-activation): New procedure.
(cuirass-service-type): Use it as an extension to
ACTIVATION-SERVICE-TYPE.
* doc/guix.texi (Continuous Integration): Adjust accordingly.
-rw-r--r-- | doc/guix.texi | 2 | ||||
-rw-r--r-- | gnu/services/cuirass.scm | 23 |
2 files changed, 20 insertions, 5 deletions
diff --git a/doc/guix.texi b/doc/guix.texi index 46d006df8c..c2182093dd 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -11993,7 +11993,7 @@ Data type representing the configuration of Cuirass. @item @code{log-file} (default: @code{"/var/log/cuirass.log"}) Location of the log file. -@item @code{cache-directory} (default: @code{""}) +@item @code{cache-directory} (default: @code{"/var/cache/cuirass"}) Location of the repository cache. @item @code{user} (default: @code{"cuirass"}) diff --git a/gnu/services/cuirass.scm b/gnu/services/cuirass.scm index c2fe9d9bf7..d585e26538 100644 --- a/gnu/services/cuirass.scm +++ b/gnu/services/cuirass.scm @@ -1,5 +1,6 @@ ;;; GNU Guix --- Functional package management for GNU ;;; Copyright © 2016 Mathieu Lirzin <mthl@gnu.org> +;;; Copyright © 2016 Ludovic Courtès <ludo@gnu.org> ;;; ;;; This file is part of GNU Guix. ;;; @@ -45,7 +46,7 @@ (log-file cuirass-configuration-log-file ;string (default "/var/log/cuirass.log")) (cache-directory cuirass-configuration-cache-directory ;string (dir-name) - (default "")) + (default "/var/cache/cuirass")) (user cuirass-configuration-user ;string (default "cuirass")) (group cuirass-configuration-group ;string @@ -80,9 +81,7 @@ (requirement '(guix-daemon)) (start #~(make-forkexec-constructor (list (string-append #$cuirass "/bin/cuirass") - #$@(if (string=? "" cache-directory) - '() - (list "--cache-directory" cache-directory)) + "--cache-directory" #$cache-directory #$@(if (null? specs) '() (let ((str (format #f "'~S" specs))) @@ -112,11 +111,27 @@ (home-directory (string-append "/var/run/" cuirass-user)) (shell #~(string-append #$shadow "/sbin/nologin")))))) +(define (cuirass-activation config) + "Return the activation code for CONFIG." + (let ((cache (cuirass-configuration-cache-directory config)) + (user (cuirass-configuration-user config)) + (group (cuirass-configuration-group config))) + (with-imported-modules '((guix build utils)) + #~(begin + (use-modules (guix build utils)) + + (mkdir-p #$cache) + + (let ((uid (passwd:uid (getpw #$user))) + (gid (group:gid (getgr #$group)))) + (chown #$cache uid gid)))))) + (define cuirass-service-type (service-type (name 'cuirass) (extensions (list + (service-extension activation-service-type cuirass-activation) (service-extension shepherd-root-service-type cuirass-shepherd-service) (service-extension account-service-type cuirass-account))))) |