From mboxrd@z Thu Jan 1 00:00:00 1970 From: ludo@gnu.org (Ludovic =?utf-8?Q?Court=C3=A8s?=) Subject: Re: [PATCH] gnu: services: Add nginx-service. Date: Tue, 25 Aug 2015 23:35:43 +0200 Message-ID: <876143f3v4.fsf@gnu.org> References: <873801rqsi.fsf@izanagi.i-did-not-set--mail-host-address--so-tickle-me> <87io8cmvuz.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:46127) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZULsk-0004dC-By for guix-devel@gnu.org; Tue, 25 Aug 2015 17:35:51 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZULsj-0006hh-7y for guix-devel@gnu.org; Tue, 25 Aug 2015 17:35:50 -0400 In-Reply-To: (David Thompson's message of "Tue, 18 Aug 2015 20:23:41 -0400") List-Id: "Development of GNU Guix and the GNU System distribution." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-devel-bounces+gcggd-guix-devel=m.gmane.org@gnu.org Sender: guix-devel-bounces+gcggd-guix-devel=m.gmane.org@gnu.org To: "Thompson, David" Cc: guix-devel "Thompson, David" skribis: > On Tue, Aug 18, 2015 at 11:58 AM, Ludovic Court=C3=A8s wro= te: >> "Thompson, David" skribis: >> >>> From c2da6c04eb1a12d0ee2f56a3954673f3bddc122b Mon Sep 17 00:00:00 2001 >>> From: David Thompson >>> 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-direc= tory))) >> >> There=E2=80=99s this annoying thing that here =E2=80=98config-file=E2=80= =99 is a monadic value >> when we=E2=80=99d instead prefer a =E2=80=9Cfile-like object.=E2=80=9D 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! (=E2=80=98text-file*=E2=80=99 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 =E2=80=98plain-file=E2=80=99 is enough.) WDYT? Thanks, Ludo=E2=80=99.