Package: guix-patches;
Reported by: Rouby Pierre-Antoine <pierre-antoine.rouby <at> inria.fr>
Date: Mon, 28 May 2018 13:26:01 UTC
Severity: normal
Tags: patch
Done: ludo <at> gnu.org (Ludovic Courtès)
Bug is archived. No further changes may be made.
View this message in rfc822 format
From: Rouby Pierre-Antoine <pierre-antoine.rouby <at> inria.fr> To: ng0 <at> n0.is Cc: 31621 <at> debbugs.gnu.org, Rouby Pierre-Antoine <pierre-antoine.rouby <at> inria.fr> Subject: [bug#31621] [PATCH 2/3] gnu: service: Add hpcguix-web. Date: Wed, 30 May 2018 11:47:04 +0200
* gnu/service/web.scm (<hpcguix-web-configuration>): New record-type. (%hpcguix-web-accounts): New variable. (%hpcguix-web-activation,hpcguix-web-shepherd-service, hpcguix-web-service-type): New procedures. * doc/guix.texi (Web Services): Add 'hpcguix-web'. --- doc/guix.texi | 50 ++++++++++++++++++++++++++++++- gnu/services/web.scm | 71 +++++++++++++++++++++++++++++++++++++++++++- 2 files changed, 119 insertions(+), 2 deletions(-) diff --git a/doc/guix.texi b/doc/guix.texi index 5129b998b..6c91dd5a7 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -47,7 +47,8 @@ Copyright @copyright{} 2017, 2018 Arun Isaac@* Copyright @copyright{} 2017 nee@* Copyright @copyright{} 2018 Rutger Helling@* Copyright @copyright{} 2018 Oleg Pykhalov@* -Copyright @copyright{} 2018 Mike Gerwitz +Copyright @copyright{} 2018 Mike Gerwitz@* +Copyright @copyright{} 2018 Pierre-Antoine Rouby Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.3 or @@ -16135,6 +16136,53 @@ A simple setup for cat-avatar-generator can look like this: %base-services)) @end example +@subsubheading Hpcguix-web + +@cindex hpcguix-web +The @code{hpcguix-web} is web interface to @code{Guix} packages visualizations. + +@defvr {Scheme Variable} hpcguix-web-service-type +A service type for @code{hpcguix-web}. +@end defvr + +@deftp {Data Type} hpcguix-web-configuration +Data Type for @code{hpcguix-web} service configuration. + +@table @asis +@item @code{specs} +The @code{hpcguix-web} @code{gexp} service +@url{https://github.com/UMCUGenetics/hpcguix-web/blob/master/hpcweb-configuration.scm, +configuration} + +@table @asis +@item @code{title-prefix} (default: @code{"hpcguix | "}) +The page title prefix. + +@item @code{guix-command} (default: @code{"guix"}) +The @code{Guix} command. + +@item @code{package-filter-proc} (default: @code{(const #t)}) +Package filter. + +@item @code{package-page-extension-proc} (default: @code{(const '())}) +Extension package for @code{hpcguix-web}. + +@item @code{menu} (default: @code{'()}) +Additional entry in page @code{menu}. +@end table +@end table +@end deftp + +@example +(services (cons* (service hpcguix-web-service-type + (hpcguix-web-configuration + (specs + #~(define site-config + (hpcweb-configuration + (title-prefix "Guix-HPC - ") + (menu '(("/about" "ABOUT")))))))) +@end example + @node Certificate Services @subsubsection Certificate Services diff --git a/gnu/services/web.scm b/gnu/services/web.scm index b336a8dd3..d8acc9549 100644 --- a/gnu/services/web.scm +++ b/gnu/services/web.scm @@ -6,6 +6,7 @@ ;;; Copyright © 2017 Christopher Baines <mail <at> cbaines.net> ;;; Copyright © 2017 nee <nee-git <at> hidamari.blue> ;;; Copyright © 2017 Clément Lassieur <clement <at> lassieur.org> +;;; Copyright © 2018 Pierre-Antoine Rouby <pierre-antoine.rouby <at> inria.fr> ;;; ;;; This file is part of GNU Guix. ;;; @@ -25,11 +26,14 @@ (define-module (gnu services web) #:use-module (gnu services) #:use-module (gnu services shepherd) + #:use-module (gnu system pam) #:use-module (gnu system shadow) #:use-module (gnu packages admin) #:use-module (gnu packages web) #:use-module (gnu packages php) + #:use-module (gnu packages guile) #:use-module (guix records) + #:use-module (guix modules) #:use-module (guix gexp) #:use-module ((guix utils) #:select (version-major)) #:use-module ((guix packages) #:select (package-version)) @@ -155,7 +159,11 @@ php-fpm-service-type nginx-php-location - cat-avatar-generator-service)) + cat-avatar-generator-service + + hpcguix-web-configuration + hpcguix-web-configuration? + hpcguix-web-service-type)) ;;; Commentary: ;;; @@ -893,3 +901,64 @@ a webserver.") (nginx-server-configuration-locations configuration))) (root #~(string-append #$package "/share/web/cat-avatar-generator")))))) + +(define-record-type* <hpcguix-web-configuration> + hpcguix-web-configuration + make-hpcguix-web-configuration + hpcguix-web-configuration? + + ;; Specs is gexp of hpcguix-web configuration file + (specs hpcguix-web-configuration-specs)) + +(define %hpcguix-web-accounts + (list (user-group + (name "hpcguix-web") + (system? #t)) + (user-account + (name "hpcguix-web") + (group "hpcguix-web") + (system? #t) + (comment "hpcguix-web") + (home-directory "/var/empty") + (shell (file-append shadow "/sbin/nologin"))))) + +(define (%hpcguix-web-activation config) + #~(begin + (use-modules (guix build utils)) + (let ((home-dir "/var/cache/guix/web") + (user (getpwnam "hpcguix-web"))) + (mkdir-p home-dir) + (chown home-dir (passwd:uid user) (passwd:gid user)) + (chmod home-dir #o755)))) + +(define (hpcguix-web-shepherd-service config) + (let* ((specs (hpcguix-web-configuration-specs config))) + (with-imported-modules (source-module-closure + '((gnu build shepherd))) + (shepherd-service + (documentation "hpcguix-web daemon") + (provision '(hpcguix-web)) + (requirement '(networking)) + (start #~(make-forkexec-constructor + (list (string-append #$hpcguix-web "/bin/run") + (string-append "--config=" + #$(scheme-file "hpcguix-web.scm" specs))) + #:user "hpcguix-web" + #:group "hpcguix-web" + #:environment-variables + (list (string-append "XDG_CACHE_HOME=" + "/var/cache")))) + (stop #~(make-kill-destructor)))))) + +(define hpcguix-web-service-type + (service-type + (name 'hpcguix-web) + (description + "Run hpcguix-web daemon @command{run}.") + (extensions + (list (service-extension account-service-type + (const %hpcguix-web-accounts)) + (service-extension activation-service-type + %hpcguix-web-activation) + (service-extension shepherd-root-service-type + (compose list hpcguix-web-shepherd-service)))))) -- 2.17.0
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.