From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:39029) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ekFXf-0005YW-L1 for guix-patches@gnu.org; Fri, 09 Feb 2018 15:45:09 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ekFXa-0005oQ-JM for guix-patches@gnu.org; Fri, 09 Feb 2018 15:45:07 -0500 Received: from debbugs.gnu.org ([208.118.235.43]:56063) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ekFXa-0005oD-EO for guix-patches@gnu.org; Fri, 09 Feb 2018 15:45:02 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1ekFXa-0005kn-92 for guix-patches@gnu.org; Fri, 09 Feb 2018 15:45:02 -0500 Subject: [bug#30404] [PATCH] Add cat-avatar-generator-service. Resent-Message-ID: Received: from eggs.gnu.org ([2001:4830:134:3::10]:38929) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ekFXL-0005Jm-3I for guix-patches@gnu.org; Fri, 09 Feb 2018 15:44:48 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ekFXG-0005ed-32 for guix-patches@gnu.org; Fri, 09 Feb 2018 15:44:47 -0500 Received: from lepiller.eu ([89.234.186.109]:41934) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1ekFXF-0005dX-Mu for guix-patches@gnu.org; Fri, 09 Feb 2018 15:44:42 -0500 Received: from localhost (static-176-182-42-79.ncc.abo.bbox.fr [176.182.42.79]) by lepiller.eu (OpenSMTPD) with ESMTPSA id 550e6c0a (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256:NO) for ; Fri, 9 Feb 2018 20:45:39 +0000 (UTC) Date: Fri, 9 Feb 2018 21:44:09 +0100 From: Julien Lepiller Message-ID: <20180209214356.640edd8f@lepiller.eu> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="MP_/iLQVVYzmLW0t=zJ3apk0.EE" List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+kyle=kyleam.com@gnu.org Sender: "Guix-patches" To: 30404@debbugs.gnu.org --MP_/iLQVVYzmLW0t=zJ3apk0.EE Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Content-Disposition: inline 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/ --MP_/iLQVVYzmLW0t=zJ3apk0.EE Content-Type: text/x-patch Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename=0001-gnu-Add-cat-avatar-generator.patch >From 5375bd9633cb37b3f26d16742fdc451f3296f723 Mon Sep 17 00:00:00 2001 From: Julien Lepiller 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 --MP_/iLQVVYzmLW0t=zJ3apk0.EE Content-Type: text/x-patch Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename=0002-gnu-Add-cat-avatar-generator-service.patch >From b5e362ac44bf3bd284ba14e886960311b67a4019 Mon Sep 17 00:00:00 2001 From: Julien Lepiller 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 --MP_/iLQVVYzmLW0t=zJ3apk0.EE--