all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* [bug#30404] [PATCH] Add cat-avatar-generator-service.
@ 2018-02-09 20:44 Julien Lepiller
  2018-02-09 22:19 ` Ludovic Courtès
  0 siblings, 1 reply; 5+ messages in thread
From: Julien Lepiller @ 2018-02-09 20:44 UTC (permalink / raw)
  To: 30404

[-- 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


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [bug#30404] [PATCH] Add cat-avatar-generator-service.
  2018-02-09 20:44 [bug#30404] [PATCH] Add cat-avatar-generator-service Julien Lepiller
@ 2018-02-09 22:19 ` Ludovic Courtès
  2018-02-09 22:48   ` Julien Lepiller
  0 siblings, 1 reply; 5+ messages in thread
From: Ludovic Courtès @ 2018-02-09 22:19 UTC (permalink / raw)
  To: Julien Lepiller; +Cc: 30404

Julien Lepiller <julien@lepiller.eu> skribis:

> By the way, if you don't know the author of this package, he's awesome:
> https://www.peppercarrot.com/

Looks very nice indeed!

> 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.

LGTM.

> 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.

[...]

> +(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

Normally the 3rd argument would be aligned with the 1st here.

You’ll hate me for asking that, but could you add a couple of lines to
the manual about this service?

Otherwise LGTM!

Thanks,
Ludo’.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [bug#30404] [PATCH] Add cat-avatar-generator-service.
  2018-02-09 22:19 ` Ludovic Courtès
@ 2018-02-09 22:48   ` Julien Lepiller
  2018-02-14 19:20     ` Ludovic Courtès
  0 siblings, 1 reply; 5+ messages in thread
From: Julien Lepiller @ 2018-02-09 22:48 UTC (permalink / raw)
  To: 30404

Le Fri, 09 Feb 2018 23:19:17 +0100,
ludo@gnu.org (Ludovic Courtès) a écrit :

> Julien Lepiller <julien@lepiller.eu> skribis:
> 
> > By the way, if you don't know the author of this package, he's
> > awesome: https://www.peppercarrot.com/  
> 
> Looks very nice indeed!
> 
> > 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.  
> 
> LGTM.
> 
> > 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.  
> 
> [...]
> 
> > +(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  
> 
> Normally the 3rd argument would be aligned with the 1st here.
I don't understand that comment... What should be aligned exactly?

> 
> You’ll hate me for asking that, but could you add a couple of lines to
> the manual about this service?
Sure, I'll do that :)

> 
> Otherwise LGTM!
> 
> Thanks,
> Ludo’.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [bug#30404] [PATCH] Add cat-avatar-generator-service.
  2018-02-09 22:48   ` Julien Lepiller
@ 2018-02-14 19:20     ` Ludovic Courtès
  2018-02-14 22:20       ` bug#30404: " Julien Lepiller
  0 siblings, 1 reply; 5+ messages in thread
From: Ludovic Courtès @ 2018-02-14 19:20 UTC (permalink / raw)
  To: Julien Lepiller; +Cc: 30404

Heya!

Julien Lepiller <julien@lepiller.eu> skribis:

> Le Fri, 09 Feb 2018 23:19:17 +0100,
> ludo@gnu.org (Ludovic Courtès) a écrit :

[...]

>> > +(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  
>> 
>> Normally the 3rd argument would be aligned with the 1st here.
> I don't understand that comment... What should be aligned exactly?

The lines above should be like this:

  (simple-service 'cat-http-server nginx-service-type
                  (list (nginx-server-configuration


(Here (list …) is the 3rd argument to ‘simple-service’.)

No big deal though.  :-)

Thanks,
Ludo’.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* bug#30404: [PATCH] Add cat-avatar-generator-service.
  2018-02-14 19:20     ` Ludovic Courtès
@ 2018-02-14 22:20       ` Julien Lepiller
  0 siblings, 0 replies; 5+ messages in thread
From: Julien Lepiller @ 2018-02-14 22:20 UTC (permalink / raw)
  To: 30404-done

Pushed as 3bedac50571204643d5e3b204dc720ae7d571a1f and
08da664d1041133e8282a5df0fcab6eee7e548fa. Thanks!

Le Wed, 14 Feb 2018 20:20:11 +0100,
ludo@gnu.org (Ludovic Courtès) a écrit :

> Heya!
> 
> Julien Lepiller <julien@lepiller.eu> skribis:
> 
> > Le Fri, 09 Feb 2018 23:19:17 +0100,
> > ludo@gnu.org (Ludovic Courtès) a écrit :  
> 
> [...]
> 
> >> > +(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    
> >> 
> >> Normally the 3rd argument would be aligned with the 1st here.  
> > I don't understand that comment... What should be aligned exactly?  
> 
> The lines above should be like this:
> 
>   (simple-service 'cat-http-server nginx-service-type
>                   (list (nginx-server-configuration
> 
> 
> (Here (list …) is the 3rd argument to ‘simple-service’.)
> 
> No big deal though.  :-)
> 
> Thanks,
> Ludo’.

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2018-02-14 22:21 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-02-09 20:44 [bug#30404] [PATCH] Add cat-avatar-generator-service Julien Lepiller
2018-02-09 22:19 ` 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

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/guix.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.