On Mon, Nov 04, 2019 at 06:19:32PM +0100, Ludovic Courtès wrote:
> "pelzflorian (Florian Pelz)" <[email protected]> skribis:
> > On Fri, Nov 01, 2019 at 03:54:42PM +0100, Ludovic Courtès wrote:
> >> […]
> >> Perhaps “nginx-accept-language-module”, to match the name of the
> >> upstream repo?
> >> 
> >
> > I agree.  Arch (who have no package for nginx-accept-language-module)
> > change their various nginx module package names to be more consistent,
> > I think, but this is not necessary in Guix, I think.
> 
> For Guix the general rule is to follow upstream (info "(guix) Package
> Naming").
> 

Makes sense.  I agree the general rule is appropriate here.



> > From: Florian Pelz <[email protected]>
> > Date: Sat, 2 Nov 2019 13:13:01 +0100
> > Subject: [PATCH 1/3] doc: Add warning on the '--source' build option when
> >  linking statically.
> >
> > * doc/guix.texi (Additional Build Options): Add warning.
> > […]
> > +Note that for statically linked packages, @command{guix build -S} will
> > +@emph{not} return the complete and corresponding sources since these
> > +would include the sources of statically linked dependencies.  In this
> > +case, when distributing sources for license compliance, you may want to
> > +play it safe and use the following @code{--sources} option instead.
> 
> I don’t think this bit is necessary: ‘-S’ is documented to return “the
> source of the package” and that’s exactly what it does; static
> vs. dynamic linking is not a concern at this level, as I see it.
> 
> WDYT?
> 

I guess the meaning of `guix build -S` is not clear enough.  Let me
make an alternative proposal (attached).



> > From: Florian Pelz <[email protected]>
> > Date: Sat, 2 Nov 2019 14:05:30 +0100
> > Subject: [PATCH 3/3] services: Make it possible to include dynamic modules 
> > in
> >  nginx.
> >
> > * gnu/services/web.scm (<nginx-configuration>): Add modules field.
> > (nginx-configuration-modules): New field accessor.
> > (emit-load-module): New procedure.
> > (default-nginx-config): Add support for the modules field.
> > * doc/guix.texi (NGINX): Document it.
> > […]
> > +@item @code{modules} (default: @code{'()})
> > +List of nginx dynamic modules to load.  Should be a list of strings or
> > +string valued G-expressions.
> 
> Then… how does nginx find the module in question, specifically the
> ‘nginx-accept-language-module’ package?  One has to specify
> ‘nginx-accept-language-module’ as the nginx package to use, is that
> right?  (I had overlooked that before.)
> 
> What about adding an example with the ‘accept-language’ module?
> 

Of course you are right.  I attach a patch with only a changed
doc/guix.texi.  I do not attach again the
nginx-accept-language-module.

Are these proposals OK?  Shall I push the three patches?

Regards,
Florian
>From 3bbdd2dc4c983ca8bbf31cd348b64f1d60a51ee5 Mon Sep 17 00:00:00 2001
From: Florian Pelz <[email protected]>
Date: Tue, 5 Nov 2019 08:22:04 +0100
Subject: [PATCH 01/13] doc: Explain more licensing aspects of the '--source'
 build option.

* doc/guix.texi (Additional Build Options): Explain more.
---
 doc/guix.texi | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/doc/guix.texi b/doc/guix.texi
index da2423b422..b4ad9d846a 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -8328,6 +8328,13 @@ The returned source tarball is the result of applying 
any patches and
 code snippets specified in the package @code{origin} (@pxref{Defining
 Packages}).
 
+Note that @command{guix build -S} compiles the sources only of the
+specified package.  They do not include the sources of statically linked
+dependencies, dynamically linked dependencies, or any other
+dependencies.  When distributing complete corresponding sources for
+license compliance, you may want to play it safe and use the following
+@code{--sources} option instead.
+
 @item --sources
 Fetch and return the source of @var{package-or-derivation} and all their
 dependencies, recursively.  This is a handy way to obtain a local copy
-- 
2.23.0

>From 04df1e5ee3fd542776b13eb3a59872e1647eb5f8 Mon Sep 17 00:00:00 2001
From: Florian Pelz <[email protected]>
Date: Tue, 5 Nov 2019 08:08:20 +0100
Subject: [PATCH 03/13] services: Make it possible to include dynamic modules
 in nginx.

* gnu/services/web.scm (<nginx-configuration>): Add modules field.
(nginx-configuration-modules): New field accessor.
(emit-load-module): New procedure.
(default-nginx-config): Add support for the modules field.
* doc/guix.texi (NGINX): Document it.
---
 doc/guix.texi        | 11 +++++++++++
 gnu/services/web.scm |  8 ++++++++
 2 files changed, 19 insertions(+)

diff --git a/doc/guix.texi b/doc/guix.texi
index b4ad9d846a..11cdc1ae83 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -19771,6 +19771,17 @@ use the size of the processors cache line.
 @item @code{server-names-hash-bucket-max-size} (default: @code{#f})
 Maximum bucket size for the server names hash tables.
 
+@item @code{modules} (default: @code{'()})
+List of nginx dynamic modules to load.  Should be a list of strings or
+string valued G-expressions.  For example:
+
+@lisp
+(modules
+ (list
+  (file-append nginx-accept-language-module "\
+/etc/nginx/modules/ngx_http_accept_language_module.so")))
+@end lisp
+
 @item @code{extra-content} (default: @code{""})
 Extra content for the @code{http} block.  Should be string or a string
 valued G-expression.
diff --git a/gnu/services/web.scm b/gnu/services/web.scm
index 899be1c168..896d06eb18 100644
--- a/gnu/services/web.scm
+++ b/gnu/services/web.scm
@@ -9,6 +9,7 @@
 ;;; Copyright © 2018 Pierre-Antoine Rouby <[email protected]>
 ;;; Copyright © 2017, 2018, 2019 Christopher Baines <[email protected]>
 ;;; Copyright © 2018 Marius Bakke <[email protected]>
+;;; Copyright © 2019 Florian Pelz <[email protected]>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -95,6 +96,7 @@
             nginx-configuration-upstream-blocks
             nginx-configuration-server-names-hash-bucket-size
             nginx-configuration-server-names-hash-bucket-max-size
+            nginx-configuration-modules
             nginx-configuration-extra-content
             nginx-configuration-file
 
@@ -522,6 +524,7 @@
                                  (default #f))
   (server-names-hash-bucket-max-size 
nginx-configuration-server-names-hash-bucket-max-size
                                      (default #f))
+  (modules nginx-configuration-modules (default '()))
   (extra-content nginx-configuration-extra-content
                  (default ""))
   (file          nginx-configuration-file         ;#f | string | file-like
@@ -542,6 +545,9 @@ of index files."
         ((? string? str) (list str " ")))
       names))
 
+(define (emit-load-module module)
+  (list "load_module " module ";\n"))
+
 (define emit-nginx-location-config
   (match-lambda
     (($ <nginx-location-configuration> uri body)
@@ -615,12 +621,14 @@ of index files."
                  server-blocks upstream-blocks
                  server-names-hash-bucket-size
                  server-names-hash-bucket-max-size
+                 modules
                  extra-content)
    (apply mixed-text-file "nginx.conf"
           (flatten
            "user nginx nginx;\n"
            "pid " run-directory "/pid;\n"
            "error_log " log-directory "/error.log info;\n"
+           (map emit-load-module modules)
            "http {\n"
            "    client_body_temp_path " run-directory "/client_body_temp;\n"
            "    proxy_temp_path " run-directory "/proxy_temp;\n"
-- 
2.23.0

Reply via email to