guix-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] gnu: services: Add nginx-service.


From: Ludovic Courtès
Subject: Re: [PATCH] gnu: services: Add nginx-service.
Date: Tue, 25 Aug 2015 23:35:43 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux)

"Thompson, David" <address@hidden> skribis:

> On Tue, Aug 18, 2015 at 11:58 AM, Ludovic Courtès <address@hidden> wrote:
>> "Thompson, David" <address@hidden> skribis:
>>
>>> From c2da6c04eb1a12d0ee2f56a3954673f3bddc122b Mon Sep 17 00:00:00 2001
>>> From: David Thompson <address@hidden>
>>> Date: Sun, 2 Aug 2015 23:29:53 -0400
>>> Subject: [PATCH] gnu: services: Add nginx-service.
>>>
>>> * gnu/services/web.scm: New file.
>>> * gnu-system.am (GNU_SYSTEM_MODULES): Add it.
>>
>> [...]
>>
>>> +(define (default-nginx-config log-directory run-directory)
>>> +  (text-file* "nginx.conf"
>>> +              "user nginx nginx;\n"
>>> +              "pid " run-directory "/pid;\n"
>>> +              "error_log " log-directory "/error.log info;\n"
>>> +              "http {\n"
>>> +              "    access_log " log-directory "/access.log;\n"
>>> +              "    root /var/www;\n"
>>> +              "    server {}\n"
>>> +              "}\n"
>>> +              "events {}\n"))
>>> +
>>> +(define* (nginx-service #:key (nginx nginx)
>>> +                        (log-directory "/var/log/nginx")
>>> +                        (run-directory "/var/run/nginx")
>>> +                        (config-file
>>> +                         (default-nginx-config log-directory 
>>> run-directory)))
>>
>> There’s this annoying thing that here ‘config-file’ is a monadic value
>> when we’d instead prefer a “file-like object.”

But it just occurred to me that you could write:

  (define (default-nginx-config log-directory run-directory)
    (plain-file "nginx.conf"
                (string-append ...)))

Problem solved!

(‘text-file*’ is more advanced: Instead of returning a file in the
store, it returns a *derivation* that builds a file possibly containing
references to store items.  But here, the default config file does not
refer to any store item, so ‘plain-file’ is enough.)

WDYT?

Thanks,
Ludo’.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]