From: Julien Lepiller <julien@lepiller.eu>
To: 30404@debbugs.gnu.org
Subject: [bug#30404] [PATCH] Add cat-avatar-generator-service.
Date: Fri, 9 Feb 2018 21:44:09 +0100 [thread overview]
Message-ID: <20180209214356.640edd8f@lepiller.eu> (raw)
[-- Attachment #1: Type: text/plain, Size: 224 bytes --]
Hi, attached is a simple and cute package :)
It's a simple service that uses the nginx service and the php
integration.
By the way, if you don't know the author of this package, he's awesome:
https://www.peppercarrot.com/
[-- Attachment #2: 0001-gnu-Add-cat-avatar-generator.patch --]
[-- Type: text/x-patch, Size: 2564 bytes --]
From 5375bd9633cb37b3f26d16742fdc451f3296f723 Mon Sep 17 00:00:00 2001
From: Julien Lepiller <julien@lepiller.eu>
Date: Fri, 12 Jan 2018 23:08:50 +0100
Subject: [PATCH 1/2] gnu: Add cat-avatar-generator.
* gnu/packages/web.scm (cat-avatar-generator): New variable.
---
gnu/packages/web.scm | 43 +++++++++++++++++++++++++++++++++++++++++++
1 file changed, 43 insertions(+)
diff --git a/gnu/packages/web.scm b/gnu/packages/web.scm
index fb076433f..d91904d65 100644
--- a/gnu/packages/web.scm
+++ b/gnu/packages/web.scm
@@ -6217,3 +6217,46 @@ features include:
@item logging with multiple log levels.
@end enumerate\n")
(license l:expat)))
+
+(define-public cat-avatar-generator
+ (package
+ (name "cat-avatar-generator")
+ (version "1")
+ (source (origin
+ (method git-fetch)
+ (uri (git-reference
+ (url "https://framagit.org/Deevad/cat-avatar-generator.git")
+ (commit "71c0c662742cafe8afd2d2d50ec84243113e35ad")))
+ (file-name (string-append name "-" version))
+ (sha256
+ (base32
+ "0s7b5whqsmfa57prbgl66ym551kg6ly0z14h5dgrlx4lqm70y2yw"))))
+ (build-system trivial-build-system)
+ (arguments
+ `(#:modules ((guix build utils)
+ (srfi srfi-1)
+ (srfi srfi-26))
+ #:builder
+ (begin
+ (use-modules (guix build utils)
+ (srfi srfi-1)
+ (srfi srfi-26))
+ (let ((source (assoc-ref %build-inputs "source"))
+ (php-dir (string-append %output "/share/web/" ,name "/")))
+ ;; The cache directory must not be in the store, but in a writable
+ ;; location. The webserver will give us this location.
+ (copy-recursively source php-dir)
+ (substitute* (string-append php-dir "/cat-avatar-generator.php")
+ (("\\$cachepath = .*")
+ "if(isset($_SERVER['CACHE_DIR']))
+$cachepath = $_SERVER['CACHE_DIR'];
+else
+die('You need to set the CACHE_DIR variable first.');"))))))
+ (home-page "https://framagit.org/Deevad/cat-avatar-generator")
+ (synopsis "Random avatar generator")
+ (description "Cat avatar generator is a generator of cat pictures optimised
+to generate random avatars, or defined avatar from a \"seed\". This is a
+derivation by David Revoy from the original MonsterID by Andreas Gohr.")
+ ;; expat for the code, CC-BY 4.0 for the artwork
+ (license (list l:expat
+ l:cc-by4.0))))
--
2.16.1
[-- Attachment #3: 0002-gnu-Add-cat-avatar-generator-service.patch --]
[-- Type: text/x-patch, Size: 1686 bytes --]
From b5e362ac44bf3bd284ba14e886960311b67a4019 Mon Sep 17 00:00:00 2001
From: Julien Lepiller <julien@lepiller.eu>
Date: Fri, 12 Jan 2018 23:14:14 +0100
Subject: [PATCH 2/2] gnu: Add cat-avatar-generator-service.
* gnu/services/web.scm (cat-avatar-generator-service): New variable.
---
gnu/services/web.scm | 19 +++++++++++++++++++
1 file changed, 19 insertions(+)
diff --git a/gnu/services/web.scm b/gnu/services/web.scm
index c1ffe3e05..c4f46ebfc 100644
--- a/gnu/services/web.scm
+++ b/gnu/services/web.scm
@@ -870,3 +870,22 @@ 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")
+ (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)))
+ (list (nginx-location-configuration
+ (inherit base)
+ (body (cons (string-append "fastcgi_param CACHE_DIR \""
+ cache-dir "\";")
+ (nginx-location-configuration-body base))))))
+ (nginx-server-configuration-locations configuration)))
+ (root #~(string-append #$cat-avatar-generator
+ "/share/web/cat-avatar-generator"))))))
--
2.16.1
next reply other threads:[~2018-02-09 20:45 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-02-09 20:44 Julien Lepiller [this message]
2018-02-09 22:19 ` [bug#30404] [PATCH] Add cat-avatar-generator-service Ludovic Courtès
2018-02-09 22:48 ` Julien Lepiller
2018-02-14 19:20 ` Ludovic Courtès
2018-02-14 22:20 ` bug#30404: " Julien Lepiller
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://guix.gnu.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20180209214356.640edd8f@lepiller.eu \
--to=julien@lepiller.eu \
--cc=30404@debbugs.gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/guix.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).