summary refs log tree commit diff
path: root/gnu/services/web.scm
diff options
context:
space:
mode:
authorJulien Lepiller <julien@lepiller.eu>2018-01-12 23:14:14 +0100
committerJulien Lepiller <julien@lepiller.eu>2018-02-14 23:18:41 +0100
commit08da664d1041133e8282a5df0fcab6eee7e548fa (patch)
tree8b9ce1e125c2479ed6673e6d212df0a55ac47282 /gnu/services/web.scm
parent3bedac50571204643d5e3b204dc720ae7d571a1f (diff)
downloadguix-08da664d1041133e8282a5df0fcab6eee7e548fa.tar.gz
gnu: Add cat-avatar-generator-service.
* gnu/services/web.scm (cat-avatar-generator-service): New variable.
* doc/guix.text (Web Services): Document it.
Diffstat (limited to 'gnu/services/web.scm')
-rw-r--r--gnu/services/web.scm27
1 files changed, 25 insertions, 2 deletions
diff --git a/gnu/services/web.scm b/gnu/services/web.scm
index c1ffe3e055..beda481b0d 100644
--- a/gnu/services/web.scm
+++ b/gnu/services/web.scm
@@ -2,7 +2,7 @@
 ;;; Copyright © 2015 David Thompson <davet@gnu.org>
 ;;; Copyright © 2015, 2016, 2017 Ludovic Courtès <ludo@gnu.org>
 ;;; Copyright © 2016 ng0 <ng0@we.make.ritual.n0.is>
-;;; Copyright © 2016, 2017 Julien Lepiller <julien@lepiller.eu>
+;;; Copyright © 2016, 2017, 2018 Julien Lepiller <julien@lepiller.eu>
 ;;; Copyright © 2017 Christopher Baines <mail@cbaines.net>
 ;;; Copyright © 2017 nee <nee-git@hidamari.blue>
 ;;; Copyright © 2017 Clément Lassieur <clement@lassieur.org>
@@ -153,7 +153,9 @@
             php-fpm-on-demand-process-manager-configuration-process-idle-timeout
 
             php-fpm-service-type
-            nginx-php-location))
+            nginx-php-location
+
+            cat-avatar-generator-service))
 
 ;;; Commentary:
 ;;;
@@ -870,3 +872,24 @@ a webserver.")
           (string-append "fastcgi_pass unix:" socket ";")
           "fastcgi_index index.php;"
           (list "include " nginx-package "/share/nginx/conf/fastcgi.conf;")))))
+
+(define* (cat-avatar-generator-service
+          #:key
+          (cache-dir "/var/cache/cat-avatar-generator")
+          (package cat-avatar-generator)
+          (configuration (nginx-server-configuration)))
+  (simple-service
+    'cat-http-server nginx-service-type
+    (list (nginx-server-configuration
+            (inherit configuration)
+            (locations
+              (cons
+                (let ((base (nginx-php-location)))
+                  (nginx-location-configuration
+                    (inherit base)
+                    (body (list (string-append "fastcgi_param CACHE_DIR \""
+                                               cache-dir "\";")
+                                (nginx-location-configuration-body base)))))
+                (nginx-server-configuration-locations configuration)))
+            (root #~(string-append #$package
+                                   "/share/web/cat-avatar-generator"))))))