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 ms8.migadu.com with LMTPS id YKcCBdQ72mWmKQAAe85BDQ:P1 (envelope-from ) for ; Sat, 24 Feb 2024 19:56:20 +0100 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 YKcCBdQ72mWmKQAAe85BDQ (envelope-from ) for ; Sat, 24 Feb 2024 19:56:20 +0100 X-Envelope-To: larch@yhetil.org Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=soeren-tempel.net header.s=opensmtpd header.b=V+R0CbJ4; 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"; dmarc=fail reason="SPF not aligned (relaxed)" header.from=soeren-tempel.net (policy=none) ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1708800980; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: 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=dQTLg7AEcGIE+/5QD0SE0dLNR6G6HA+tLofetNuF/8s=; b=s3gTSbncVANCAuYdUZv4x0KjenLuIR8TwjBTQOpbmACd79dV/tY36U6hI5WB8i5ZerNsbn oFifgrbKtZ82bdmwHAIn+GQwzyzr/kuyKUNMhh97P2snO2SjFHGmKo0uagKc1z80jJc3z6 OkAWhPFgW9hmr03f0DW31FMbNG/xvO2x94xiGQN5pR1J5RVRkOpEvAEoRI7JrqkuEoVrsU F76e42+p8tB9rurDRjyBYIP7MMedMZeFPmubAO8QZZJCGREizXI0peclscak3b1M4qbo/m gYM8KFGpj7qGs8zjTpGw3rY0APXW+FDQBRyageqlXYloA+XQ8BZhJl+Jg412xA== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=soeren-tempel.net header.s=opensmtpd header.b=V+R0CbJ4; 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"; dmarc=fail reason="SPF not aligned (relaxed)" header.from=soeren-tempel.net (policy=none) ARC-Seal: i=1; s=key1; d=yhetil.org; t=1708800980; a=rsa-sha256; cv=none; b=RR5X0NDOlF+gMZr3F9/v4ZXZ8feMorXoZehO/ItvRd7gWyZ4rvzCjeje/CxTvKtKdWgLy3 4GZBHU+XSZq7Hzl7dAcJ230jsbwhQydF6ylxQVBFxiYiV1Eeh6DTRwltS8Vn9+/+qjPDee GBs071ljBtNgsO+Cv8uDSZ2mrM1qeu+8drTne5XYBAsawyZhAD+XmAlFAVcf1AfPi2Aiss PC7cim1/rqsS1MjE6jvmFywZ8WsvaOWDyeF5wzjbVjI0+jl6asIoBh6aUX0TKmiSLPIOX4 MaeoGZxVNQULAiAMigil2goIC683uF6EyIASYEubOP7QoT37JviF/y4uppUnjg== 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 D1F727091E for ; Sat, 24 Feb 2024 19:56:19 +0100 (CET) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rdxBc-0002K7-6m; Sat, 24 Feb 2024 13:55:48 -0500 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 1rdxBT-0002Hf-5A for guix-patches@gnu.org; Sat, 24 Feb 2024 13:55:41 -0500 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 1rdxBR-0006Ly-DY for guix-patches@gnu.org; Sat, 24 Feb 2024 13:55:38 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1rdxBp-00065L-JV for guix-patches@gnu.org; Sat, 24 Feb 2024 13:56:01 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#68757] [PATCH] services: dns: Add unbound service Resent-From: =?UTF-8?Q?S=C3=B6ren?= Tempel Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Sat, 24 Feb 2024 18:56:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 68757 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: Ludovic =?UTF-8?Q?Court=C3=A8s?= Cc: 68757@debbugs.gnu.org Received: via spool by 68757-submit@debbugs.gnu.org id=B68757.170880092123284 (code B ref 68757); Sat, 24 Feb 2024 18:56:01 +0000 Received: (at 68757) by debbugs.gnu.org; 24 Feb 2024 18:55:21 +0000 Received: from localhost ([127.0.0.1]:49410 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rdxBA-00063O-Gc for submit@debbugs.gnu.org; Sat, 24 Feb 2024 13:55:21 -0500 Received: from magnesium.8pit.net ([45.76.88.171]:29853) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rdx3k-0005b2-9s for 68757@debbugs.gnu.org; Sat, 24 Feb 2024 13:47:41 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; s=opensmtpd; bh=dQTLg7AEcG IE+/5QD0SE0dLNR6G6HA+tLofetNuF/8s=; h=in-reply-to:references:from: subject:cc:to:date; d=soeren-tempel.net; b=V+R0CbJ4mOACpqyy+KBrpl0RHW/ CDJK+18tVB3ItD8jH18LrhcoqfJvYoEyL/s3eXP5Hhh1USq2UOH8S/7zO3pFxFTjYha3s9 HytUtJwrxe28H301AKyu+BEWnGJ1A+Abp4Oiav+WjB/hN8/gV1s411G6n2l1fNffBwkXsn JmEs= Received: from localhost (dynamic-2a02-3102-49da-001b-acdb-b735-16a2-ee83.310.pool.telefonica.de [2a02:3102:49da:1b:acdb:b735:16a2:ee83]) by magnesium.8pit.net (OpenSMTPD) with ESMTPSA id 430aaae5 (TLSv1.3:TLS_AES_256_GCM_SHA384:256:YES); Sat, 24 Feb 2024 19:47:14 +0100 (CET) Date: Sat, 24 Feb 2024 19:45:44 +0100 From: =?UTF-8?Q?S=C3=B6ren?= Tempel References: <20240127121040.7156-2-soeren@soeren-tempel.net> <87sf1pls1y.fsf@gnu.org> In-Reply-To: <87sf1pls1y.fsf@gnu.org> Message-Id: <2O0HFY6AW6QUG.320OU5YPLJHHZ@8pit.net> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable 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-Country: US X-Migadu-Flow: FLOW_IN X-Migadu-Spam-Score: -5.17 X-Spam-Score: -5.17 X-Migadu-Queue-Id: D1F727091E X-Migadu-Scanner: mx11.migadu.com X-TUID: PtF98B+xSw3i Ludovic Court=C3=A8s wrote: > Hi S=C3=B6ren, Hi Ludovic, > For =E2=80=98remote-control=E2=80=99 and =E2=80=98server=E2=80=99, it= =E2=80=99s not clear to me why we resort to > alists instead of records (or fields within this record type); it looks > inconsistent. >=20 > Could you consider turning them into records or fields? Prior to submitting this patch I was experimenting with both records and alists for the Unbound configuration abstraction. Unbound has **a lot** of configuration options and new options are constantly getting added by upstream, see unbound.conf(5). Therefore, supporting them through a record type with fields for each configuration option requires a lot of code. Furthermore, it will require constant maintenance to keep up with new upstream options. I looked at prior art and noticed that the Nix service configuration for unbound just uses a plain hash with string keys [1]. This seemed like a good way to deal with the complexity of unbound.conf, hence I opted for a similar approach here. I don't think it's feasible to model the configuration using a record type with several hundred fields and, as rde uses an alist-based approach for services with similar complexity, I don't think its unheard of in the Guix world either. While it is not as =E2=80=9Ctype safe=E2=80=9D as a record-based approach (e.g. you can create= semantically invalid unbound configurations), it offers good forwards compatibility and requires less Scheme code. In theory, it would be possible to model sections with less options (e.g. the =E2=80=98remote-control=E2=80=99 or =E2=80=98server=E2=80=99 opti= on) using records. However, using alists for some sections and records for others seems inconsistent to me. Please let me know what you think so I can revise this accordingly. > I recommend adding an =E2=80=9Cescape hatch=E2=80=9D by which users may p= rovide raw > strings (or a file-like object) that gets inserted into the config file. I think at the moment, it should be possible to express all possible unbound configurations using the alist-based approach. If not, I would consider it this a bug in the Scheme abstraction. As such, I don't think there is a need for an =E2=80=9Cescape hatch=E2=80=9D right now (see also: = my comment on records and forwards compatibility above). However, if this is a common idiom then I can add such an escape hatch. The other things you mentioned seem obvious to me and I will just implement them as suggested in a v2 revision of the patch. Thanks for the feedback! Greetings, S=C3=B6ren [1]: https://github.com/NixOS/nixpkgs/blob/0a37316d6cfea44280f4470b6867a711= a24606bd/nixos/modules/services/networking/unbound.nix#L102-L126