From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp2.migadu.com ([2001:41d0:403:58f0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms13.migadu.com with LMTPS id uP1GOmNcdGbMLQEAe85BDQ:P1 (envelope-from ) for ; Thu, 20 Jun 2024 16:44:20 +0000 Received: from aspmx1.migadu.com ([2001:41d0:403:58f0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp2.migadu.com with LMTPS id uP1GOmNcdGbMLQEAe85BDQ (envelope-from ) for ; Thu, 20 Jun 2024 18:44:20 +0200 X-Envelope-To: larch@yhetil.org Authentication-Results: aspmx1.migadu.com; dkim=none ("invalid DKIM record") header.d=freakingpenguin.com header.s=x header.b=jgQgkb1P; dmarc=none; spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org" ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1718901859; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding:resent-cc: resent-from:resent-sender:resent-message-id:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=+OvG4eXF2NC5otvPliVNBbLNBcI1vh44lvEVu6m1YmQ=; b=fDrKa8GxJ/Hw6lTxfcZJ0IqVDpOwXwiPYPp57Z9bfz/IhXcf3QUfcu74M++J3DPzVPSR0V yWc8bJhDjKQg4dAu3tvYmEz3juUvNJvWMe3yQ1KatSzzCoDF8b/iC9vmuAaWJD2JYpSnCn 2GsP0HmYArmd804/Ba6+RzbYVPUT9d6sb9/2cdHzDRvquZf8MC2Pbs59CkKAjssMNDzk9A u/Uz9bpkG+WiCmHivXfsXW7fiiIxYVW3DYusN1hixHs59YF4hphsHqLtCibSOri9Oykcgo BhbRNYhy8NEMrgcdp1yBl9e/O5yoOmVg6GxktErhlkr+eQ2RaY1QfZT65or9xw== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1718901859; a=rsa-sha256; cv=none; b=K4+WJOMjmEHih6SOoxZjMbTjtQ+QLlwyBcV5SjXgYb/cNVL88r1Kiu9/UXLGLbgiWw7Mod mLGIxnosv9D5fwy0VApqQ12rDX54D1DNIhwZb6YYesXeY55+0xsAweDvSaoeLmYP6/OHNr K5SuvcI11n8aiPp859NQg0i7zJXUdiLzvlATn290JWDnP0Lm/MmWR7A+Tq1VWhX1qUnPYN fQ38tNxstsorLVqtoMgi2+/ssWbHMjsbyd4UhC8E+k5735WACaKSaSaKOunQiC9QILU1gS ditRgKCsp9FRHsg9WF811DqBSEkuzERzJk05MJPRPOnO3XPOLf/J64YahSYVRQ== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=none ("invalid DKIM record") header.d=freakingpenguin.com header.s=x header.b=jgQgkb1P; dmarc=none; spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org" Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id B35E372F6F for ; Thu, 20 Jun 2024 18:44:19 +0200 (CEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sKKtF-00081F-Qt; Thu, 20 Jun 2024 12:44:01 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sKKtE-00080m-2l for guix-patches@gnu.org; Thu, 20 Jun 2024 12:44:00 -0400 Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sKKtD-0006PI-2r; Thu, 20 Jun 2024 12:43:59 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1sKKtG-0007QV-Dw; Thu, 20 Jun 2024 12:44:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#71586] [PATCH v3] services: web: Improve nginx formatting for extra-content References: <9556afd9d860c28ea5abe15fd42d8e2989e5244c.1718510232.git.richard@freakingpenguin.com> In-Reply-To: <9556afd9d860c28ea5abe15fd42d8e2989e5244c.1718510232.git.richard@freakingpenguin.com> Resent-From: Richard Sent Original-Sender: "Debbugs-submit" Resent-CC: pelzflorian@pelzflorian.de, ludo@gnu.org, matt@excalamus.com, maxim.cournoyer@gmail.com, guix-patches@gnu.org Resent-Date: Thu, 20 Jun 2024 16:44:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 71586 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 71586@debbugs.gnu.org Cc: ~@wolfsden.cz, Richard Sent , Florian Pelz , Ludovic =?UTF-8?Q?Court=C3=A8s?= , Matthew Trzcinski , Maxim Cournoyer X-Debbugs-Original-Xcc: Florian Pelz , Ludovic =?UTF-8?Q?Court=C3=A8s?= , Matthew Trzcinski , Maxim Cournoyer Received: via spool by 71586-submit@debbugs.gnu.org id=B71586.171890178528437 (code B ref 71586); Thu, 20 Jun 2024 16:44:02 +0000 Received: (at 71586) by debbugs.gnu.org; 20 Jun 2024 16:43:05 +0000 Received: from localhost ([127.0.0.1]:35993 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sKKsK-0007Oa-Sw for submit@debbugs.gnu.org; Thu, 20 Jun 2024 12:43:05 -0400 Received: from mail-108-mta21.mxroute.com ([136.175.108.21]:32775) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sKKsH-0007Nb-NS for 71586@debbugs.gnu.org; Thu, 20 Jun 2024 12:43:02 -0400 Received: from filter006.mxroute.com ([136.175.111.3] filter006.mxroute.com) (Authenticated sender: mN4UYu2MZsgR) by mail-108-mta21.mxroute.com (ZoneMTA) with ESMTPSA id 190368791e800017a3.001 for <71586@debbugs.gnu.org> (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384); Thu, 20 Jun 2024 16:42:52 +0000 X-Zone-Loop: 8b92e3f788985d292b2af80ea24512909f6b57bffd2b X-Originating-IP: [136.175.111.3] DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=freakingpenguin.com; s=x; h=Content-Transfer-Encoding:MIME-Version: Message-ID:Date:Subject:Cc:To:From:Sender:Reply-To:Content-Type:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=+OvG4eXF2NC5otvPliVNBbLNBcI1vh44lvEVu6m1YmQ=; b=jgQgkb1PuCmNGmR2X8fCPOWaqJ bsY1BSXERNKfKa5CC+OZjPm1ZfJ9AcXgvjWiflrm2LJvN5/HnWxe8/VGeyA32ItEFMoifh2NIrhbR ntLZZwsXRNN7kx9dKd3XV6Zify4ShOtioVgmRlgM4fDiwLEbLOqKlxJey/7s7roQts1dVP86qMRTS nhTKVl0x5kExT6NmEVORbxzORm4/1Ie8VvomjTcN2bqWEisjfb4YOcmS97Xir+k8XktacuyDzTc+5 8fX4p3JyiTdihjW+lUvAAs0T/GmvOAnbyY+jCQLWRYrBKE3Rlu6y2kWhMPUAV9RWoXC0E5Y5Opl+f kwS5Y4JQ==; From: Richard Sent Date: Thu, 20 Jun 2024 12:42:03 -0400 Message-ID: <3dd76c96b1a0dfd61fea9fb532304aff0dc2fcf8.1718901723.git.richard@freakingpenguin.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Authenticated-Id: richard@freakingpenguin.com X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+larch=yhetil.org@gnu.org Sender: guix-patches-bounces+larch=yhetil.org@gnu.org X-Migadu-Flow: FLOW_IN X-Migadu-Country: US X-Migadu-Spam-Score: -0.36 X-Spam-Score: -0.36 X-Migadu-Queue-Id: B35E372F6F X-Migadu-Scanner: mx11.migadu.com X-TUID: NG4B1ClA0Tsr When extra-content is a list, add 4 space indentation and a newline to every line. If it's a string, continue inserting it directly. This makes the list serialization behavior more consistent with other services. * gnu/services/web (default-nginx-config): Support lists. * doc/guix.texi (Web Services) [nginx-configuration]: Document it. Change-Id: Iec8614ba3cfc37292a566197e8d39b352b04846a --- doc/guix.texi | 13 +++++++++++-- gnu/services/web.scm | 9 ++++++++- 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/doc/guix.texi b/doc/guix.texi index 0102fd0fad..48fc457627 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -31907,8 +31907,17 @@ Web Services @end lisp @item @code{extra-content} (default: @code{""}) -Extra content for the @code{http} block. Should be string or a string -valued G-expression. +Additional content to be appended to the @code{http} block. Can either +be a value that can be lowered into a string or a list of such values. +In the former case, it is inserted directly. In the latter, it is +prefixed with indentation and suffixed with a newline. Nested lists are +flattened into one line. + +@lisp +(extra-content "include /etc/nginx/custom-config.conf;") +(extra-content `("include /etc/nginx/custom-config.conf;" + ("include " ,%custom-config.conf ";"))) +@end lisp @end table @end deftp diff --git a/gnu/services/web.scm b/gnu/services/web.scm index 406117c457..ee3499e5cd 100644 --- a/gnu/services/web.scm +++ b/gnu/services/web.scm @@ -771,7 +771,14 @@ (define (default-nginx-config config) "\n" (map emit-nginx-upstream-config upstream-blocks) (map emit-nginx-server-config server-blocks) - extra-content + (match extra-content + ((? list? extra-content) + (map (lambda (line) + `(" " ,line "\n")) + extra-content)) + ;; XXX: For compatibility strings and gexp's are inserted + ;; directly. + (_ extra-content)) "\n}\n")))) (define %nginx-accounts base-commit: e32e3d0a03dc17c4c54a91aad053c9036998b601 -- 2.45.1