From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp11.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms9.migadu.com with LMTPS id WJ5uLP0JmmTVLAAASxT56A (envelope-from ) for ; Mon, 26 Jun 2023 23:58:21 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp11.migadu.com with LMTPS id ABNXLP0JmmSolgAA9RJhRA (envelope-from ) for ; Mon, 26 Jun 2023 23:58:21 +0200 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 1A3F516212 for ; Mon, 26 Jun 2023 23:58:21 +0200 (CEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qDuDl-0002MF-6d; Mon, 26 Jun 2023 17:58:05 -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 1qDuDj-0002Lk-8V for guix-patches@gnu.org; Mon, 26 Jun 2023 17:58:03 -0400 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 1qDuDi-0004Pb-8O; Mon, 26 Jun 2023 17:58:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1qDuDh-0008Kl-NG; Mon, 26 Jun 2023 17:58:01 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#63985] [PATCH v3 00/11] Service subsystem improvements Resent-From: Bruno Victal Original-Sender: "Debbugs-submit" Resent-CC: liliana.prikler@gmail.com, maxim.cournoyer@gmail.com, ludo@gnu.org, guix-patches@gnu.org Resent-Date: Mon, 26 Jun 2023 21:58:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 63985 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 63985@debbugs.gnu.org Cc: Bruno Victal , liliana.prikler@gmail.com, maxim.cournoyer@gmail.com, ludo@gnu.org X-Debbugs-Original-Xcc: liliana.prikler@gmail.com, maxim.cournoyer@gmail.com, ludo@gnu.org Received: via spool by 63985-submit@debbugs.gnu.org id=B63985.168781667032018 (code B ref 63985); Mon, 26 Jun 2023 21:58:01 +0000 Received: (at 63985) by debbugs.gnu.org; 26 Jun 2023 21:57:50 +0000 Received: from localhost ([127.0.0.1]:47165 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qDuDV-0008KM-PW for submit@debbugs.gnu.org; Mon, 26 Jun 2023 17:57:50 -0400 Received: from smtpmciv5.myservices.hosting ([185.26.107.241]:56080) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qDuDT-0008KD-Rd for 63985@debbugs.gnu.org; Mon, 26 Jun 2023 17:57:48 -0400 Received: from mail1.netim.hosting (unknown [185.26.106.173]) by smtpmciv5.myservices.hosting (Postfix) with ESMTP id D736220E26 for <63985@debbugs.gnu.org>; Mon, 26 Jun 2023 23:57:45 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by mail1.netim.hosting (Postfix) with ESMTP id 465248009A; Mon, 26 Jun 2023 23:57:45 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at mail1.netim.hosting Received: from mail1.netim.hosting ([127.0.0.1]) by localhost (mail1-2.netim.hosting [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id e-gX9WqmQxnj; Mon, 26 Jun 2023 23:57:44 +0200 (CEST) Received: from guix-nuc.home.arpa (unknown [10.192.1.83]) (Authenticated sender: lumen@makinata.eu) by mail1.netim.hosting (Postfix) with ESMTPSA id 9B64680099; Mon, 26 Jun 2023 23:57:44 +0200 (CEST) From: Bruno Victal Date: Mon, 26 Jun 2023 22:57:27 +0100 Message-Id: X-Mailer: git-send-email 2.39.2 In-Reply-To: References: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1687816701; 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; bh=4veqQxs/vfTjrMYHPlphfsGHryXoYKEFI9HtxRFqu1U=; b=Fq5+Qsw8qf4kYsUjIsmBvavHPMhqz4k5784FKT9EZ9UYZ2JmqsYMS0v7y5R6cqOhIuzzcN 2xJaDr8qMGfes70k6dmH/dYRy/eJJUMoU+IR+G7GY/csJm6PTyoiYItynl6BtzMsYICwU6 jw/3P3XLDITeeubMEVSui40u1c8YFXrLPVRheoEZuymaY0ZSAn8Ox6Uw42J81Kmp+dtgPi qRZnjG17e9CX22cc0stf8kbROHGhmt81hsxY4otA6dvDiBnaK+zxFCY51lPly5AXSw4xZG DJhtfNfr5v0eduCVRyr5tqGkXnizhqYX9Q7d9CMLsaS38y/D1YkoHBrKH69ZeA== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=none; 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-Seal: i=1; s=key1; d=yhetil.org; t=1687816701; a=rsa-sha256; cv=none; b=hVdEwxEZ5lKpD5ci6p6xFC/qm9fYKZO9/UqVbztt3mRANvgDYhldw4UI1MzIjhL0atpfvE tiZNTcFplwmOmF39FwDCDzu77msydB6ZJmKdrfOmPIdIlrEiQR6utuDLkDLCtMsqlVT5zC fOZx1mugqFq1e1qHfM5ns8EhSzTEA4IbIM07Wn8tk+MyI+7qWarJGl+gRyrWMPimymmDcO KLsZlxDnQVlzuYXJHlelXKSgM/K2vzmwQOt+tiXY91XiuLatBfFjRgeevhCsgF//s2duqz cVuhHQFii7y8vesc9lWq7ejqOfwTWdMrayYt0tcVqMsAHfRKInOHN3ieXCFWPA== X-Migadu-Scanner: scn1.migadu.com X-Migadu-Spam-Score: -0.75 Authentication-Results: aspmx1.migadu.com; dkim=none; 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" X-Migadu-Queue-Id: 1A3F516212 X-Spam-Score: -0.75 X-TUID: jNX9euOgIQ3P This patch-series is an agglomeration of smaller but weakly-related patch-series, done so in order to build up the case for the changes. I structured the series in order to make it suitable for cherry-picking. Summary of changes: * Plumbing changes to serialize-configuration By orienting it around SRFI-171 transducers, it's now easier to build custom configuration serializing procedures. * New define-configuration syntax: serializer-options Serializers may now accept more than two arguments. * New module (gnu services configuration generic-ini) * Deduplicate often used predicates. * network-manager-service-type cleanup & new fields. Notable changes since v2: * Documentation changes The documentation for define-configuration was reworded to make later syntax extensions easier to document. In addition, the new 'serializer-options' is now documented. * (gnu services configuration) changes ** New predicates. Reduce code duplication by migrating some commonly used predicates into this module. * generic-ini changes ** Initial field testing Some deficiencies were found & corrected while doing a first field testing when network-manager-service-type was refactored to make use of this module. ** generic-ini- serializers ** Handling of multiple entries Implemented as a transducer, this is useful to deal with escape-hatch fields. * network-manager-service-type changes ** Use define-configuration for ** Refactored serialization process to use the new generic-ini module ** New configuration fields: log-configuration and extra-options Provides an escape hatch for options not yet implemented in the record type. ** Renamed fields: 'network-manager' to 'package' Naming the field 'package' is more informative & less confusing than a reduplication of the package-name with the field-name itself. Omissions in generic-ini: For now, I've omitted: * Custom leading (presumed to be whitespace) characters for entries à la gitconfig, mostly beautifying purposes * Configurable delimiter (\n, \r\n, \0, ...) * Configurable Key-value separator (this is usually =) These can be implemented later if required. Notes: The interface in (gnu services configuration generic-ini) is still in its infancy and might require further adjustments/additions and I'm still thinking about its potential generalizations to TOML & co. For the time being I'd prefer not to promise any interface stability. Nice to haves: I didn't have much luck in replacing the memq approach in the predicate with define-enumeration: --8<---------------cut here---------------start------------->8--- ;; This works. (define (network-manager-log-level? x) (memq x '(off err warn info debug trace))) ;; This does not. (define-enumeration network-manager-log-level? (off err warn info debug trace) network-manager-log-level-set) ;; While executing meta-command: ;; ERROR: ;; 1. &origin: "network-manager-log-level?" ;; 2. &message: "not a member of the set" ;; 3. &syntax: ;; form: #f ;; subform: #f --8<---------------cut here---------------end--------------->8--- Would be nice to know what went wrong and whether an enumeration could be used here instead. Bruno Victal (11): services: configuration: Simplify normalize-extra-args. services: configuration: Use transducers within serialize-configuration. services: fstrim-service-type: Serialize with SRFI-171 transducers. doc: Rewrite define-configuration. services: configuration: Add serializer-options field. services: configuration: New generic-ini module. services: configuration: Add some commonly used predicates. services: NetworkManager: Use define-configuration and generic-ini. services: NetworkManager: Prefer package over network-manager. services: NetworkManager: add log-configuration field. services: NetworkManager: Add extra-options field. Makefile.am | 1 + doc/guix.texi | 161 +++++---- gnu/local.mk | 1 + gnu/services/audio.scm | 7 +- gnu/services/configuration.scm | 108 ++++-- gnu/services/configuration/generic-ini.scm | 165 +++++++++ gnu/services/linux.scm | 11 +- gnu/services/networking.scm | 352 ++++++++++++++----- gnu/services/telephony.scm | 49 ++- tests/services/configuration.scm | 88 ++++- tests/services/configuration/generic-ini.scm | 129 +++++++ 11 files changed, 861 insertions(+), 211 deletions(-) create mode 100644 gnu/services/configuration/generic-ini.scm create mode 100644 tests/services/configuration/generic-ini.scm base-commit: ac86174e22fcd762893bd4515786b1376af9397b -- 2.39.2