From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp12.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms5.migadu.com with LMTPS id IAr3M+nmwmPdngAAbAwnHQ (envelope-from ) for ; Sat, 14 Jan 2023 18:31:21 +0100 Received: from aspmx1.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp12.migadu.com with LMTPS id GJbSM+nmwmMUmgAAauVa8A (envelope-from ) for ; Sat, 14 Jan 2023 18:31:21 +0100 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 5D5A7393F6 for ; Sat, 14 Jan 2023 18:31:21 +0100 (CET) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pGkMy-0000EN-LX; Sat, 14 Jan 2023 12:31:04 -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 1pGkMw-0000Cq-KB for guix-patches@gnu.org; Sat, 14 Jan 2023 12:31:03 -0500 Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pGkMw-0001og-Bn for guix-patches@gnu.org; Sat, 14 Jan 2023 12:31:02 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1pGkMw-0003zj-11 for guix-patches@gnu.org; Sat, 14 Jan 2023 12:31:02 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#60735] [PATCH 0/2] Implement etc-hosts-service-type Resent-From: Ludovic =?UTF-8?Q?Court=C3=A8s?= Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Sat, 14 Jan 2023 17:31:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 60735 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: Bruno Victal Cc: 60735@debbugs.gnu.org Received: via spool by 60735-submit@debbugs.gnu.org id=B60735.167371742215307 (code B ref 60735); Sat, 14 Jan 2023 17:31:01 +0000 Received: (at 60735) by debbugs.gnu.org; 14 Jan 2023 17:30:22 +0000 Received: from localhost ([127.0.0.1]:55484 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pGkMI-0003yp-9o for submit@debbugs.gnu.org; Sat, 14 Jan 2023 12:30:22 -0500 Received: from eggs.gnu.org ([209.51.188.92]:49748) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pGkMG-0003yc-2T for 60735@debbugs.gnu.org; Sat, 14 Jan 2023 12:30:21 -0500 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pGkM9-0001jX-8t; Sat, 14 Jan 2023 12:30:14 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-Version:In-Reply-To:Date:References:Subject:To: From; bh=Q72rthPK3vDCTcfYK/mYrZO+rvR2+Ug27G19U6+PA7Q=; b=p9iEciv6KWMyRDtkqcmh QBzUlN8bbRE0fNuEEpEnWrsCt5Q2UmylxTNxBIb9gztM+zcBNCJF5oc+VSqR3GtvxJFyd8MUpydzy TBq9VC6sU/OnC7PUDnI/HM6qrcXQzfMxAdmxNlueG3f57SHbeqOySIrkMVr/LRNWcM9Ej9F7Bef5z ElwQHV8PfiOeh/dLFeHEIO+ltn0EHl9r8Tls6imC0GYbGilTSHyWRoIbPsoQTGCR8RHeYl5WgE7Zg tyyPOiyDtoVxokDCZLlPy/Gmt+hsH/hHO0evCvMGohqhmTEwL/VNiKYmfljEhnsYncnHnFZEnweod nScx+0r1CB/kdg==; Received: from 91-160-117-201.subs.proxad.net ([91.160.117.201] helo=ribbon) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pGkM7-0003gP-9T; Sat, 14 Jan 2023 12:30:12 -0500 From: Ludovic =?UTF-8?Q?Court=C3=A8s?= References: <0248101fa24f80f52a0412930598a7bbc9f71194.1673457786.git.mirai@makinata.eu> Date: Sat, 14 Jan 2023 18:30:08 +0100 In-Reply-To: <0248101fa24f80f52a0412930598a7bbc9f71194.1673457786.git.mirai@makinata.eu> (Bruno Victal's message of "Wed, 11 Jan 2023 17:28:13 +0000") Message-ID: <87v8l981nj.fsf_-_@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.2 (gnu/linux) 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 ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gnu.org header.s=fencepost-gnu-org header.b=p9iEciv6; 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=pass (policy=none) header.from=gnu.org ARC-Seal: i=1; s=key1; d=yhetil.org; t=1673717481; a=rsa-sha256; cv=none; b=QkO+Y+bJuRHuWJo2I7YsLpECmr/Ltq3JWoPKVyOUL/rg1CWehKqHXkDqBkzJBwtTVUm2XD AlUiyUJAPFggWsbBXq2IhNw5azQCopC7hesEqPBAhAa7raynWNI2zUcoSgXZZYE9EqO1NW PXVCUT2youIyiGI2nP4VaPxbii0Ds02zxdzBGBh2q0L3GFm/sw8mzMU0kDKGt2Pce4eFSh Fwpyxn9sxQuvsHu6ZQR1iAeMtO6yXaQsYAVsLAyKu0/mczCHY+Aqjj85C09TDPJOuQYstW NxwUrC/j4S08805WIszlIdZOv9piC8aKR4D4b9pR5/BeUdVmSCqMv/1MClJ4Fg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1673717481; 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=Q72rthPK3vDCTcfYK/mYrZO+rvR2+Ug27G19U6+PA7Q=; b=JIVdU9UsnetX/8N4hVNsj/A6on/0i4FGuvd+bB9c6QuAfM2OO2oBml2jhgg6moVA1VVnyF U/GGXxjZqont3btPw90NvZBcAc7DFxRz9yWSeyeGSLxU+0JuL869ByOQgX4qQtOrK2yKZp dr/WicGxsw690Yy9b34DUWYeH7E1xFvXcffmD1zKQ/JcDaPYV6tURZvxuetqUn/XEIQ6Kt VJHQNv/it/Ju/S32/1ZCPAxwpezOIaIIyqdZ5mXzTprwPAle9Ji+TpLlCpgG9bk8NYvf0M 9c6EVVgEhCLFqLXQiSwgi28jsxgqyaw/wMGFDi7/tH0OigeyBbHSkoC7tLMSeQ== X-Migadu-Queue-Id: 5D5A7393F6 X-Migadu-Scanner: scn0.migadu.com Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gnu.org header.s=fencepost-gnu-org header.b=p9iEciv6; 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=pass (policy=none) header.from=gnu.org X-Migadu-Spam-Score: -4.31 X-Spam-Score: -4.31 X-TUID: dT2d/dUaMLxg Hello Bruno, Bruno Victal skribis: > * gnu/services.scm (etc-hosts-service-type): New variable. > * gnu/system.scm (operating-system-hosts-file): Deprecate procedure. > (warn-hosts-file-field-deprecation): New procedure, helper for > deprecated variable). > (operating-system)[hosts-file]: Use helper to warn deprecated field. > (operating-system-default-essential-services) > (hurd-default-essential-services): Use etc-hosts-service-type. > (local-host-aliases): Return a list of strings representing hosts file en= tries. > (default-/etc/hosts): Remove procedure. > (operating-system-etc-service): Remove hosts file. > * doc/guix.texi: Document it. Neat! Some comments: > +@defvar etc-hosts-service-type > +Type of the service that populates the entries for (@file{/etc/hosts}). > +This service can be extended by passing it lists of strings such as: > + > +@c TRANSLATORS: The domain names below SHOULD NOT be translated. > +@c They're domains reserved for use in documentation. (RFC6761 Section 6= .5) > +@lisp > +(list "127.0.0.1 example.com example.net" > + "::1 example.com example.net" > +@end lisp > +@end defvar [...] > +(define etc-hosts-service-type > + ;; Extend etc-service-type with a entry for @file{/etc/hosts}. > + (service-type > + (name 'etc-hosts) > + (extensions > + (list > + (service-extension etc-service-type > + (lambda (lst) > + `(("hosts" > + ,(plain-file "hosts" > + (string-join lst "\n" > + 'suffix)))))))) > + (compose concatenate) > + (extend append) > + (description "Populate the @file{/etc/hosts} file."))) Two suggestions: 1. Calling it =E2=80=98hosts-service-type=E2=80=99. 2. Instead of plain strings, take records along the lines of: (define-record-type* host make-host host? (address host-address) ;string (canonical-name host-canonical-name) ;string (aliases host-aliases (default '()))) ;list of strings WDYT? If =E2=80=9Chost=E2=80=9D is too likely to clash, we can call it or something, but I think it should be fine. > +(define-with-syntax-properties (warn-hosts-file-field-deprecation > + (value properties)) > + (when value > + (warning (source-properties->location properties) > + (G_ "the 'hosts-file' field is deprecated, please use \ > +'etc-hosts-service-type' instead~%"))) > + value) Could you move deprecation to a separate patch? Apart from that it LGTM, thank you! Ludo=E2=80=99.