GNU bug report logs - #78546
[PATCH 0/3] Add iwd-service-type.

Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.

Package: guix-patches; Reported by: Sergey Trofimov <sarg@HIDDEN>; Keywords: patch; Done: Sergey Trofimov <sarg@HIDDEN>; Maintainer for guix-patches is guix-patches@HIDDEN.
bug closed, send any further explanations to 78546 <at> debbugs.gnu.org and Sergey Trofimov <sarg@HIDDEN> Request was from Sergey Trofimov <sarg@HIDDEN> to control <at> debbugs.gnu.org. Full text available.

Message received at 78546 <at> debbugs.gnu.org:


Received: (at 78546) by debbugs.gnu.org; 24 May 2025 13:02:07 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat May 24 09:02:07 2025
Received: from localhost ([127.0.0.1]:58891 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1uIoVq-0004nF-36
	for submit <at> debbugs.gnu.org; Sat, 24 May 2025 09:02:07 -0400
Received: from mail-ed1-x52f.google.com ([2a00:1450:4864:20::52f]:42337)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
 (Exim 4.84_2) (envelope-from <sarg@HIDDEN>) id 1uIoVm-0004lb-Gw
 for 78546 <at> debbugs.gnu.org; Sat, 24 May 2025 09:02:03 -0400
Received: by mail-ed1-x52f.google.com with SMTP id
 4fb4d7f45d1cf-602c4eae8d5so1411184a12.1
 for <78546 <at> debbugs.gnu.org>; Sat, 24 May 2025 06:02:02 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=sarg.org.ru; s=google; t=1748091716; x=1748696516; darn=debbugs.gnu.org;
 h=content-transfer-encoding:mime-version:references:in-reply-to
 :message-id:date:subject:cc:to:from:from:to:cc:subject:date
 :message-id:reply-to;
 bh=GC00tEGbPfC7O13DM+4b3y+0C25XfAD6Ts6iaMwEZI8=;
 b=q8cu5nuqH2UbZBOYH1Is+VhQsP/Y4rxVXp6+tliQGuDO+RaYXnvWA26Ml9+92994Nz
 /CI0gNsicpapwncN2gKapJXfZfLFP0+7e3coCqZ3JV4ZWHakdNqXcmBOulhmwjArYTJR
 97TEAxGy6zZiq+qi+9puZ4BilVHIs4ELZt7rV4nNiHEtmpMLsVBTiL9Ok5T01fOy0n8r
 3HA+jxzc0oDEJHHTNUDlx2yRYS+pTS6h0Uh13O+LX88BfP8jU+KM+7A7yWhub5/CrOzK
 /xb1OWcyOGrUTu49KMSWKKvemMoJsIusTylZEt12KVWXC71GqaU12e/6betIy/O0jBmR
 O0NA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20230601; t=1748091716; x=1748696516;
 h=content-transfer-encoding:mime-version:references:in-reply-to
 :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc
 :subject:date:message-id:reply-to;
 bh=GC00tEGbPfC7O13DM+4b3y+0C25XfAD6Ts6iaMwEZI8=;
 b=OgV9xV+u9i0Hx+XSDrPVGmz4J/j/Y84OrQtxBSEATRWXXTyTzX/LdSTq7NNJaNwIai
 PObkfWVNZBqiHuvJfwelP+S0JBw4y8l3g61vk0xw/CDUO0F21pRS/d1B+WNlitn49TfB
 I8hZOg2ELE10dpupMcsBSXYAm6hoyRJKKw4+liuApBhYwEz7nPtzb2aQj4gmIOrfQ/04
 M5AhZOpgPZ+51dX0USeSUkIZSnOCejR6vJUGHz1G3HYZ2Xs+GUU+Y7ANk60zLwNF2sCw
 oTcdxU+LTzFtHMEm2qrYzKOUjm2WGbcByyR5JRo9WmpxBogrMSPOvwGdBq9O777EQLm8
 dR+w==
X-Gm-Message-State: AOJu0YwLhusIcQLE8F4q4DjFwDeeYK+fXubGXKnfbfA8bdDczPHUq3u+
 4KMpsGbt35HQaI7toQfwUIkBnNTHKGJbMnk532trVGiwKBCWcOCNiMwsiehjuCpym7inEJ2Shju
 Kltnsgn2jYw==
X-Gm-Gg: ASbGncsQLeZa+lvHLtBGU/kb88iyTUAZyju3mHrxEkej+xtGwAhWr9CmP9LIk3XbwRb
 g+Y5l6JkjTYT+ozIG8k7WZ/+9HLi3ITD0WMikzMmJT92tHQU74Bio6+284ZJVsfAVTA4XhmxCU8
 6hzd2Qu45yV694/ag1LiCmJEjkgS7nA2y8H0pD8UM3rj8UeIBdX1SqHhoa7Rw2SSTYxzm+zSQrb
 hHF6wFoJTkSPW1bKe2Vmu7/rIvA6gIjkJA769ZlFF/OUFhV7vlLblwXWpu7ixcxqyKtgAVOVshB
 wSbwlBRR7NKOl/lwiotOtRNQEfg7BJF3JlonopHZT1p78A3q
X-Google-Smtp-Source: AGHT+IHEQRObocb0ecrTqpFwc0iSakWV2+1e24XE2zQUacRF7DusUkO47nlYFV/5b+r2sd9aKweW4g==
X-Received: by 2002:a05:6402:26d6:b0:601:a16e:4827 with SMTP id
 4fb4d7f45d1cf-6028d6fe38bmr5654652a12.3.1748091715933; 
 Sat, 24 May 2025 06:01:55 -0700 (PDT)
Received: from localhost ([2a02:2454:a095:5600:a64e:31ff:fe38:fd6c])
 by smtp.gmail.com with ESMTPSA id
 4fb4d7f45d1cf-6005a6e746csm13683424a12.47.2025.05.24.06.01.55
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Sat, 24 May 2025 06:01:55 -0700 (PDT)
From: Sergey Trofimov <sarg@HIDDEN>
To: 78546 <at> debbugs.gnu.org
Subject: [PATCH v2 5/5] services: networking: Add iwd-service-type.
Date: Sat, 24 May 2025 15:01:32 +0200
Message-ID: <2712aa81a808916cd2ef13e22222214adf9e1322.1748091536.git.sarg@HIDDEN>
X-Mailer: git-send-email 2.49.0
In-Reply-To: <99f9547c43312c49e557b5e67a356a76cc6b2ad7.1748091536.git.sarg@HIDDEN>
References: <99f9547c43312c49e557b5e67a356a76cc6b2ad7.1748091536.git.sarg@HIDDEN>
MIME-Version: 1.0
X-Debbugs-Cc: Sergey Trofimov <sarg@HIDDEN>, Ludovic Courtès <ludo@HIDDEN>, Gabriel Wicki <gabriel@HIDDEN>, Maxim Cournoyer <maxim.cournoyer@HIDDEN>
Content-Transfer-Encoding: 8bit
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 78546
Cc: Sergey Trofimov <sarg@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

* gnu/services/networking.scm (iwd-service-type): New service type.
(iwd-configuration), (iwd-settings), (iwd-scan-settings),
(iwd-general-settings), (iwd-network-settings): New configuration types.
* doc/guix.texi (Networking setup): Document it.

Change-Id: I852115b9c6768b3ec4eedb34a7f9e66438bd1429
---
 doc/guix.texi               | 162 +++++++++++++++++++++++
 gnu/services/networking.scm | 249 ++++++++++++++++++++++++++++++++++++
 2 files changed, 411 insertions(+)

diff --git a/doc/guix.texi b/doc/guix.texi
index a9c815c35c..4d1b6372df 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -22408,6 +22408,168 @@ Networking Setup
 @end table
 @end deftp
 
+@cindex IWD
+@defvar iwd-service-type
+This is the service type to run @acronyml{IWD,Internet Wireless Daemon},
+a wireless daemon required to authenticate against encrypted WiFi
+networks.
+@end defvar
+
+@quotation Warning
+By default @code{iwd} removes and re-creates interfaces it manages.  It
+doesn't play nicely with @code{dhcp-client-service-type} that enumerates
+wireless interfaces before starting the Shepherd service.  Use either
+@code{dhcpcd-service-type} or the @code{iwd}'s built-in DHCP client (see
+@code{enable-network-configuration} option below).
+@end quotation
+
+@quotation Warning
+@code{iwd-service-type} conflicts with @code{wpa-supplicant-service-type}.
+Make sure only one is configured.
+@end quotation
+
+@c %start of fragment
+
+@deftp {Data Type} iwd-configuration
+Available @code{iwd-configuration} fields are:
+
+@table @asis
+@item @code{iwd} (default: @code{iwd}) (type: file-like)
+The IWD package to use.
+
+@item @code{interfaces} (default: @code{()}) (type: list-of-strings)
+If this is set, it must specify @dfn{glob patterns} matching network
+interfaces that IWD will control.
+
+@item @code{ignored-interfaces} (default: @code{()}) (type: list-of-strings)
+If this is set, it must specify @dfn{glob patterns} matching network
+interfaces that IWD will not manage.
+
+@item @code{phys} (default: @code{()}) (type: list-of-strings)
+If this is set, it must specify @dfn{glob patterns} matching network
+PHYs names that IWD will control.
+
+@item @code{ignored-phys} (default: @code{()}) (type: list-of-strings)
+If this is set, it must specify @dfn{glob patterns} matching network
+PHYs names that IWD will not manage.
+
+@item @code{shepherd-requirement} (default: @code{()}) (type: list-of-symbols)
+Shepherd requirements the service should depend on.
+
+@item @code{shepherd-provision} (default: @code{(iwd wireless-daemon)}) (type: list-of-symbols)
+The name(s) of the service.
+
+@item @code{config} (type: iwd-settings)
+Configuration settings.
+
+@end table
+
+@end deftp
+
+
+@c %end of fragment
+
+@c %start of fragment
+
+@deftp {Data Type} iwd-settings
+Available @code{iwd-settings} fields are:
+
+@table @asis
+@item @code{general} (type: iwd-general-settings)
+General settings.
+
+@item @code{network} (type: maybe-iwd-network-settings)
+Network settings.
+
+@item @code{scan} (type: maybe-iwd-scan-settings)
+Scan settings.
+
+@item @code{extra-config} (default: @code{()}) (type: list-of-strings)
+Extra configuration values to append to the IWD configuration file.
+
+@end table
+
+@end deftp
+
+
+@c %end of fragment
+
+@c %start of fragment
+
+@deftp {Data Type} iwd-general-settings
+Available @code{iwd-general-settings} fields are:
+
+@table @asis
+@item @code{enable-network-configuration?} (default: @code{#f}) (type: boolean)
+Setting this option to true enables @code{iwd} to configure the network
+interfaces with the IP addresses.
+
+@item @code{extra-options} (default: @code{()}) (type: alist)
+An association list of option symbols/strings to string values to be
+appended to the General settings group.
+
+@end table
+
+@end deftp
+
+
+@c %end of fragment
+
+@c %start of fragment
+
+@deftp {Data Type} iwd-network-settings
+Available @code{iwd-network-settings} fields are:
+
+@table @asis
+@item @code{enable-ipv6?} (default: @code{#t}) (type: boolean)
+Sets the global default that tells @code{iwd} whether it should
+configure IPv6 addresses and routes
+
+@item @code{name-resolving-service} (default: @code{none}) (type: resolving-service)
+Configures a DNS resolution method used by the system.
+
+@item @code{extra-options} (default: @code{()}) (type: alist)
+An association list of option symbols/strings to string values to be
+appended to the Network settings group.
+
+@end table
+
+@end deftp
+
+
+@c %end of fragment
+
+@c %start of fragment
+
+@deftp {Data Type} iwd-scan-settings
+Available @code{iwd-scan-settings} fields are:
+
+@table @asis
+@item @code{disable-periodic-scan?} (default: @code{#f}) (type: boolean)
+Setting this option to @code{#t} will prevent @code{iwd} from issuing
+the periodic scans for the available networks while disconnected.
+
+@item @code{initial-periodic-scan-interval} (default: @code{10}) (type: number)
+The initial periodic scan interval upon disconnect (in seconds).
+
+@item @code{maximum-periodic-scan-interval} (default: @code{300}) (type: number)
+The maximum periodic scan interval (in seconds).
+
+@item @code{disable-roaming-scan?} (default: @code{#f}) (type: boolean)
+Setting this option to @code{#t} will prevent @code{iwd} from trying to
+scan when roaming decisions are activated.
+
+@item @code{extra-options} (default: @code{()}) (type: alist)
+An association list of option symbols/strings to string values to be
+appended to the Scan settings group.
+
+@end table
+
+@end deftp
+
+
+@c %end of fragment
+
 @cindex ModemManager
 Some networking devices such as modems require special care, and this is
 what the services below focus on.
diff --git a/gnu/services/networking.scm b/gnu/services/networking.scm
index 900790ef2d..0a114d2a18 100644
--- a/gnu/services/networking.scm
+++ b/gnu/services/networking.scm
@@ -41,6 +41,7 @@
 ;;; along with GNU Guix.  If not, see <http://www.gnu.org/licenses/>.
 
 (define-module (gnu services networking)
+  #:use-module (gnu home services utils)
   #:use-module (gnu services)
   #:use-module (gnu services base)
   #:use-module (gnu services configuration)
@@ -56,6 +57,7 @@ (define-module (gnu services networking)
   #:use-module (gnu packages bash)
   #:use-module (gnu packages cluster)
   #:use-module (gnu packages connman)
+  #:use-module (gnu packages dns)
   #:use-module (gnu packages freedesktop)
   #:use-module (gnu packages linux)
   #:use-module (gnu packages tor)
@@ -80,6 +82,7 @@ (define-module (gnu services networking)
   #:use-module (srfi srfi-9)
   #:use-module (srfi srfi-26)
   #:use-module (srfi srfi-43)
+  #:use-module ((ice-9 curried-definitions) #:select (define))
   #:use-module (ice-9 match)
   #:use-module (ice-9 string-fun)
   #:use-module (json)
@@ -235,6 +238,21 @@ (define-module (gnu services networking)
             wpa-supplicant-configuration-extra-options
             wpa-supplicant-service-type
 
+            iwd-configuration
+            iwd-configuration-config
+            iwd-configuration-ignored-interfaces
+            iwd-configuration-ignored-phys
+            iwd-configuration-interfaces
+            iwd-configuration-iwd
+            iwd-configuration-phys
+            iwd-configuration-shepherd-provision
+            iwd-configuration-shepherd-requirement
+            iwd-service-type
+            iwd-general-settings
+            iwd-network-settings
+            iwd-scan-settings
+            iwd-settings
+
             hostapd-configuration
             hostapd-configuration?
             hostapd-configuration-package
@@ -2099,6 +2117,237 @@ (define wpa-supplicant-service-type
 implements authentication, key negotiation and more for wireless networks.")
                   (default-value (wpa-supplicant-configuration)))))
 
+
+;;;
+;;; IWD
+;;;
+(define (iwd-uglify-field-name name)
+  (object->camel-case-string name 'upper))
+
+(define (iwd-serialize-base field-name val)
+  (format #f "~a=~a\n" field-name val))
+
+(define (iwd-serialize-field field-name val)
+  (iwd-serialize-base (iwd-uglify-field-name field-name) val))
+
+(define iwd-serialize-number iwd-serialize-field)
+
+(define (iwd-serialize-boolean field-name value)
+  (iwd-serialize-field
+   (string-trim-right (symbol->string field-name) #\?)
+   (if value "true" "false")))
+
+(define (iwd-serialize-alist field-name value)
+  (if (null? value)
+      ""
+      #~(string-append #$@(generic-serialize-alist list
+                                                   iwd-serialize-base
+                                                   value))))
+
+(define-enumerated-field-type resolving-service
+  (none systemd resolvconf)
+  (prefix iwd-))
+
+(define-configuration iwd-general-settings
+  (enable-network-configuration?
+   (boolean #f)
+   "Setting this option to true enables @code{iwd} to configure the network
+interfaces with the IP addresses.")
+  (extra-options
+   (alist '())
+   "An association list of option symbols/strings to string values to be
+appended to the General settings group.")
+
+  (prefix iwd-))
+
+(define-configuration iwd-network-settings
+  (enable-ipv6?
+   (boolean #t)
+   "Sets the global default that tells @code{iwd} whether it should configure
+IPv6 addresses and routes")
+
+  (name-resolving-service
+   (resolving-service 'none)
+   "Configures a DNS resolution method used by the system.")
+
+  (extra-options
+   (alist '())
+   "An association list of option symbols/strings to string values to be
+appended to the Network settings group.")
+
+  (prefix iwd-))
+
+(define-configuration iwd-scan-settings
+  (disable-periodic-scan?
+   (boolean #f)
+   "Setting this option to @code{#t} will prevent @code{iwd} from issuing the
+periodic scans for the available networks while disconnected.")
+
+  (initial-periodic-scan-interval
+   (number 10)
+   "The initial periodic scan interval upon disconnect (in seconds).")
+
+  (maximum-periodic-scan-interval
+   (number 300)
+   "The maximum periodic scan interval (in seconds).")
+
+  (disable-roaming-scan?
+   (boolean #f)
+   "Setting this option to @code{#t} will prevent @code{iwd} from trying to scan
+when roaming decisions are activated.")
+
+  (extra-options
+   (alist '())
+   "An association list of option symbols/strings to string values to be
+appended to the Scan settings group.")
+
+  (prefix iwd-))
+
+(define-maybe iwd-network-settings)
+(define-maybe iwd-scan-settings)
+
+(define ((iwd-serialize-config-section fields) name cfg)
+  #~(format #f "[~a]\n~a\n"
+            #$(string-upcase (object->string name) 0 1)
+            #$(serialize-configuration cfg fields)))
+
+(define serialize-iwd-network-settings
+  (iwd-serialize-config-section iwd-network-settings-fields))
+
+(define serialize-iwd-scan-settings
+  (iwd-serialize-config-section iwd-scan-settings-fields))
+
+(define serialize-iwd-general-settings
+  (iwd-serialize-config-section iwd-general-settings-fields))
+
+(define-configuration iwd-settings
+  (general
+   (iwd-general-settings (iwd-general-settings))
+   "General settings.")
+
+  (network
+   maybe-iwd-network-settings
+   "Network settings.")
+
+  (scan
+   maybe-iwd-scan-settings
+   "Scan settings.")
+
+  (extra-config
+   (list-of-strings '())
+   "Extra configuration values to append to the IWD configuration file."
+   (serializer (lambda (_ value) (string-join value "\n" 'suffix)))))
+
+(define-configuration/no-serialization iwd-configuration
+  (iwd
+   (file-like iwd)
+   "The IWD package to use.")
+
+  (interfaces
+   (list-of-strings '())
+   "If this is set, it must specify @dfn{glob patterns} matching network
+interfaces that IWD will control.")
+
+  (ignored-interfaces
+   (list-of-strings '())
+   "If this is set, it must specify @dfn{glob patterns} matching network
+interfaces that IWD will not manage.")
+
+  (phys
+   (list-of-strings '())
+   "If this is set, it must specify @dfn{glob patterns} matching network
+PHYs names that IWD will control.")
+
+  (ignored-phys
+   (list-of-strings '())
+   "If this is set, it must specify @dfn{glob patterns} matching network
+PHYs names that IWD will not manage.")
+
+  (shepherd-requirement
+   (list-of-symbols '())
+   "Shepherd requirements the service should depend on.")
+
+  (shepherd-provision
+   (list-of-symbols '(iwd wireless-daemon))
+   "The name(s) of the service.")
+
+  (config
+   (iwd-settings (iwd-settings))
+   "Configuration settings."))
+
+(define (iwd-generate-documentation)
+  (configuration->documentation 'iwd-configuration)
+  (configuration->documentation 'iwd-settings)
+  (configuration->documentation 'iwd-general-settings)
+  (configuration->documentation 'iwd-network-settings)
+  (configuration->documentation 'iwd-scan-settings))
+
+(define (iwd-config-file config)
+  "Return an IWD configuration file."
+  (mixed-text-file "main.conf"
+                   (serialize-configuration
+                    (iwd-configuration-config config)
+                    iwd-settings-fields)))
+
+(define (iwd-environment config)
+  (let ((resolver
+         (and=> (iwd-settings-network (iwd-configuration-config config))
+                iwd-network-settings-name-resolving-service)))
+
+    (if (eq? resolver 'resolvconf)
+        #~(list (string-append "PATH=" #$openresolv "/sbin"))
+        '())))
+
+(define (iwd-shepherd-service config)
+  (match-record config <iwd-configuration>
+                (iwd interfaces ignored-interfaces
+                     phys ignored-phys
+                     shepherd-requirement shepherd-provision)
+
+    (list (shepherd-service
+           (documentation "Run Internet Wireless Daemon")
+           (provision shepherd-provision)
+           (requirement `(user-processes dbus-system loopback ,@shepherd-requirement))
+           (start #~(make-forkexec-constructor
+                     (list (string-append #$iwd "/libexec/iwd")
+                           "--logger=syslog"
+                           #$@(if (null? interfaces) '()
+                                  (list (string-append "--interfaces="
+                                                       (string-join interfaces ","))))
+                           #$@(if (null? ignored-interfaces) '()
+                                  (list (string-append "--nointerfaces="
+                                                       (string-join ignored-interfaces ","))))
+                           #$@(if (null? phys) '()
+                                  (list (string-append "--phys="
+                                                       (string-join phys ","))))
+                           #$@(if (null? ignored-phys) '()
+                                  (list (string-append "--nophys="
+                                                       (string-join ignored-phys ",")))))
+
+                     #:environment-variables
+                     #$(iwd-environment config)))
+           (stop #~(make-kill-destructor))))))
+
+(define (iwd-etc-service config)
+  `(("iwd/main.conf" ,(iwd-config-file config))))
+
+(define iwd-service-type
+  (let ((add-iwd-package (compose list iwd-configuration-iwd)))
+    (service-type (name 'iwd)
+                  (extensions
+                   (list (service-extension shepherd-root-service-type
+                                            iwd-shepherd-service)
+                         (service-extension etc-service-type
+                                            iwd-etc-service)
+                         (service-extension dbus-root-service-type
+                                            add-iwd-package)
+                         (service-extension profile-service-type
+                                            add-iwd-package)))
+                  (default-value (iwd-configuration))
+                  (description
+                   "Run @url{https://iwd.wiki.kernel.org/,Iwd},
+a network connection manager."))))
+
 
 ;;;
 ;;; Hostapd.
-- 
2.49.0





Information forwarded to sarg@HIDDEN, ludo@HIDDEN, gabriel@HIDDEN, maxim.cournoyer@HIDDEN, guix-patches@HIDDEN:
bug#78546; Package guix-patches. Full text available.

Message received at 78546 <at> debbugs.gnu.org:


Received: (at 78546) by debbugs.gnu.org; 24 May 2025 13:02:06 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat May 24 09:02:06 2025
Received: from localhost ([127.0.0.1]:58889 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1uIoVp-0004n8-Lh
	for submit <at> debbugs.gnu.org; Sat, 24 May 2025 09:02:06 -0400
Received: from mail-ej1-x630.google.com ([2a00:1450:4864:20::630]:61889)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
 (Exim 4.84_2) (envelope-from <sarg@HIDDEN>) id 1uIoVk-0004lM-6o
 for 78546 <at> debbugs.gnu.org; Sat, 24 May 2025 09:02:00 -0400
Received: by mail-ej1-x630.google.com with SMTP id
 a640c23a62f3a-ad52dfe06ceso81063766b.3
 for <78546 <at> debbugs.gnu.org>; Sat, 24 May 2025 06:02:00 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=sarg.org.ru; s=google; t=1748091714; x=1748696514; darn=debbugs.gnu.org;
 h=content-transfer-encoding:mime-version:references:in-reply-to
 :message-id:date:subject:cc:to:from:from:to:cc:subject:date
 :message-id:reply-to;
 bh=mMFG6j+rZz6lJvX7uvOzNIWYz9EJ27TouhVujx5bIt0=;
 b=cT5SKzC4d9RU78GmflQDfWQ0lLrTf3GU1hVDAQtYBtL6gH2Hpbn/aORTQvwQwEDZRK
 Pj6cHIqO1YbI8sv4TB2SzlXkNvg/p00UoewLSTG/mFW6NVhFGGbZQZVLkbrNGFN4yufH
 lOT1e3Uq/rnV0CGV76H0hSLAt3Ohl9XiMHge55dDN3wZmhc3f3MbjoWocKmJ9uBegAYR
 3haer5ZRVZ6H0eT/BXomvgBzkVOkFIvCaIpE2qfM63at1f+ItdHq/HAS0Trd2Mkmzl9O
 97fqsPMieLGixw+Gk+2DTgegvLFZaTxuxdrsg49Z95pRvQm+iP7VvU3MD82ioKVrHq5Z
 Z67w==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20230601; t=1748091714; x=1748696514;
 h=content-transfer-encoding:mime-version:references:in-reply-to
 :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc
 :subject:date:message-id:reply-to;
 bh=mMFG6j+rZz6lJvX7uvOzNIWYz9EJ27TouhVujx5bIt0=;
 b=GquFQ2xK2iy+5Mhx0a1MbjJIPMMBioPBo9lud3GnObZioPibmXx94wnbzxoiKODat2
 sr3kWgAEIdtFxEhcx1JmElrSMQL2kzKE8RhIJEbY8P2AWi8zWPlrMpzISwFZPJkuJlm8
 WjMoHjW83GAzcZhh0Jkm1X5cZIIzy3cB2OBh0laQgAOwQuu/+xa6y/gWhknnsoUMaSD1
 sj0Jsk1VMgybcVhgoxybTGCbNBlz5Ft8McN0d24h3Q1abO/6OOK4EHLPXEwUNjN9P0qv
 KREgDGFT/IHMoroRwUncEzYrpFipW0k03njhADtji9eMcz9fxIq97SBEZyHyNT6pdJIv
 J4Vw==
X-Gm-Message-State: AOJu0YxBDaB0co8cCyS4CEyxFI7lNDn1/MVF7WyLeFfq1tePr2uBsEzo
 ssHg1lz9avWo0iV50T9e4G2x/ix1ACBSrZ1idvEHU0MC338JZJ37Siz2ONuTvZqJ/bgpX+4bK0+
 47vwcy0PF6Q==
X-Gm-Gg: ASbGncsRKKWfjySYJyhZ2jZlTRFJgDNtgq/5DBB1q7XkQUdM2q6eJQZAzHqhtaMGRPR
 xYRJFFhNvHF22j1pN48bGHASv42UmqtEJl6fWYG62p0klGLSR/0n/kHgPxyexWoDl2weySFK+xE
 t/GjlF2vaYHBRfqHcK/iJhSr5FNygQF159iM99rJhcmmVUG4Z3i5gRetNVj6LTdTO0UPNeJsCwQ
 NPSoNLUQa+BOc5LG/s9JEVMSor4xP3wpDjd2xJeQZIP6PQXIsDTwlRcVodshK8AnJ4Z0lZVQGVM
 +aHbLzUtpPW7vEeHvNhVnSGIbtfM5N/RpedL4T0xO8LNn0Lm
X-Google-Smtp-Source: AGHT+IE36sFlxrQf0q0kKBS54R2DXi0GDAPR0dZ6Xa135HhDuIpvONoS3E5cjAfkKuAXhO6TOQqJkw==
X-Received: by 2002:a17:907:8dcb:b0:ad2:5499:7599 with SMTP id
 a640c23a62f3a-ad85b0d2777mr221450866b.18.1748091713644; 
 Sat, 24 May 2025 06:01:53 -0700 (PDT)
Received: from localhost ([2a02:2454:a095:5600:a64e:31ff:fe38:fd6c])
 by smtp.gmail.com with ESMTPSA id
 a640c23a62f3a-ad52d4466e2sm1407423366b.93.2025.05.24.06.01.53
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Sat, 24 May 2025 06:01:53 -0700 (PDT)
From: Sergey Trofimov <sarg@HIDDEN>
To: 78546 <at> debbugs.gnu.org
Subject: [PATCH v2 4/5] services: network-manager: Require wireless-daemon.
Date: Sat, 24 May 2025 15:01:31 +0200
Message-ID: <70e373df86451559144b1399fb392ee39066048e.1748091536.git.sarg@HIDDEN>
X-Mailer: git-send-email 2.49.0
In-Reply-To: <99f9547c43312c49e557b5e67a356a76cc6b2ad7.1748091536.git.sarg@HIDDEN>
References: <99f9547c43312c49e557b5e67a356a76cc6b2ad7.1748091536.git.sarg@HIDDEN>
MIME-Version: 1.0
X-Debbugs-Cc: Sergey Trofimov <sarg@HIDDEN>, Ludovic Courtès <ludo@HIDDEN>, Gabriel Wicki <gabriel@HIDDEN>, Maxim Cournoyer <maxim.cournoyer@HIDDEN>
Content-Transfer-Encoding: 8bit
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 78546
Cc: Sergey Trofimov <sarg@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

* gnu/services/networking.scm
(<network-manager-configuration>)[shepherd-requirement]:
Replace wpa-supplicant with wireless-daemon.
* doc/guix.texi (Networking Setup): Adjust.

Change-Id: Id1a51429ccb6ea24839fc2aacd051a3ffe91c33c
---
 doc/guix.texi               | 11 ++++++-----
 gnu/services/networking.scm |  2 +-
 2 files changed, 7 insertions(+), 6 deletions(-)

diff --git a/doc/guix.texi b/doc/guix.texi
index a3956172bc..a9c815c35c 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -22047,11 +22047,12 @@ Networking Setup
 @item @code{network-manager} (default: @code{network-manager})
 The NetworkManager package to use.
 
-@item @code{shepherd-requirement} (default: @code{'(wpa-supplicant)})
-This option can be used to provide a list of symbols naming Shepherd services
-that this service will depend on, such as @code{'wpa-supplicant} or
-@code{'iwd} if you require authenticated access for encrypted WiFi or Ethernet
-networks.
+@item @code{shepherd-requirement} (default: @code{'(wireless-daemon)})
+This option can be used to provide a list of symbols naming Shepherd
+services that this service will depend on. The default @code{'wireless-daemon}
+is provided by @code{'wpa-supplicant-service-type} and @code{'iwd-service-type}.
+Make sure you have one of these configured. Note, that @code{%desktop-services}
+already include @code{wpa-supplicant-service-type}.
 
 @item @code{dns} (default: @code{"default"})
 Processing mode for DNS, which affects how NetworkManager uses the
diff --git a/gnu/services/networking.scm b/gnu/services/networking.scm
index 582c0edd32..900790ef2d 100644
--- a/gnu/services/networking.scm
+++ b/gnu/services/networking.scm
@@ -1417,7 +1417,7 @@ (define-record-type* <network-manager-configuration>
   (network-manager network-manager-configuration-network-manager
                    (default network-manager))
   (shepherd-requirement network-manager-configuration-shepherd-requirement
-                        (default '(wpa-supplicant)))
+                        (default '(wireless-daemon)))
   (dns network-manager-configuration-dns
        (default "default"))
   (vpn-plugins network-manager-configuration-vpn-plugins ;list of file-like
-- 
2.49.0





Information forwarded to sarg@HIDDEN, ludo@HIDDEN, gabriel@HIDDEN, maxim.cournoyer@HIDDEN, guix-patches@HIDDEN:
bug#78546; Package guix-patches. Full text available.

Message received at 78546 <at> debbugs.gnu.org:


Received: (at 78546) by debbugs.gnu.org; 24 May 2025 13:02:05 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat May 24 09:02:05 2025
Received: from localhost ([127.0.0.1]:58885 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1uIoVp-0004n3-26
	for submit <at> debbugs.gnu.org; Sat, 24 May 2025 09:02:05 -0400
Received: from mail-ej1-x634.google.com ([2a00:1450:4864:20::634]:54338)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
 (Exim 4.84_2) (envelope-from <sarg@HIDDEN>) id 1uIoVj-0004lI-P5
 for 78546 <at> debbugs.gnu.org; Sat, 24 May 2025 09:02:00 -0400
Received: by mail-ej1-x634.google.com with SMTP id
 a640c23a62f3a-ad55d6aeb07so125606866b.0
 for <78546 <at> debbugs.gnu.org>; Sat, 24 May 2025 06:01:59 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=sarg.org.ru; s=google; t=1748091713; x=1748696513; darn=debbugs.gnu.org;
 h=content-transfer-encoding:mime-version:references:in-reply-to
 :message-id:date:subject:cc:to:from:from:to:cc:subject:date
 :message-id:reply-to;
 bh=DlWCtWAByAe0vqFel3WB7JLQT2uDi0/0ytsdvpc4pvs=;
 b=KigqPYoD7eOMQaf7D7rwlaXbfzAzxuyN3Cb/u+p1CrO8j08AWv6e0I8+XY3+rsGkhC
 xizCGjZDg8FRoxMBoHbVH1WRGXfFliBSCXC1Bh5XIMgVzgIAjtkswOBz3h/JOy57oVLO
 RDe185hYSt1UfO7l03vCpOGsVJRhji2xyHUq5x8u9O28MaqBwww9AzgdubtPjQXI5Cn3
 zZfiM7ydpWInrOneEnJ5KDVsOGZwnDownr8TxwhXE4bBk2tIRjh05otGSHXEp2AFr6wr
 EtS7vArAAJEm9ydNZxcqUzdP9STcrA5ZH17vE8ENk+dwLo1KE/Y3cyeyRXhVUCIEn9bR
 zv3Q==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20230601; t=1748091713; x=1748696513;
 h=content-transfer-encoding:mime-version:references:in-reply-to
 :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc
 :subject:date:message-id:reply-to;
 bh=DlWCtWAByAe0vqFel3WB7JLQT2uDi0/0ytsdvpc4pvs=;
 b=lCbGJqZznZkjzPztWSgN+8vNScY6Pvx5Bs5YHQS8zv9KpNtINJFWO5lRuizKLOc0y9
 DW6UwVRI85LZt09HAJnqsOESbwPWJ+TK/WLG2yB4WEbwnMf5Ox44ZhpLJMdJBCsNyokj
 X1+Pq6gJAfiqmEmKo/yW0eGtR6IRLMJRD4TbAfUr6WwwrSSRXdcMk6c2EcuV26cRSxhh
 Q/pleqITKpauz7VGaH2xE5q47w+5770+d/4Lf+XcdWeHtMmn3jHlfBWxQYmIK9kOQzqK
 dBxZbVrA/8Foi9AMdPPxGXiW4Hkn6ImrElAP6xr3ZdghYm735mbNWUgWu8M1OYjlY6c/
 Dm5g==
X-Gm-Message-State: AOJu0YyyZ9iiKV6q9Fk/hLXTDSrFRortZqElgZdoFPdywW4Whu1n9hUn
 /bXrCUism66QijG93BkL2AZ1/oLTi6a2NJX1c4ZHMtEzYBf3+5ZE/O9Lf30Jml4reZBjgydWFgX
 BrfMZnu8GsA==
X-Gm-Gg: ASbGncswt5g7A4L4MWh0Yt9+Ov43Qi3jNwd4CQVaFCuuMum4Q64J07Qax1Dp1z3bpO7
 W6U/8owROsnHuFbPbaDi2FoHlJ7jWypOQblvfbHG67HArQ2sPAESr1GgCt55bL4f6QJw6Pp/loP
 dWvv7SBlt46c4F0pynvy6j5QuzyZ4E+Ay8YxKTokXREWxO59EzvwoyZ6b6kBDZl/UBH+myMbZ0M
 +jPkH/R7THne1ajaBnLBeVasmMlwe1zJxqrwGe43skxtPRCWtOLm0dZBKTCv/+QMwVmyG+FnusQ
 kGVICongPdS4C+9s/btEMTzGyAPr+vykzdnDixbNGIbNJXDTbbB19ODKZgc=
X-Google-Smtp-Source: AGHT+IEm0LQdBFhBp39cBxi4faSV7x8tCZ4stOHtsPtLfsWiY0Yknn0yZnl5Zh6Sihsv3G0KTTWnnQ==
X-Received: by 2002:a17:907:3faa:b0:ad5:d494:a22a with SMTP id
 a640c23a62f3a-ad85b077992mr232355566b.27.1748091711379; 
 Sat, 24 May 2025 06:01:51 -0700 (PDT)
Received: from localhost ([2a02:2454:a095:5600:a64e:31ff:fe38:fd6c])
 by smtp.gmail.com with ESMTPSA id
 a640c23a62f3a-ad52d04af1esm1378295066b.20.2025.05.24.06.01.50
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Sat, 24 May 2025 06:01:50 -0700 (PDT)
From: Sergey Trofimov <sarg@HIDDEN>
To: 78546 <at> debbugs.gnu.org
Subject: [PATCH v2 3/5] services: wpa-supplicant: Add 'wireless-daemon'
 provision.
Date: Sat, 24 May 2025 15:01:30 +0200
Message-ID: <eea64af0a0a1fa4c5c75a518e03f04db5df398d8.1748091536.git.sarg@HIDDEN>
X-Mailer: git-send-email 2.49.0
In-Reply-To: <99f9547c43312c49e557b5e67a356a76cc6b2ad7.1748091536.git.sarg@HIDDEN>
References: <99f9547c43312c49e557b5e67a356a76cc6b2ad7.1748091536.git.sarg@HIDDEN>
MIME-Version: 1.0
X-Debbugs-Cc: Sergey Trofimov <sarg@HIDDEN>, Ludovic Courtès <ludo@HIDDEN>, Gabriel Wicki <gabriel@HIDDEN>, Maxim Cournoyer <maxim.cournoyer@HIDDEN>
Content-Transfer-Encoding: 8bit
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 78546
Cc: Sergey Trofimov <sarg@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

* gnu/services/networking.scm (wpa-supplicant-configuration):
[requirement]: Deprecate, [shepherd-requirement]: New field,
[shepherd-provision]: Extract to a field. Add 'wireless-daemon to it.
* doc/guix.texi (Networking Setup): Document it.

Change-Id: Icc6fdd695e6e96ef168a085524989da639f77cd3
---
 doc/guix.texi               |  5 +++-
 gnu/services/networking.scm | 52 ++++++++++++++++++++++++-------------
 2 files changed, 38 insertions(+), 19 deletions(-)

diff --git a/doc/guix.texi b/doc/guix.texi
index 502482b754..a3956172bc 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -22383,9 +22383,12 @@ Networking Setup
 @item @code{wpa-supplicant} (default: @code{wpa-supplicant})
 The WPA Supplicant package to use.
 
-@item @code{requirement} (default: @code{'(user-processes loopback syslogd)}
+@item @code{shepherd-requirement} (default: @code{(user-processes loopback syslogd)}
 List of services that should be started before WPA Supplicant starts.
 
+@item @code{shepherd-provision} (default: @code{(wpa-supplicant wireless-daemon)}) (type: list-of-symbols)
+The name(s) of the service.
+
 @item @code{dbus?} (default: @code{#t})
 Whether to listen for requests on D-Bus.
 
diff --git a/gnu/services/networking.scm b/gnu/services/networking.scm
index 4cb7313808..582c0edd32 100644
--- a/gnu/services/networking.scm
+++ b/gnu/services/networking.scm
@@ -226,6 +226,8 @@ (define-module (gnu services networking)
             wpa-supplicant-configuration?
             wpa-supplicant-configuration-wpa-supplicant
             wpa-supplicant-configuration-requirement
+            wpa-supplicant-configuration-shepherd-requirement
+            wpa-supplicant-configuration-shepherd-provision
             wpa-supplicant-configuration-pid-file
             wpa-supplicant-configuration-dbus?
             wpa-supplicant-configuration-interface
@@ -2022,34 +2024,48 @@ (define usb-modeswitch-service-type
 ;;; WPA supplicant
 ;;;
 
+(define-with-syntax-properties (warn-deprecated-wpa-supplicant-requirement
+                                (value properties))
+  (unless (unspecified? value)
+    (warning (source-properties->location properties)
+             (G_ "the 'requirement' field is deprecated, please use \
+'shepherd-requirement' field instead~%")))
+  value)
+
 (define-record-type* <wpa-supplicant-configuration>
   wpa-supplicant-configuration make-wpa-supplicant-configuration
   wpa-supplicant-configuration?
-  (wpa-supplicant     wpa-supplicant-configuration-wpa-supplicant ;file-like
-                      (default wpa-supplicant))
-  (requirement        wpa-supplicant-configuration-requirement    ;list of symbols
-                      (default '(user-processes loopback syslogd)))
-  (pid-file           wpa-supplicant-configuration-pid-file       ;string
-                      (default "/var/run/wpa_supplicant.pid"))
-  (dbus?              wpa-supplicant-configuration-dbus?          ;Boolean
-                      (default #t))
-  (interface          wpa-supplicant-configuration-interface      ;#f | string
-                      (default #f))
-  (config-file        wpa-supplicant-configuration-config-file    ;#f | <file-like>
-                      (default #f))
-  (extra-options      wpa-supplicant-configuration-extra-options  ;list of strings
-                      (default '())))
+  (wpa-supplicant        wpa-supplicant-configuration-wpa-supplicant ;file-like
+                         (default wpa-supplicant))
+  (requirement           wpa-supplicant-configuration-requirement ;list of symbols
+                         (sanitize warn-deprecated-wpa-supplicant-requirement)
+                         (default *unspecified*))
+  (pid-file              wpa-supplicant-configuration-pid-file ;string
+                         (default "/var/run/wpa_supplicant.pid"))
+  (dbus?                 wpa-supplicant-configuration-dbus? ;Boolean
+                         (default #t))
+  (interface             wpa-supplicant-configuration-interface ;#f | string
+                         (default #f))
+  (config-file           wpa-supplicant-configuration-config-file ;#f | <file-like>
+                         (default #f))
+  (extra-options         wpa-supplicant-configuration-extra-options ;list of strings
+                         (default '()))
+  (shepherd-provision    wpa-supplicant-configuration-shepherd-provision    ;list of symbols
+                         (default '(wpa-supplicant wireless-daemon)))
+  (shepherd-requirement  wpa-supplicant-configuration-shepherd-requirement  ;list of symbols
+                         (default '(user-processes loopback syslogd))))
 
 (define (wpa-supplicant-shepherd-service config)
   (match-record config <wpa-supplicant-configuration>
     (wpa-supplicant requirement pid-file dbus?
+                    shepherd-requirement shepherd-provision
                     interface config-file extra-options)
     (list (shepherd-service
            (documentation "Run the WPA supplicant daemon")
-           (provision '(wpa-supplicant))
-           (requirement (if dbus?
-                            (cons 'dbus-system requirement)
-                            requirement))
+           (provision shepherd-provision)
+           (requirement `(,@(if dbus? '(dbus-system) '())
+                          ,@(or (if (unspecified? requirement) #f requirement)
+                                shepherd-requirement)))
            (start #~(make-forkexec-constructor
                      (list (string-append #$wpa-supplicant
                                           "/sbin/wpa_supplicant")
-- 
2.49.0





Information forwarded to sarg@HIDDEN, ludo@HIDDEN, gabriel@HIDDEN, maxim.cournoyer@HIDDEN, guix-patches@HIDDEN:
bug#78546; Package guix-patches. Full text available.

Message received at 78546 <at> debbugs.gnu.org:


Received: (at 78546) by debbugs.gnu.org; 24 May 2025 13:02:00 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat May 24 09:02:00 2025
Received: from localhost ([127.0.0.1]:58877 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1uIoVi-0004lo-Rw
	for submit <at> debbugs.gnu.org; Sat, 24 May 2025 09:01:59 -0400
Received: from mail-ej1-x632.google.com ([2a00:1450:4864:20::632]:55447)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
 (Exim 4.84_2) (envelope-from <sarg@HIDDEN>) id 1uIoVf-0004l2-WA
 for 78546 <at> debbugs.gnu.org; Sat, 24 May 2025 09:01:56 -0400
Received: by mail-ej1-x632.google.com with SMTP id
 a640c23a62f3a-ad5394be625so139606366b.2
 for <78546 <at> debbugs.gnu.org>; Sat, 24 May 2025 06:01:55 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=sarg.org.ru; s=google; t=1748091709; x=1748696509; darn=debbugs.gnu.org;
 h=content-transfer-encoding:mime-version:references:in-reply-to
 :message-id:date:subject:cc:to:from:from:to:cc:subject:date
 :message-id:reply-to;
 bh=723MHo23hm4gTpbk9/KTk+L2vHplj/qdoWmMDcOgy/s=;
 b=pcB8WoYK6S1R54DQ5yDWx9ApxgukPFTAIAX70c4WKOnrMqcvdnSnK1AgOSH5crHWtW
 cy1KY5Y2gEBSaglrxRxWUFIa4UNF48XUjpGRJtg70ZZFMVJS1MGVLN0Pkth++tu1ZTy/
 eV3HimUnV8h3Bt69iUg7zsu3eSao/uqSiK8O/bW0sqqDc+28GvNJmF3bzU4MrgsKCBqn
 /ydt3vtt+UMnslYEcsZettOGLyhSFkbB02EUTptXm9VN6nigspVtKhbSF+Nuqh9gqJ0t
 8egA4AsI7FK2u2U9eAck636ToLq9hfxP1EfjXL+0Ba9MJjB4/Qc/gqF1mhUkEnH4WUjw
 /B2g==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20230601; t=1748091709; x=1748696509;
 h=content-transfer-encoding:mime-version:references:in-reply-to
 :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc
 :subject:date:message-id:reply-to;
 bh=723MHo23hm4gTpbk9/KTk+L2vHplj/qdoWmMDcOgy/s=;
 b=NCntnw7r3g2rFJMD4neMqhF89NLlpxiML2DyKSOC35viYIRnYpz3k+IkfxCqAHbN5Q
 CcvHLcifZhSe7xXFcjpEyf1vqg7z9kyPndVosIdoGnX5E1uC8eeDTyysynz9v8pUmGba
 ay+Em2F33Lwx5NH14DcivwV8Qh/f6gGC77FCVFZqn2GyzpwmT85rnjugZqeI88GaCfoL
 +sidh1+oDNKCPqZacfWh/pddrutHbJLf6uAHVGUJkxCQYSsPbnIaMfZ3lB0MCGldDQCs
 5p2xrbVrsmCnazq7hw4VRvxUxmvdAsl7rs32koLu0aMxGkqrORL0OVxt/AH4VoH7DZzF
 5Ldg==
X-Gm-Message-State: AOJu0Yzr6LgaZWid6KIPNcilcMSThv/haJ9JkmNTyrglm53TaNoikwWs
 GXXkgfbjTCZVMFSSLOSFHCMmBdrZfP3yuYA850GLpcb+hWrBH1F/cYwJ8hwERVhO4C+QscSB04U
 XJ3Jyyol8aQ==
X-Gm-Gg: ASbGncsgCSM2nGIq9p8fZra6kHcMaZO+V+k/ToiZPt1O/9tcC6jPERxrs6XI+VEZjBg
 ur93O9zXQroCJTS4mfC1ZZlLJN4cFa1h/l70mzgHDt+nDNdXkxtcmwVX16zPWp0/WLMmFVptwI3
 ypTFZ8lciCCwdKavav42cMn9+HmtbxN3Uev5n+dhuPWn5n93tiIx5UzcOw905nWIZ4xkkzjdafm
 /RdkHNxnHHVxKUU/et/JA9k9O7iEO/u6cDXARdHLauf9ozEFqtgOurDImwPk1kCR239YouZd1kA
 m6ZCvcAkQXrrgub3nFGEQ6Efx5FiA50S1ivqU/GumabHXOpl
X-Google-Smtp-Source: AGHT+IFDVzb2bdgyHrXSqimsQkhKJEApfDEpeUnW0lmPgkigBtH7nnbHc0/vx12PWkUH5ERpVUeoRA==
X-Received: by 2002:a17:907:868b:b0:ad2:4ed5:ca34 with SMTP id
 a640c23a62f3a-ad85b1d66b4mr233618766b.50.1748091709058; 
 Sat, 24 May 2025 06:01:49 -0700 (PDT)
Received: from localhost ([2a02:2454:a095:5600:a64e:31ff:fe38:fd6c])
 by smtp.gmail.com with ESMTPSA id
 a640c23a62f3a-ad52d278282sm1371013566b.80.2025.05.24.06.01.47
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Sat, 24 May 2025 06:01:48 -0700 (PDT)
From: Sergey Trofimov <sarg@HIDDEN>
To: 78546 <at> debbugs.gnu.org
Subject: [PATCH v2 2/5] services: networking: Add shepherd-requirement for
 dhcpcd.
Date: Sat, 24 May 2025 15:01:29 +0200
Message-ID: <b62151e3a0c19054a95b18282422591ef5f3c812.1748091536.git.sarg@HIDDEN>
X-Mailer: git-send-email 2.49.0
In-Reply-To: <99f9547c43312c49e557b5e67a356a76cc6b2ad7.1748091536.git.sarg@HIDDEN>
References: <99f9547c43312c49e557b5e67a356a76cc6b2ad7.1748091536.git.sarg@HIDDEN>
MIME-Version: 1.0
X-Debbugs-Cc: Sergey Trofimov <sarg@HIDDEN>, Ludovic Courtès <ludo@HIDDEN>, Gabriel Wicki <gabriel@HIDDEN>, Maxim Cournoyer <maxim.cournoyer@HIDDEN>
Content-Transfer-Encoding: 8bit
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 78546
Cc: Sergey Trofimov <sarg@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

* gnu/services/networking.scm (dhcpcd-configuration): Add
shepherd-requirement field.
(dhcpcd-shepherd-service): Use it.
* doc/guix.texi (Networking Setup): Regenerate dhcpcd-configuration
documentation.
(File Systems): Fix typo.

Change-Id: Id347e2bed2569237685a47be82dbf686640db25b
---
 doc/guix.texi               | 17 +++++++++++------
 gnu/services/networking.scm | 31 +++++++++++++++++++------------
 2 files changed, 30 insertions(+), 18 deletions(-)

diff --git a/doc/guix.texi b/doc/guix.texi
index e4e2b853f1..502482b754 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -18332,7 +18332,7 @@ File Systems
 might not be sufficient as @code{networking} being marked as started
 does @emph{not} imply the network has already been configured and in
 working order (for example, when using
-@code{dhcpcd-client-service-type}).  For such cases, adding a
+@code{dhcp-client-service-type}).  For such cases, adding a
 requirement on a custom @code{network-online} service may be necessary.
 A sample @code{network-online} one-shot Shepherd service implementation
 is provided below:
@@ -21980,12 +21980,13 @@ Networking Setup
 @item @code{duid} (default: @code{""}) (type: maybe-string)
 DHCPv4 clients require a unique client identifier, this option uses the
 DHCPv6 Unique Identifier as a DHCPv4 client identifier as well.  For
-more information, refer to @uref{https://www.rfc-editor.org/rfc/rfc4361, RFC 4361}
-and @code{dhcpcd.conf(5)}.
+more information, refer to
+@uref{https://www.rfc-editor.org/rfc/rfc4361,RFC 4361} and
+@code{dhcpcd.conf(5)}.
 
 @item @code{persistent?} (default: @code{#t}) (type: boolean)
-When true, automatically de-configure the interface when @command{dhcpcd}
-exits.
+When true, automatically de-configure the interface when
+@command{dhcpcd} exits.
 
 @item @code{option} (default: @code{("rapid_commit" "domain_name_servers" "domain_name" "domain_search" "host_name" "classless_static_routes" "interface_mtu")}) (type: list-of-strings)
 List of options to request from the server.
@@ -22019,9 +22020,13 @@ Networking Setup
 @item @code{extra-content} (type: maybe-string)
 Extra content to append to the configuration as-is.
 
+@item @code{shepherd-requirement} (default: @code{()}) (type: list-of-symbols)
+This is a list of symbols naming Shepherd services that this service
+will depend on.
+
 @end table
-@end deftp
 
+@end deftp
 
 @cindex NetworkManager
 
diff --git a/gnu/services/networking.scm b/gnu/services/networking.scm
index 67653e2cbf..4cb7313808 100644
--- a/gnu/services/networking.scm
+++ b/gnu/services/networking.scm
@@ -126,6 +126,7 @@ (define-module (gnu services networking)
             dhcpcd-configuration-vendor-class-id
             dhcpcd-configuration-client-id
             dhcpcd-configuration-extra-content
+            dhcpcd-configuration-shepherd-requirement
 
             ntp-configuration
             ntp-configuration?
@@ -609,6 +610,12 @@ (define-configuration dhcpcd-configuration
     maybe-string
     "Extra content to append to the configuration as-is.")
 
+  (shepherd-requirement
+   (list-of-symbols '())
+   "This is a list of symbols naming Shepherd services that this service
+will depend on."
+   empty-serializer)
+
   (prefix dhcpcd-))
 
 (define (dhcpcd-config-file config)
@@ -628,19 +635,19 @@ (define dhcpcd-account-service
           (shell (file-append shadow "/sbin/nologin")))))
 
 (define (dhcpcd-shepherd-service config)
-  (let* ((config-file (dhcpcd-config-file config))
-         (command-args (dhcpcd-configuration-command-arguments config))
-         (ifaces (dhcpcd-configuration-interfaces config)))
-    (list (shepherd-service
-            (documentation "dhcpcd daemon.")
-            (provision '(networking))
-            (requirement '(user-processes udev))
-            (actions (list (shepherd-configuration-action config-file)))
-            (start
+  (match-record config <dhcpcd-configuration>
+                (command-arguments interfaces shepherd-requirement)
+    (let ((config-file (dhcpcd-config-file config)))
+      (list (shepherd-service
+             (documentation "dhcpcd daemon.")
+             (provision '(networking))
+             (requirement `(user-processes udev ,@shepherd-requirement))
+             (actions (list (shepherd-configuration-action config-file)))
+             (start
               #~(make-forkexec-constructor
-                    (list (string-append #$dhcpcd "/sbin/dhcpcd")
-                          #$@command-args "-B" "-f" #$config-file #$@ifaces)))
-            (stop #~(make-kill-destructor))))))
+                 (list (string-append #$dhcpcd "/sbin/dhcpcd")
+                       #$@command-arguments "-B" "-f" #$config-file #$@interfaces)))
+             (stop #~(make-kill-destructor)))))))
 
 (define dhcpcd-service-type
   (service-type (name 'dhcpcd)
-- 
2.49.0





Information forwarded to sarg@HIDDEN, ludo@HIDDEN, gabriel@HIDDEN, maxim.cournoyer@HIDDEN, guix-patches@HIDDEN:
bug#78546; Package guix-patches. Full text available.

Message received at 78546 <at> debbugs.gnu.org:


Received: (at 78546) by debbugs.gnu.org; 24 May 2025 13:01:54 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat May 24 09:01:54 2025
Received: from localhost ([127.0.0.1]:58874 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1uIoVd-0004lF-QX
	for submit <at> debbugs.gnu.org; Sat, 24 May 2025 09:01:54 -0400
Received: from mail-ed1-x535.google.com ([2a00:1450:4864:20::535]:52406)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
 (Exim 4.84_2) (envelope-from <sarg@HIDDEN>) id 1uIoVZ-0004kq-UO
 for 78546 <at> debbugs.gnu.org; Sat, 24 May 2025 09:01:51 -0400
Received: by mail-ed1-x535.google.com with SMTP id
 4fb4d7f45d1cf-601aa0cb92eso915769a12.0
 for <78546 <at> debbugs.gnu.org>; Sat, 24 May 2025 06:01:49 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=sarg.org.ru; s=google; t=1748091703; x=1748696503; darn=debbugs.gnu.org;
 h=content-transfer-encoding:mime-version:message-id:date:subject:cc
 :to:from:from:to:cc:subject:date:message-id:reply-to;
 bh=/FUhEb1HZezF8hBwg+pRqSL0E8XViIkse9u+LWbvHJI=;
 b=j3YZ5FXLqaLBG/0ZM7bEG60jA6m/cnra1Nf/GODDzfHx5Pg6Wwx4uNH2DD+ndnuEyK
 yGvzI7204DXeP23WFxqxrHQ762VKwI6XaRuKQfjlrOMMGSC5faiKUYMTDMtSHHULip53
 8LvFc4quzXrHokaRhskS+F81dMn4L5yjU72nxreHsvBeigNY5aL5QcqL7TllJvYCXApL
 +ynZ8OdMRoVrrnVfo4Ra8S2KOeCa67HQ+UsldNm9g8e0ASwdDzMqYsRhqTCCOgQ0sSkw
 PfRUux92S1zda0N7p+HiRe/QZPUMzqMel7c5rHx0uLOiKtVAcZ8jFjiBuubsPFaRoQwY
 r+bg==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20230601; t=1748091703; x=1748696503;
 h=content-transfer-encoding:mime-version:message-id:date:subject:cc
 :to:from:x-gm-message-state:from:to:cc:subject:date:message-id
 :reply-to;
 bh=/FUhEb1HZezF8hBwg+pRqSL0E8XViIkse9u+LWbvHJI=;
 b=mPjELkz6EDLrHXAV0i2AExLHQ1ZfKOSBfIduJEnoLd3uSUOsJmxupo4ou4IL64UCu/
 RrM72qe4A4ZVyM3Tdm7jKgg7VL/SUA4JOIeCElFSRHKCUpa5/kLf6d1/I8hBMsO9QWD+
 wb6l1LUGMOQp9gOLKPFBg7mR7qQRooqkZDUBdjeeCwNF3EVcCti4BfgEsc9u1HhNz1rm
 qMtTsL/H2VCjxHJ0ipIxj5yHgo3wXelVkGeL8xB2mOU+KiVYFVYDz6fIIs9HQKJSyUQK
 1L7rGHSKLAFclwqEoOmsv94jfVpgUeEXKTojaarm3IHyJ0AxbGGrFBDZju8YImGecqyJ
 0Iqg==
X-Gm-Message-State: AOJu0YwB1HzpR274VJl/SXILXBNEEcJaZoHU8CRI/P3/H0YBHti8F88C
 Bn7JqqgrFjm+WbmJd4R1EF+FHRO3V4Qeq1x/ih6urSOGOFKmvUoFEfI7GNrNYsWz3e/9ZkGNZpr
 IsIEX7fIy9A==
X-Gm-Gg: ASbGncv7P4YHfzs3sN07aED7cK6zdxsdbzWB8LrrWJLMhEJZAl/ye8mut8ae4QxstYF
 2hh115fJwa7jPR+3/PDZU7yoTvxZ8c9M8QWp4mH3CXqlh67tLJr9OL0cuhL+pvHKZ0rYlB1D3tm
 vsdchnIq54Jw9UQUbJ1cTzTcocWDqhqHB0nqYiYCNu3TiN2UMHVhRppi/h0VPDwl5cf+aROdELM
 E5+Ti0VPTuxd7frq8k6SToyx/FRYfpw7wUVmT5hkYXpW83yo/2O32vP48aKe8XnEpXStAbcwVpx
 SmNMippgVv7OE0aEQW1eDXRSMz7kAnEVVst/djwXZ+Lza4Z+
X-Google-Smtp-Source: AGHT+IEqHasP+bsU0q2v+6SPaWI/eHDspMXz9eaZsQoekipwZHZKokxEl5oqQgW1lzCYiqYNCDfIUA==
X-Received: by 2002:a17:906:7945:b0:ad5:430b:9013 with SMTP id
 a640c23a62f3a-ad85b2d6f1fmr240865466b.42.1748091702769; 
 Sat, 24 May 2025 06:01:42 -0700 (PDT)
Received: from localhost ([2a02:2454:a095:5600:a64e:31ff:fe38:fd6c])
 by smtp.gmail.com with ESMTPSA id
 a640c23a62f3a-ad52d4383f8sm1383860166b.113.2025.05.24.06.01.42
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Sat, 24 May 2025 06:01:42 -0700 (PDT)
From: Sergey Trofimov <sarg@HIDDEN>
To: 78546 <at> debbugs.gnu.org
Subject: [PATCH v2 1/5] services: configuration: Add
 define-enumerated-field-type helper.
Date: Sat, 24 May 2025 15:01:28 +0200
Message-ID: <99f9547c43312c49e557b5e67a356a76cc6b2ad7.1748091536.git.sarg@HIDDEN>
X-Mailer: git-send-email 2.49.0
MIME-Version: 1.0
X-Debbugs-Cc: Sergey Trofimov <sarg@HIDDEN>, Ludovic Courtès <ludo@HIDDEN>
Content-Transfer-Encoding: 8bit
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 78546
Cc: Sergey Trofimov <sarg@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

* gnu/services/cups.scm (define-enumerated-field-type): Move...
* gnu/services/configuration.scm (define-enumerated-field-type): ...here.
* gnu/services/vpn.scm (define-enumerated-field-type): Remove.
* gnu/services/power.scm
(define-enum): Replace with define-enumerated-field-type.

Change-Id: I89ec40f479e3f800268e714f1f88d638be017c7e
---
 gnu/services/configuration.scm | 14 +++++++++++
 gnu/services/cups.scm          | 12 ---------
 gnu/services/power.scm         | 45 +++++++++++-----------------------
 gnu/services/vpn.scm           | 12 ---------
 4 files changed, 28 insertions(+), 55 deletions(-)

diff --git a/gnu/services/configuration.scm b/gnu/services/configuration.scm
index 15eddd7665..6d9fd1feae 100644
--- a/gnu/services/configuration.scm
+++ b/gnu/services/configuration.scm
@@ -75,6 +75,7 @@ (define-module (gnu services configuration)
             configuration->documentation
             empty-serializer
             serialize-package
+            define-enumerated-field-type
 
             filter-configuration-fields
 
@@ -508,6 +509,19 @@ (define* (interpose ls  #:optional (delimiter "\n") (grammar 'infix))
                           (cons delimiter acc))))
               '() ls))
 
+(define-syntax define-enumerated-field-type
+  (lambda (x)
+    (syntax-case x (prefix)
+      ((_ name (option ...) (prefix serializer-prefix))
+       #`(begin
+           (define (#,(id #'name #'name #'?) x)
+             (memq x '(option ...)))
+           (define (#,(id #'name #'serializer-prefix #'serialize- #'name) field-name val)
+             (#,(id #'name #'serializer-prefix #'serialize-field) field-name val))))
+
+      ((_ name (option ...))
+       #`(define-enumerated-field-type name (option ...) (prefix #{}#))))))
+
 
 ;;;
 ;;; Commonly used predicates
diff --git a/gnu/services/cups.scm b/gnu/services/cups.scm
index 738bb7f5cc..27aac7a16a 100644
--- a/gnu/services/cups.scm
+++ b/gnu/services/cups.scm
@@ -137,18 +137,6 @@ (define (non-negative-integer? val)
 (define (serialize-non-negative-integer field-name val)
   (serialize-field field-name val))
 
-(define-syntax define-enumerated-field-type
-  (lambda (x)
-    (define (id-append ctx . parts)
-      (datum->syntax ctx (apply symbol-append (map syntax->datum parts))))
-    (syntax-case x ()
-      ((_ name (option ...))
-       #`(begin
-           (define (#,(id-append #'name #'name #'?) x)
-             (memq x '(option ...)))
-           (define (#,(id-append #'name #'serialize- #'name) field-name val)
-             (serialize-field field-name val)))))))
-
 (define-enumerated-field-type access-log-level
   (config actions all))
 (define-enumerated-field-type browse-local-protocols
diff --git a/gnu/services/power.scm b/gnu/services/power.scm
index ec8ae555d4..ad386549cd 100644
--- a/gnu/services/power.scm
+++ b/gnu/services/power.scm
@@ -204,23 +204,6 @@ (define-configuration/no-serialization apcupsd-event-handlers
     #~(#t))
    "The handler for the battattach event."))
 
-(define-syntax define-enum
-  (lambda (x)
-    (syntax-case x ()
-      ((_ name values)
-       (let* ((datum/name (syntax->datum #'name))
-              (datum/predicate (string->symbol
-                                (format #f "enum-~a?" datum/name)))
-              (datum/serialize (string->symbol
-                                (format #f "serialize-enum-~a" datum/name))))
-         (with-syntax
-             ((predicate (datum->syntax x datum/predicate))
-              (serialize (datum->syntax x datum/serialize)))
-           #'(begin
-               (define (predicate value)
-                 (memq value values))
-               (define serialize serialize-symbol))))))))
-
 (define mangle-field-name
   (match-lambda
     ('name                            "UPSNAME")
@@ -252,25 +235,25 @@ (define mangle-field-name
     ('data-time                       "DATATIME")
     ('facility                        "FACILITY")))
 
-(define (serialize-string field-name value)
+(define (serialize-field field-name value)
   #~(format #f "~a ~a\n" #$(mangle-field-name field-name) '#$value))
-(define serialize-symbol serialize-string)
-(define serialize-integer serialize-string)
+(define serialize-string serialize-field)
+(define serialize-symbol serialize-field)
+(define serialize-integer serialize-field)
 (define (serialize-boolean field-name value)
-  #~(format #f "~a ~a\n"
-            #$(mangle-field-name field-name)
-            #$(if value "on" "off")))
+  (serialize-field field-name (if value "on" "off")))
 
 (define-maybe string)
 
-(define-enum cable '( simple smart ether usb
-                      940-0119A 940-0127A 940-0128A 940-0020B 940-0020C
-                      940-0023A 940-0024B 940-0024C 940-1524C 940-0024G
-                      940-0095A 940-0095B 940-0095C 940-0625A MAM-04-02-2000))
-(define-enum type '(apcsmart usb net snmp netsnmp dumb pcnet modbus test))
-(define-enum no-logon '(disable timeout percent minutes always))
-(define-enum class '(standalone shareslave sharemaster))
-(define-enum mode '(disable share))
+(define-enumerated-field-type enum-cable
+   ( simple smart ether usb
+     940-0119A 940-0127A 940-0128A 940-0020B 940-0020C
+     940-0023A 940-0024B 940-0024C 940-1524C 940-0024G
+     940-0095A 940-0095B 940-0095C 940-0625A MAM-04-02-2000))
+(define-enumerated-field-type enum-type (apcsmart usb net snmp netsnmp dumb pcnet modbus test))
+(define-enumerated-field-type enum-no-logon (disable timeout percent minutes always))
+(define-enumerated-field-type enum-class (standalone shareslave sharemaster))
+(define-enumerated-field-type enum-mode (disable share))
 
 (define-configuration apcupsd-configuration
   (apcupsd (package apcupsd) "The @code{apcupsd} package to use.")
diff --git a/gnu/services/vpn.scm b/gnu/services/vpn.scm
index f97cbac7bb..56022ac27a 100644
--- a/gnu/services/vpn.scm
+++ b/gnu/services/vpn.scm
@@ -141,18 +141,6 @@ (define (ip-mask? val)
            #f)))
 (define serialize-ip-mask serialize-string)
 
-(define-syntax define-enumerated-field-type
-  (lambda (x)
-    (define (id-append ctx . parts)
-      (datum->syntax ctx (apply symbol-append (map syntax->datum parts))))
-    (syntax-case x ()
-      ((_ name (option ...))
-       #`(begin
-           (define (#,(id-append #'name #'name #'?) x)
-             (memq x '(option ...)))
-           (define (#,(id-append #'name #'serialize- #'name) field-name val)
-             (serialize-field field-name val)))))))
-
 (define-enumerated-field-type proto
   (udp tcp udp6 tcp6))
 (define-enumerated-field-type dev

base-commit: 0c799ea004129c487a0aa8573d2e3e0839c84b2f
-- 
2.49.0





Information forwarded to sarg@HIDDEN, ludo@HIDDEN, guix-patches@HIDDEN:
bug#78546; Package guix-patches. Full text available.

Message received at 78546 <at> debbugs.gnu.org:


Received: (at 78546) by debbugs.gnu.org; 23 May 2025 12:38:41 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri May 23 08:38:41 2025
Received: from localhost ([127.0.0.1]:46674 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1uIRfc-00074o-N0
	for submit <at> debbugs.gnu.org; Fri, 23 May 2025 08:38:41 -0400
Received: from mail-ej1-x635.google.com ([2a00:1450:4864:20::635]:50410)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
 (Exim 4.84_2) (envelope-from <sarg@HIDDEN>) id 1uIRfX-00073m-A3
 for 78546 <at> debbugs.gnu.org; Fri, 23 May 2025 08:38:36 -0400
Received: by mail-ej1-x635.google.com with SMTP id
 a640c23a62f3a-ad5533c468cso993316466b.0
 for <78546 <at> debbugs.gnu.org>; Fri, 23 May 2025 05:38:35 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=sarg.org.ru; s=google; t=1748003908; x=1748608708; darn=debbugs.gnu.org;
 h=content-transfer-encoding:mime-version:message-id:date:user-agent
 :references:in-reply-to:subject:cc:to:from:from:to:cc:subject:date
 :message-id:reply-to;
 bh=xoEh+5kWr1Y6BjfD/b24z5/RU6j6IwgPBHhacmyHi88=;
 b=Tb+JyL2WOZCVHv07OXLOrslb+K4jHTvrAY7MZa2n4flJAFcobp1xS52c0xu69jG1rv
 JEVPCUn58OEQhQLYrSPwSf4q0U5pilFdLK/A+UPe/emIcf4Y0QcKETGvfO9zShiIxcEw
 BRujhpL0zgSrnDWsV+cOo5iolgraxLU7RkmZJa+mos51thbPrRUL3w2nU4sbdflwR622
 0LHnMd1geF5qX+RGTBIypwtMuXcL+9ye3mvRyGz6ceclO4RXIMBsVi9Sg+uwmX3x+Ahz
 rAMq+1QxeHga24ad+YuowZsgNeIvEpzTA2pkL3vVIFlsxxtF3bBVsZNU/jW8IZo/EByQ
 zwVw==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20230601; t=1748003908; x=1748608708;
 h=content-transfer-encoding:mime-version:message-id:date:user-agent
 :references:in-reply-to:subject:cc:to:from:x-gm-message-state:from
 :to:cc:subject:date:message-id:reply-to;
 bh=xoEh+5kWr1Y6BjfD/b24z5/RU6j6IwgPBHhacmyHi88=;
 b=V5iur54LtHcdG4nsGf1KR0jRq+6UKPXxDgfIzuEpddxGrMtC9ZNRyoD5n7grEZ/m5i
 rFmEf+JlZRo1CZjGljAmzVNrbKA4mri78YYRw4E6SXaqSswKF1dfKZDNhLZXzwMZvTbZ
 zUFv9rWebLk17hlVeQhkSST940ojLWZXRCjGLWJ8bkX2kdDraZ2kTqmceVxZ9/24wxGs
 fhX084hYxE6e+Gwla5q+mX1QenLy3qLzmfgSdEcvRopjR5hoU5B/jU5/Rd8f5eHp8SK+
 UdKcZx5E8rLiLdMrVg4Z49E7md5b4UzUDMo9vYo5E9dvN4FFvh02tMqpJ90xEU7Yl3U3
 NmKw==
X-Gm-Message-State: AOJu0Yw6qFac2Mi+bZs+cs7rvKc/gaCbtI9pLuCIUbe+Wf+OH8gYZcTH
 qpwvpdGoZD52N08YkGAZzeV0FT5gqNqFj/WXgUAIeJzOwbjHfgDHC3HXBsgZCfwfkWo=
X-Gm-Gg: ASbGncu6kTPUIsISfKWI6PFkBwj8v8xQ4hUljY2z/0403YSqB70S1M5KajZmEHSicjR
 TbbBH3JphYH0wg7/trP9u9EQVlp4k90SAumn//iGpY9hf536ZI+K8OI/TYyDu3+qS9zK2/bncZW
 qUv2oB6OWXqMPYAo4Da8bSf9GWapgjZ3IZZ/ZqATaisFIWhco3YoTudN08no5q5tue528rNv6jk
 T0jJO4Z7XnC50haRfNQzAjc6soettINbkECYedZDNA9li/E8WS9lIzo2qhut0xDF1PsRDR4G+wC
 iQh9v6t9kYOuKWS+1sJAp3h1U8qjq0RQhnceLP/0F/t4WfeRwQ==
X-Google-Smtp-Source: AGHT+IEUPIL1S3RlVZQ6DSCW/51MimMntLOPOHgYZ2isP3+LbZmOv4Jr9+U+DSEVDF8/TCrFzA+9qQ==
X-Received: by 2002:a17:907:9722:b0:ad5:8594:652e with SMTP id
 a640c23a62f3a-ad58594ea70mr1421045166b.35.1748003908476; 
 Fri, 23 May 2025 05:38:28 -0700 (PDT)
Received: from localhost ([2a02:2454:a095:5600:a64e:31ff:fe38:fd6c])
 by smtp.gmail.com with ESMTPSA id
 a640c23a62f3a-ad52d4395c3sm1221051066b.109.2025.05.23.05.38.27
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Fri, 23 May 2025 05:38:28 -0700 (PDT)
From: Sergey Trofimov <sarg@HIDDEN>
To: Ludovic =?utf-8?Q?Court=C3=A8s?= <ludo@HIDDEN>
Subject: Re: [bug#78546] [PATCH 3/3] services: networking: Add
 iwd-service-type.
In-Reply-To: <87msb31xl9.fsf@HIDDEN> ("Ludovic =?utf-8?Q?Court=C3=A8s=22'?=
 =?utf-8?Q?s?= message of "Fri, 23 May 2025 11:32:34 +0200")
References: <abc454a968ed987ce41af66c632965579e856c81.1747912984.git.sarg@HIDDEN>
 <039cf3a826d3caef178bbdb63585b63513b616f3.1747912984.git.sarg@HIDDEN>
 <87msb31xl9.fsf@HIDDEN>
User-Agent: mu4e 1.12.9; emacs 30.0.92
Date: Fri, 23 May 2025 14:38:27 +0200
Message-ID: <875xhra4e4.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 78546
Cc: Gabriel Wicki <gabriel@HIDDEN>,
 Maxim Cournoyer <maxim.cournoyer@HIDDEN>, 78546 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

Hi Ludovic,

thanks for the review, I've answered a couple points below

Ludovic Courtès <ludo@HIDDEN> writes:

> Hi Sergey,
>
> Sergey Trofimov <sarg@HIDDEN> writes:
>
>> * gnu/services/networking.scm (iwd-service-type): New service type.
>> (iwd-configuration), (iwd-settings), (iwd-scan-settings),
>> (iwd-general-settings), (iwd-network-settings): New configuration types.
>> * doc/guix.texi (Networking setup): Document it.
>>
>> Change-Id: I852115b9c6768b3ec4eedb34a7f9e66438bd1429
>
> […]
>
>> +@defvar iwd-service-type
>> +This is the service type to run @acronyml{IWD,Internet Wireless Daemon},
>> +a wireless daemon required to authenticate against encrypted WiFi
>> +networks.
>
> Am I right that this conflicts with wpa-supplicant, which is what
> NetworkManager uses?  Should this be mentioned?
>

Sure, I'll also add 'wireless-daemon' to both iwd and wpa-supplicant
shepherd's provisions. This way a conflict in the config would result in
an error message.

>
>> +@deftp {Data Type} iwd-scan-settings
>> +Available @code{iwd-scan-settings} fields are:
>> +
>> +@table @asis
>> +@item @code{disable-periodic-scan} (type: maybe-boolean)
>
> As a rule of thumb, I recommend avoiding negatives for Booleans; also
> add a question mark.
>

These are the names of iwd settings, see man 5 iwd.config. I will add
question marks for booleans, but I'd rather leave the names as they're
defined by iwd authors.

>
> So this would become ‘enable-periodic-scan?’, defaulting to #t.
>
> And it can be ‘boolean’ rather than ‘maybe-boolean’ (the latter would
> default to “unset”, whose meaning isn’t clear here).
>
> Same for ‘disable-roaming-scan’.
>
>> +@item @code{initial-periodic-scan-interval} (type: maybe-number)
>> +The initial periodic scan interval upon disconnect (in seconds).
>> +
>> +@item @code{maximum-periodic-scan-interval} (type: maybe-number)
>> +The maximum periodic scan interval (in seconds).
>
> I would tend to provide a known default value and make it ‘number’
> instead of ‘maybe-number’.
>

I agree, I'll change that.




Information forwarded to guix-patches@HIDDEN:
bug#78546; Package guix-patches. Full text available.

Message received at 78546 <at> debbugs.gnu.org:


Received: (at 78546) by debbugs.gnu.org; 23 May 2025 09:35:41 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri May 23 05:35:41 2025
Received: from localhost ([127.0.0.1]:45754 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1uIOoX-0000hA-9h
	for submit <at> debbugs.gnu.org; Fri, 23 May 2025 05:35:41 -0400
Received: from eggs.gnu.org ([2001:470:142:3::10]:33644)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <ludo@HIDDEN>) id 1uIOnl-0000YM-GB
 for 78546 <at> debbugs.gnu.org; Fri, 23 May 2025 05:34:54 -0400
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 <ludo@HIDDEN>)
 id 1uIOnd-0005bD-Fe; Fri, 23 May 2025 05:34:45 -0400
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org;
 s=fencepost-gnu-org; h=MIME-Version:Date:References:In-Reply-To:Subject:To:
 From; bh=OihX0PSkKhYoTWZtLcJGVQP/tkbW9B670gKOlornuuE=; b=Dr7PrYkgIZyGoHM7Xuu6
 9HwNNK+lyT27CJifTQI0fu51sguIVqLZ6jo+nD8dOBHvc7MsKBk8NzSMUkBsIJUWs9FUNPC7j6DuA
 cxowg+InCNbHv4kWcHGZqXdAaDx2dvQQDqH5p8rPlU9yf6W21Y90XL3aBNbBQNV+PuRBXf9ei78ae
 Q5J5F+7T2cL55WHIQFa5lP5DnvWf1yhqjF00RtLptLpCJxaTw6fPANyP9TSeRYWre10W3PasJXbkH
 psQkhfOlIwbCE9gkyheGRwNMVIrvxLiBadwz8xxQ5v6BQRBUmPxt+se693kDynVdDkV+5ggFqr/wv
 odY+wwYoZZH42Q==;
From: =?utf-8?Q?Ludovic_Court=C3=A8s?= <ludo@HIDDEN>
To: Sergey Trofimov <sarg@HIDDEN>
Subject: Re: [bug#78546] [PATCH 3/3] services: networking: Add
 iwd-service-type.
In-Reply-To: <039cf3a826d3caef178bbdb63585b63513b616f3.1747912984.git.sarg@HIDDEN>
 (Sergey Trofimov's message of "Thu, 22 May 2025 13:32:57 +0200")
References: <abc454a968ed987ce41af66c632965579e856c81.1747912984.git.sarg@HIDDEN>
 <039cf3a826d3caef178bbdb63585b63513b616f3.1747912984.git.sarg@HIDDEN>
User-Agent: mu4e 1.12.9; emacs 29.4
X-URL: https://people.bordeaux.inria.fr/lcourtes/
X-PGP-Fingerprint: 3CE4 6455 8A84 FDC6 9DB4  0CFB 090B 1199 3D9A EBB5
X-OS: x86_64-pc-linux-gnu
X-Revolutionary-Date: Quartidi 4 Prairial an 233 de la =?utf-8?Q?R=C3=A9vo?=
 =?utf-8?Q?lution=2C?= jour de
 =?utf-8?Q?l'Ang=C3=A9lique?=
Date: Fri, 23 May 2025 11:32:34 +0200
Message-ID: <87msb31xl9.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 78546
Cc: Gabriel Wicki <gabriel@HIDDEN>,
 Maxim Cournoyer <maxim.cournoyer@HIDDEN>, 78546 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

Hi Sergey,

Sergey Trofimov <sarg@HIDDEN> writes:

> * gnu/services/networking.scm (iwd-service-type): New service type.
> (iwd-configuration), (iwd-settings), (iwd-scan-settings),
> (iwd-general-settings), (iwd-network-settings): New configuration types.
> * doc/guix.texi (Networking setup): Document it.
>
> Change-Id: I852115b9c6768b3ec4eedb34a7f9e66438bd1429

[=E2=80=A6]

> +@defvar iwd-service-type
> +This is the service type to run @acronyml{IWD,Internet Wireless Daemon},
> +a wireless daemon required to authenticate against encrypted WiFi
> +networks.

Am I right that this conflicts with wpa-supplicant, which is what
NetworkManager uses?  Should this be mentioned?

> +@deftp {Data Type} iwd-scan-settings
> +Available @code{iwd-scan-settings} fields are:
> +
> +@table @asis
> +@item @code{disable-periodic-scan} (type: maybe-boolean)

As a rule of thumb, I recommend avoiding negatives for Booleans; also
add a question mark.

So this would become =E2=80=98enable-periodic-scan?=E2=80=99, defaulting to=
 #t.

And it can be =E2=80=98boolean=E2=80=99 rather than =E2=80=98maybe-boolean=
=E2=80=99 (the latter would
default to =E2=80=9Cunset=E2=80=9D, whose meaning isn=E2=80=99t clear here).

Same for =E2=80=98disable-roaming-scan=E2=80=99.

> +@item @code{initial-periodic-scan-interval} (type: maybe-number)
> +The initial periodic scan interval upon disconnect (in seconds).
> +
> +@item @code{maximum-periodic-scan-interval} (type: maybe-number)
> +The maximum periodic scan interval (in seconds).

I would tend to provide a known default value and make it =E2=80=98number=
=E2=80=99
instead of =E2=80=98maybe-number=E2=80=99.

The rest LGTM.

Thanks,
Ludo=E2=80=99.




Information forwarded to guix-patches@HIDDEN:
bug#78546; Package guix-patches. Full text available.

Message received at 78546 <at> debbugs.gnu.org:


Received: (at 78546) by debbugs.gnu.org; 23 May 2025 09:35:41 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri May 23 05:35:41 2025
Received: from localhost ([127.0.0.1]:45752 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1uIOoW-0000h2-LS
	for submit <at> debbugs.gnu.org; Fri, 23 May 2025 05:35:41 -0400
Received: from eggs.gnu.org ([2001:470:142:3::10]:33648)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <ludo@HIDDEN>) id 1uIOnl-0000YN-Qh
 for 78546 <at> debbugs.gnu.org; Fri, 23 May 2025 05:34:54 -0400
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 <ludo@HIDDEN>)
 id 1uIOng-0005bt-2n; Fri, 23 May 2025 05:34:48 -0400
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org;
 s=fencepost-gnu-org; h=MIME-Version:Date:References:In-Reply-To:Subject:To:
 From; bh=bLnIsLZvqKRFMQU5d0F+D1vACBCz3savf1SVybZBBVQ=; b=GHVppqylWvO6FfHfjiJJ
 CbHjXHrgsed/OFnLcRiuOakBkyjZCCH5Ay7isBu4QGUTXsvVa9J54WX3PkE854C1TwDEURIcb0r+/
 YJdLQtg3wtTlPWjX+nzCbdgpcP0OM04SRfDSQIhZQ+3qMpVN36tljdeYOzbqiRPWfIEr9vbag0BNZ
 lzNe32IfIgDX99TvEl17F3Jv6oAABe9curnhXR7XfSoweJgjCHz6n1dPHKaM4zt4hEy6YmAes/1dk
 4lMHppx4DksMh2hVWbkzBsgTEDom2AmHpRIkLnrRbc3VeYCyjkIXzc2x5XqisNje9wmaX1d6b1vws
 0eQ8is6aGb1YyQ==;
From: =?utf-8?Q?Ludovic_Court=C3=A8s?= <ludo@HIDDEN>
To: Sergey Trofimov <sarg@HIDDEN>
Subject: Re: [bug#78546] [PATCH 2/3] services: networking: Add
 shepherd-requirement for dhcpcd.
In-Reply-To: <2a43bbb6ead770a9302fe5d7d979dda6e87dcc64.1747912984.git.sarg@HIDDEN>
 (Sergey Trofimov's message of "Thu, 22 May 2025 13:32:56 +0200")
References: <abc454a968ed987ce41af66c632965579e856c81.1747912984.git.sarg@HIDDEN>
 <2a43bbb6ead770a9302fe5d7d979dda6e87dcc64.1747912984.git.sarg@HIDDEN>
User-Agent: mu4e 1.12.9; emacs 29.4
X-URL: https://people.bordeaux.inria.fr/lcourtes/
X-PGP-Fingerprint: 3CE4 6455 8A84 FDC6 9DB4  0CFB 090B 1199 3D9A EBB5
X-OS: x86_64-pc-linux-gnu
X-Revolutionary-Date: Quartidi 4 Prairial an 233 de la =?utf-8?Q?R=C3=A9vo?=
 =?utf-8?Q?lution=2C?= jour de
 =?utf-8?Q?l'Ang=C3=A9lique?=
Date: Fri, 23 May 2025 11:33:25 +0200
Message-ID: <87h61b1xju.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 78546
Cc: Gabriel Wicki <gabriel@HIDDEN>,
 Maxim Cournoyer <maxim.cournoyer@HIDDEN>, 78546 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

Sergey Trofimov <sarg@HIDDEN> writes:

> * gnu/services/networking.scm (dhcpcd-configuration): Add
> shepherd-requirement field.
> (dhcpcd-shepherd-service): Use it.
> * doc/guix.texi (Networking Setup): Regenerate dhcpcd-configuration
> documentation.
> (File Systems): Fix typo.
>
> Change-Id: Id347e2bed2569237685a47be82dbf686640db25b

LGTM.




Information forwarded to guix-patches@HIDDEN:
bug#78546; Package guix-patches. Full text available.

Message received at 78546 <at> debbugs.gnu.org:


Received: (at 78546) by debbugs.gnu.org; 23 May 2025 09:05:04 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri May 23 05:05:04 2025
Received: from localhost ([127.0.0.1]:45526 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1uIOKs-0006iy-QR
	for submit <at> debbugs.gnu.org; Fri, 23 May 2025 05:05:04 -0400
Received: from mail-ed1-x52b.google.com ([2a00:1450:4864:20::52b]:47517)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
 (Exim 4.84_2) (envelope-from <sarg@HIDDEN>) id 1uIOKj-0006hP-87
 for 78546 <at> debbugs.gnu.org; Fri, 23 May 2025 05:04:55 -0400
Received: by mail-ed1-x52b.google.com with SMTP id
 4fb4d7f45d1cf-5fff52493e0so10631420a12.3
 for <78546 <at> debbugs.gnu.org>; Fri, 23 May 2025 02:04:53 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=sarg.org.ru; s=google; t=1747991087; x=1748595887; darn=debbugs.gnu.org;
 h=content-transfer-encoding:mime-version:references:in-reply-to
 :message-id:date:subject:cc:to:from:from:to:cc:subject:date
 :message-id:reply-to;
 bh=VsLEuU+wl0gD/5DF4++hXvms4px+AwasLFn9bwHggU8=;
 b=vqgM39bwfU0wkNEVRipRbZRZ7HhNrD01Q9bmV31Dhtxll9giMtj4Na5sVCaabehaeu
 Vc/dSkvKeFFZkQs8oapHRJsi05iDkUQ/tHpdm6kvZ3x8jtVl9MloeVEY9D7V2bFe8h0Q
 4suYy29wB0Kt4NOopCUrHtSgIwYMmdB5SB+Smwm1W7DM9FYBEtcsp1iBVIwHW8DeWadG
 xfmfMM+A1LvaJtHypvYZ+qtl+DLzZQFZG+cbQFuvRmLroCk4TAC8Guz3QLuN6VJ2Dr7d
 LPQenNbQ8NuAg4LgIGaXkDsl17UaI4L4q8/FL7WAjdaChZFwk10w1ZKy6gHYqnDMqihm
 hv1g==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20230601; t=1747991087; x=1748595887;
 h=content-transfer-encoding:mime-version:references:in-reply-to
 :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc
 :subject:date:message-id:reply-to;
 bh=VsLEuU+wl0gD/5DF4++hXvms4px+AwasLFn9bwHggU8=;
 b=Jek5aDJg4TMlc9MRB4lga44WlscXS2a+Z7fYuhYvvvdGlNJ1HGjpaTQ1Ipf6N1nA11
 HbuRA1uTbOgEfPF6VPOsfJGaWeXPv8dXdjMQ1IUn8jSJVE/8jAt4m7fqHCMd3S9AWMsx
 M6+LY0LuHj+gya8z5zBp2M/AW0M0oIJY9z+qSrFPFk1PKtCom/ekUPQ8FXPqL7FjfUgh
 oDlsVtAxXR5AlhQ8MBMO4tACs4AjpCsNob17Wo6jKY7wcFv5NezN/5vOd383bNDf5IYO
 yJIy8BwCc3zPhhp0Fmx/Yp5INtUiGrYsUyixvvgUVAHODPphPZqscId2V0rUhElq7wtD
 8Ejg==
X-Gm-Message-State: AOJu0Yw0X9U4NqDgN2ZIn95rjKCLU3d2q1BN6LmECSjAcnzM/I061OFY
 iKb/7yzzz1tFPdTvbrmw9HDczfeNlAnMBOxZhlbHmi/HGDq4HVfFW52lLudcNObrlULAwhJywP7
 EGGlOsg8=
X-Gm-Gg: ASbGncsAdnKx2I+e7qrSSJL2fo3Vsb4Ljz0o+qA6Pwwqfc9ZlxYVvTrE97uWri1GspC
 7cxZnN5vHaC1Bmu/VWGcVkl3ccb4gGfGiLFh/yLSs7dNbYgmmXQeEW4Dalv3UvpSDFeHeQrgjPe
 SuJlCAGxrphXZ5BWk+6GF+Eprru8OfWRFpiIL3f1zvFzVBAmNQH25TPnja4PKEEHvolCecgbWVB
 RryIlPApgyxlrwusnudXruPz8ACKc9IcXvVAbS5E2/ayIKsSVIWp6Alskoo0Oy0Qi2Yv0oo2Ra2
 GiGc4W/AqKBEbS3wfwx6OvuoRLzONwE+5tZxoNVdQ2WBuKY8EQ==
X-Google-Smtp-Source: AGHT+IF+HVLS5w3LNIXYHWdwKOgiL8VsAosroG2psWGCEcynfDl01NsDPa7MNtMywtI3A0p1lMqG0w==
X-Received: by 2002:a17:906:8d7:b0:ad5:372d:87e3 with SMTP id
 a640c23a62f3a-ad5372dbbb2mr1995084966b.27.1747991086177; 
 Fri, 23 May 2025 02:04:46 -0700 (PDT)
Received: from localhost ([2a02:2454:a095:5600:a64e:31ff:fe38:fd6c])
 by smtp.gmail.com with ESMTPSA id
 a640c23a62f3a-ad52d047cf1sm1212140366b.16.2025.05.23.02.04.45
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Fri, 23 May 2025 02:04:45 -0700 (PDT)
From: Sergey Trofimov <sarg@HIDDEN>
To: 78546 <at> debbugs.gnu.org
Subject: [PATCH 3/3] services: networking: Add iwd-service-type.
Date: Fri, 23 May 2025 11:04:34 +0200
Message-ID: <8617d132a80c6570e1c1a0ebe8d02b0baacfc9ef.1747990996.git.sarg@HIDDEN>
X-Mailer: git-send-email 2.49.0
In-Reply-To: <fbf5fe9494765f5f2ccf3ec71beb566fb7faaa04.1747990996.git.sarg@HIDDEN>
References: <fbf5fe9494765f5f2ccf3ec71beb566fb7faaa04.1747990996.git.sarg@HIDDEN>
MIME-Version: 1.0
X-Debbugs-Cc: Sergey Trofimov <sarg@HIDDEN>, Gabriel Wicki <gabriel@HIDDEN>, Ludovic Courtès <ludo@HIDDEN>, Maxim Cournoyer <maxim.cournoyer@HIDDEN>
Content-Transfer-Encoding: 8bit
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 78546
Cc: Sergey Trofimov <sarg@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

* gnu/services/networking.scm (iwd-service-type): New service type.
(iwd-configuration), (iwd-settings), (iwd-scan-settings),
(iwd-general-settings), (iwd-network-settings): New configuration types.
* doc/guix.texi (Networking setup): Document it.

Change-Id: I852115b9c6768b3ec4eedb34a7f9e66438bd1429
---
 doc/guix.texi               | 157 ++++++++++++++++++++++++
 gnu/services/networking.scm | 236 ++++++++++++++++++++++++++++++++++++
 2 files changed, 393 insertions(+)

diff --git a/doc/guix.texi b/doc/guix.texi
index 3ef2e50e57..5c07b35ccb 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -22404,6 +22404,163 @@ Networking Setup
 @end table
 @end deftp
 
+@cindex IWD
+@defvar iwd-service-type
+This is the service type to run @acronyml{IWD,Internet Wireless Daemon},
+a wireless daemon required to authenticate against encrypted WiFi
+networks.
+@end defvar
+
+@quotation Warning
+By default @code{iwd} removes and re-creates interfaces it manages.  It
+doesn't play nicely with @code{dhcp-client-service-type} that enumerates
+wireless interfaces before starting the Shepherd service.  Use either
+@code{dhcpcd-service-type} or the @code{iwd}'s built-in DHCP client (see
+@code{enable-network-configuration} option below).
+@end quotation
+
+@c %start of fragment
+
+@deftp {Data Type} iwd-configuration
+Available @code{iwd-configuration} fields are:
+
+@table @asis
+@item @code{iwd} (default: @code{iwd}) (type: file-like)
+The IWD package to use.
+
+@item @code{interfaces} (default: @code{()}) (type: list-of-strings)
+If this is set, it must specify @dfn{glob patterns} matching network
+interfaces that IWD will control.
+
+@item @code{ignored-interfaces} (default: @code{()}) (type: list-of-strings)
+If this is set, it must specify @dfn{glob patterns} matching network
+interfaces that IWD will not manage.
+
+@item @code{phys} (default: @code{()}) (type: list-of-strings)
+If this is set, it must specify @dfn{glob patterns} matching network
+PHYs names that IWD will control.
+
+@item @code{ignored-phys} (default: @code{()}) (type: list-of-strings)
+If this is set, it must specify @dfn{glob patterns} matching network
+PHYs names that IWD will not manage.
+
+@item @code{shepherd-requirement} (default: @code{()}) (type: list-of-symbols)
+Shepherd requirements the service should depend on.
+
+@item @code{shepherd-provision} (default: @code{(iwd)}) (type: list-of-symbols)
+The name(s) of the service.
+
+@item @code{config} (type: iwd-settings)
+Configuration settings.
+
+@end table
+
+@end deftp
+
+
+@c %end of fragment
+
+@c %start of fragment
+
+@deftp {Data Type} iwd-settings
+Available @code{iwd-settings} fields are:
+
+@table @asis
+@item @code{general} (type: iwd-general-settings)
+General settings.
+
+@item @code{network} (type: maybe-iwd-network-settings)
+Network settings.
+
+@item @code{scan} (type: maybe-iwd-scan-settings)
+Scan settings.
+
+@item @code{extra-config} (default: @code{()}) (type: list-of-strings)
+Extra configuration values to append to the IWD configuration file.
+
+@end table
+
+@end deftp
+
+
+@c %end of fragment
+
+@c %start of fragment
+
+@deftp {Data Type} iwd-general-settings
+Available @code{iwd-general-settings} fields are:
+
+@table @asis
+@item @code{enable-network-configuration} (default: @code{#f}) (type: boolean)
+Setting this option to true enables @code{iwd} to configure the network
+interfaces with the IP addresses.
+
+@item @code{extra-options} (default: @code{()}) (type: alist)
+An association list of option symbols/strings to string values to be
+appended to the General settings group.
+
+@end table
+
+@end deftp
+
+
+@c %end of fragment
+
+@c %start of fragment
+
+@deftp {Data Type} iwd-network-settings
+Available @code{iwd-network-settings} fields are:
+
+@table @asis
+@item @code{enable-ipv6} (default: @code{#t}) (type: boolean)
+Sets the global default that tells @code{iwd} whether it should
+configure IPv6 addresses and routes
+
+@item @code{name-resolving-service} (default: @code{none}) (type: resolving-service)
+Configures a DNS resolution method used by the system.
+
+@item @code{extra-options} (default: @code{()}) (type: alist)
+An association list of option symbols/strings to string values to be
+appended to the Network settings group.
+
+@end table
+
+@end deftp
+
+
+@c %end of fragment
+
+@c %start of fragment
+
+@deftp {Data Type} iwd-scan-settings
+Available @code{iwd-scan-settings} fields are:
+
+@table @asis
+@item @code{disable-periodic-scan} (type: maybe-boolean)
+Setting this option to @code{#t} will prevent @code{iwd} from issuing
+the periodic scans for the available networks while disconnected.
+
+@item @code{initial-periodic-scan-interval} (type: maybe-number)
+The initial periodic scan interval upon disconnect (in seconds).
+
+@item @code{maximum-periodic-scan-interval} (type: maybe-number)
+The maximum periodic scan interval (in seconds).
+
+@item @code{disable-roaming-scan} (type: maybe-boolean)
+Setting this option to @code{#t} will prevent @code{iwd} from trying to
+scan when roaming decisions are activated.
+
+@item @code{extra-options} (default: @code{()}) (type: alist)
+An association list of option symbols/strings to string values to be
+appended to the Scan settings group.
+
+@end table
+
+@end deftp
+
+
+@c %end of fragment
+
 @cindex ModemManager
 Some networking devices such as modems require special care, and this is
 what the services below focus on.
diff --git a/gnu/services/networking.scm b/gnu/services/networking.scm
index 4cb7313808..86a6859a66 100644
--- a/gnu/services/networking.scm
+++ b/gnu/services/networking.scm
@@ -41,6 +41,7 @@
 ;;; along with GNU Guix.  If not, see <http://www.gnu.org/licenses/>.
 
 (define-module (gnu services networking)
+  #:use-module (gnu home services utils)
   #:use-module (gnu services)
   #:use-module (gnu services base)
   #:use-module (gnu services configuration)
@@ -80,6 +81,7 @@ (define-module (gnu services networking)
   #:use-module (srfi srfi-9)
   #:use-module (srfi srfi-26)
   #:use-module (srfi srfi-43)
+  #:use-module ((ice-9 curried-definitions) #:select (define))
   #:use-module (ice-9 match)
   #:use-module (ice-9 string-fun)
   #:use-module (json)
@@ -233,6 +235,21 @@ (define-module (gnu services networking)
             wpa-supplicant-configuration-extra-options
             wpa-supplicant-service-type
 
+            iwd-configuration
+            iwd-configuration-config
+            iwd-configuration-ignored-interfaces
+            iwd-configuration-ignored-phys
+            iwd-configuration-interfaces
+            iwd-configuration-iwd
+            iwd-configuration-phys
+            iwd-configuration-shepherd-provision
+            iwd-configuration-shepherd-requirement
+            iwd-service-type
+            iwd-general-settings
+            iwd-network-settings
+            iwd-scan-settings
+            iwd-settings
+
             hostapd-configuration
             hostapd-configuration?
             hostapd-configuration-package
@@ -2083,6 +2100,225 @@ (define wpa-supplicant-service-type
 implements authentication, key negotiation and more for wireless networks.")
                   (default-value (wpa-supplicant-configuration)))))
 
+
+;;;
+;;; IWD
+;;;
+(define (iwd-uglify-field-name name)
+  (object->camel-case-string name 'upper))
+
+(define (iwd-serialize-base field-name val)
+  (format #f "~a=~a\n" field-name val))
+
+(define (iwd-serialize-field field-name val)
+  (iwd-serialize-base (iwd-uglify-field-name field-name) val))
+
+(define iwd-serialize-number iwd-serialize-field)
+
+(define (iwd-serialize-boolean field-name value)
+  (iwd-serialize-field field-name (if value "true" "false")))
+
+(define (iwd-serialize-alist field-name value)
+  (if (null? value)
+      ""
+      #~(string-append #$@(generic-serialize-alist list
+                                                   iwd-serialize-base
+                                                   value))))
+
+(define-maybe boolean (prefix iwd-))
+(define-maybe number (prefix iwd-))
+(define-enumerated-field-type resolving-service
+  (none systemd resolvconf)
+  (prefix iwd-))
+
+(define-configuration iwd-general-settings
+  (enable-network-configuration
+   (boolean #f)
+   "Setting this option to true enables @code{iwd} to configure the network
+interfaces with the IP addresses.")
+  (extra-options
+   (alist '())
+   "An association list of option symbols/strings to string values to be
+appended to the General settings group.")
+
+  (prefix iwd-))
+
+(define-configuration iwd-network-settings
+  (enable-ipv6
+   (boolean #t)
+   "Sets the global default that tells @code{iwd} whether it should configure
+IPv6 addresses and routes")
+
+  (name-resolving-service
+   (resolving-service 'none)
+   "Configures a DNS resolution method used by the system.")
+
+  (extra-options
+   (alist '())
+   "An association list of option symbols/strings to string values to be
+appended to the Network settings group.")
+
+  (prefix iwd-))
+
+(define-configuration iwd-scan-settings
+  (disable-periodic-scan
+   maybe-boolean
+   "Setting this option to @code{#t} will prevent @code{iwd} from issuing the
+periodic scans for the available networks while disconnected.")
+
+  (initial-periodic-scan-interval
+   maybe-number
+   "The initial periodic scan interval upon disconnect (in seconds).")
+
+  (maximum-periodic-scan-interval
+   maybe-number
+   "The maximum periodic scan interval (in seconds).")
+
+  (disable-roaming-scan
+   maybe-boolean
+   "Setting this option to @code{#t} will prevent @code{iwd} from trying to scan
+when roaming decisions are activated.")
+
+  (extra-options
+   (alist '())
+   "An association list of option symbols/strings to string values to be
+appended to the Scan settings group.")
+
+  (prefix iwd-))
+
+(define-maybe iwd-network-settings)
+(define-maybe iwd-scan-settings)
+
+(define ((iwd-serialize-config-section fields) name cfg)
+  #~(format #f "[~a]\n~a\n"
+            #$(string-upcase (object->string name) 0 1)
+            #$(serialize-configuration cfg fields)))
+
+(define serialize-iwd-network-settings
+  (iwd-serialize-config-section iwd-network-settings-fields))
+
+(define serialize-iwd-scan-settings
+  (iwd-serialize-config-section iwd-scan-settings-fields))
+
+(define serialize-iwd-general-settings
+  (iwd-serialize-config-section iwd-general-settings-fields))
+
+(define-configuration iwd-settings
+  (general
+   (iwd-general-settings (iwd-general-settings))
+   "General settings.")
+
+  (network
+   maybe-iwd-network-settings
+   "Network settings.")
+
+  (scan
+   maybe-iwd-scan-settings
+   "Scan settings.")
+
+  (extra-config
+   (list-of-strings '())
+   "Extra configuration values to append to the IWD configuration file."
+   (serializer (lambda (_ value) (string-join value "\n" 'suffix)))))
+
+(define-configuration/no-serialization iwd-configuration
+  (iwd
+   (file-like iwd)
+   "The IWD package to use.")
+
+  (interfaces
+   (list-of-strings '())
+   "If this is set, it must specify @dfn{glob patterns} matching network
+interfaces that IWD will control.")
+
+  (ignored-interfaces
+   (list-of-strings '())
+   "If this is set, it must specify @dfn{glob patterns} matching network
+interfaces that IWD will not manage.")
+
+  (phys
+   (list-of-strings '())
+   "If this is set, it must specify @dfn{glob patterns} matching network
+PHYs names that IWD will control.")
+
+  (ignored-phys
+   (list-of-strings '())
+   "If this is set, it must specify @dfn{glob patterns} matching network
+PHYs names that IWD will not manage.")
+
+  (shepherd-requirement
+   (list-of-symbols '())
+   "Shepherd requirements the service should depend on.")
+
+  (shepherd-provision
+   (list-of-symbols '(iwd))
+   "The name(s) of the service.")
+
+  (config
+   (iwd-settings (iwd-settings))
+   "Configuration settings."))
+
+(define (iwd-generate-documentation)
+  (configuration->documentation 'iwd-configuration)
+  (configuration->documentation 'iwd-settings)
+  (configuration->documentation 'iwd-general-settings)
+  (configuration->documentation 'iwd-network-settings)
+  (configuration->documentation 'iwd-scan-settings))
+
+(define (iwd-config-file config)
+  "Return an IWD configuration file."
+  (mixed-text-file "main.conf"
+                   (serialize-configuration
+                    (iwd-configuration-config config)
+                    iwd-settings-fields)))
+
+(define (iwd-shepherd-service config)
+  (match-record config <iwd-configuration>
+                (iwd interfaces ignored-interfaces
+                     phys ignored-phys
+                     shepherd-requirement shepherd-provision)
+
+    (list (shepherd-service
+           (documentation "Run Internet Wireless Daemon")
+           (provision shepherd-provision)
+           (requirement `(user-processes dbus-system loopback ,@shepherd-requirement))
+           (start #~(make-forkexec-constructor
+                     (list (string-append #$iwd "/libexec/iwd")
+                           "--logger=syslog"
+                           #$@(if (null? interfaces) '()
+                                  (list (string-append "--interfaces="
+                                                       (string-join interfaces ","))))
+                           #$@(if (null? ignored-interfaces) '()
+                                  (list (string-append "--nointerfaces="
+                                                       (string-join ignored-interfaces ","))))
+                           #$@(if (null? phys) '()
+                                  (list (string-append "--phys="
+                                                       (string-join phys ","))))
+                           #$@(if (null? ignored-phys) '()
+                                  (list (string-append "--nophys="
+                                                       (string-join ignored-phys ",")))))))
+           (stop #~(make-kill-destructor))))))
+
+(define (iwd-etc-service config)
+  `(("iwd/main.conf" ,(iwd-config-file config))))
+
+(define iwd-service-type
+  (let ((add-iwd-package (compose list iwd-configuration-iwd)))
+    (service-type (name 'iwd)
+                  (extensions
+                   (list (service-extension shepherd-root-service-type
+                                            iwd-shepherd-service)
+                         (service-extension etc-service-type
+                                            iwd-etc-service)
+                         (service-extension dbus-root-service-type
+                                            add-iwd-package)
+                         (service-extension profile-service-type
+                                            add-iwd-package)))
+                  (default-value (iwd-configuration))
+                  (description
+                   "Run @url{https://iwd.wiki.kernel.org/,Iwd},
+a network connection manager."))))
+
 
 ;;;
 ;;; Hostapd.
-- 
2.49.0





Information forwarded to sarg@HIDDEN, gabriel@HIDDEN, ludo@HIDDEN, maxim.cournoyer@HIDDEN, guix-patches@HIDDEN:
bug#78546; Package guix-patches. Full text available.

Message received at 78546 <at> debbugs.gnu.org:


Received: (at 78546) by debbugs.gnu.org; 23 May 2025 09:04:55 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri May 23 05:04:55 2025
Received: from localhost ([127.0.0.1]:45524 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1uIOKk-0006i7-Et
	for submit <at> debbugs.gnu.org; Fri, 23 May 2025 05:04:55 -0400
Received: from mail-ed1-x533.google.com ([2a00:1450:4864:20::533]:44181)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
 (Exim 4.84_2) (envelope-from <sarg@HIDDEN>) id 1uIOKg-0006hM-LZ
 for 78546 <at> debbugs.gnu.org; Fri, 23 May 2025 05:04:51 -0400
Received: by mail-ed1-x533.google.com with SMTP id
 4fb4d7f45d1cf-60119cd50b6so11893644a12.0
 for <78546 <at> debbugs.gnu.org>; Fri, 23 May 2025 02:04:50 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=sarg.org.ru; s=google; t=1747991084; x=1748595884; darn=debbugs.gnu.org;
 h=content-transfer-encoding:mime-version:references:in-reply-to
 :message-id:date:subject:cc:to:from:from:to:cc:subject:date
 :message-id:reply-to;
 bh=5Funi3tuZKoaYxgLo+kP2aQUe/2aPhnrBGoCo/as63Y=;
 b=Gmxg+QskL0aoY/UOaXXpPooEykos7OMABblH4GlUDMqFoGxwfu3y7S1j2UtYjcuE9x
 HrAO8LvXVevf6tBVnKij/ac8i6boftWwk3AzsIAmxXq7t8XazRm4sVK9mG/sIQ72LVJo
 IN+Fh6lj0Z+V6q8DD3Nq2kkpQ1ztXUiVn7cxYlr1p/zx5sbwC7mMvESbtoIYaz8PMhvd
 c8TnTsaRCqNkvlxgLnX7cCuyEJyEbyJTCVGqgFa6P3yMarsAP0Ur/qgO2uDj3/dpWEAJ
 wQ0UxCn3wZtVx5GGi4xRmFfB14qdDi6GSuRjlhdauQflq6Z7XHZiepyU8sqNbf6pyU26
 XHJA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20230601; t=1747991084; x=1748595884;
 h=content-transfer-encoding:mime-version:references:in-reply-to
 :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc
 :subject:date:message-id:reply-to;
 bh=5Funi3tuZKoaYxgLo+kP2aQUe/2aPhnrBGoCo/as63Y=;
 b=qPrIG78GPjZy9xR9BmNM3PubAQfTTE8It+iz11JbmHUPC9PueyxQvkCS/Ik4NxAE0+
 cd8lFwounH04qNFrKMdnoyfZ/1W4FieaGvvXVgzxfsxy9FBGNKzeNcZ8ObTEZLoAeuBD
 2iMKIW/NPOEY+nSjnMrpLAiQAAX92pW1anZdmLEE+tbJzVvJWqLxFA68kdO1CW4FQq86
 2vmvRgIOntCXEjiNVi470daFmrYpEvIpXG4hh1JCnc7CRs0ahdjF6G4VdEQ+gH6eTqbg
 YimGHTWjbof4Z7VvnOKSMmT3jTbTnIz9Rva1Nu23ZT/Haq0z3jR+v0JiL3MO91u/ysYS
 lIRQ==
X-Gm-Message-State: AOJu0YwoBedrySTNiU43zQExfVyPM+I1BHNnOj3su5hrLH5HohfDhSaZ
 xWmxlOnIXFp+njWUmpyiYb0IajpMxVIeIuFjDmI2VtGUFMkPSKDhfWdm27m086t48M2tugj7eHg
 pAirDdk0=
X-Gm-Gg: ASbGncuF3N5rhFeh381AIJdtvtz6MFBH1ds3317mAIGG8g3MxIXHssJXvNgATRod4Ad
 nnRJ4F7Gkv+aggZIhzxD+96/DhmI/Ixv0P5tZuPCQn08ctdP4LmQrX3Dmb07wLlGz/0JgBZxIC5
 T8hmjcfYznmm3PKhH8sBE8spPeWENFYO5O25ykqjPg0HFLV96A3dmg/yOZGm0N+NqVM0ewCHBvm
 xklwPsz/YJLegFyJ2NX3K6zxRhtjSyI32aPdDJwXahxNm3LD6IrqN2eszMVDQWNULZFKyPbgxGQ
 QRYANtOZKddaCWRqcu6eHstMNMvWVK37Ms/8sDZPawo/hD/vAQ==
X-Google-Smtp-Source: AGHT+IHjUzzKqoWpGztqbQDamXSPdC+RWUuyfv6UkJcZEXCcs+kDJDrIVwneHtE2kZiqYdTHxuNkGA==
X-Received: by 2002:a05:6402:2108:b0:5fa:b131:f009 with SMTP id
 4fb4d7f45d1cf-6007e825a98mr24623684a12.0.1747991084036; 
 Fri, 23 May 2025 02:04:44 -0700 (PDT)
Received: from localhost ([2a02:2454:a095:5600:a64e:31ff:fe38:fd6c])
 by smtp.gmail.com with ESMTPSA id
 4fb4d7f45d1cf-6005ae3b824sm11675844a12.79.2025.05.23.02.04.43
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Fri, 23 May 2025 02:04:43 -0700 (PDT)
From: Sergey Trofimov <sarg@HIDDEN>
To: 78546 <at> debbugs.gnu.org
Subject: [PATCH 2/3] services: networking: Add shepherd-requirement for dhcpcd.
Date: Fri, 23 May 2025 11:04:33 +0200
Message-ID: <d9c075b4a418f59fb16814441206020741909246.1747990996.git.sarg@HIDDEN>
X-Mailer: git-send-email 2.49.0
In-Reply-To: <fbf5fe9494765f5f2ccf3ec71beb566fb7faaa04.1747990996.git.sarg@HIDDEN>
References: <fbf5fe9494765f5f2ccf3ec71beb566fb7faaa04.1747990996.git.sarg@HIDDEN>
MIME-Version: 1.0
X-Debbugs-Cc: Sergey Trofimov <sarg@HIDDEN>, Gabriel Wicki <gabriel@HIDDEN>, Ludovic Courtès <ludo@HIDDEN>, Maxim Cournoyer <maxim.cournoyer@HIDDEN>
Content-Transfer-Encoding: 8bit
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 78546
Cc: Sergey Trofimov <sarg@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

* gnu/services/networking.scm (dhcpcd-configuration): Add
shepherd-requirement field.
(dhcpcd-shepherd-service): Use it.
* doc/guix.texi (Networking Setup): Regenerate dhcpcd-configuration
documentation.
(File Systems): Fix typo.

Change-Id: Id347e2bed2569237685a47be82dbf686640db25b
---
 doc/guix.texi               | 17 +++++++++++------
 gnu/services/networking.scm | 31 +++++++++++++++++++------------
 2 files changed, 30 insertions(+), 18 deletions(-)

diff --git a/doc/guix.texi b/doc/guix.texi
index 02f472246a..3ef2e50e57 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -18332,7 +18332,7 @@ File Systems
 might not be sufficient as @code{networking} being marked as started
 does @emph{not} imply the network has already been configured and in
 working order (for example, when using
-@code{dhcpcd-client-service-type}).  For such cases, adding a
+@code{dhcp-client-service-type}).  For such cases, adding a
 requirement on a custom @code{network-online} service may be necessary.
 A sample @code{network-online} one-shot Shepherd service implementation
 is provided below:
@@ -21980,12 +21980,13 @@ Networking Setup
 @item @code{duid} (default: @code{""}) (type: maybe-string)
 DHCPv4 clients require a unique client identifier, this option uses the
 DHCPv6 Unique Identifier as a DHCPv4 client identifier as well.  For
-more information, refer to @uref{https://www.rfc-editor.org/rfc/rfc4361, RFC 4361}
-and @code{dhcpcd.conf(5)}.
+more information, refer to
+@uref{https://www.rfc-editor.org/rfc/rfc4361,RFC 4361} and
+@code{dhcpcd.conf(5)}.
 
 @item @code{persistent?} (default: @code{#t}) (type: boolean)
-When true, automatically de-configure the interface when @command{dhcpcd}
-exits.
+When true, automatically de-configure the interface when
+@command{dhcpcd} exits.
 
 @item @code{option} (default: @code{("rapid_commit" "domain_name_servers" "domain_name" "domain_search" "host_name" "classless_static_routes" "interface_mtu")}) (type: list-of-strings)
 List of options to request from the server.
@@ -22019,9 +22020,13 @@ Networking Setup
 @item @code{extra-content} (type: maybe-string)
 Extra content to append to the configuration as-is.
 
+@item @code{shepherd-requirement} (default: @code{()}) (type: list-of-symbols)
+This is a list of symbols naming Shepherd services that this service
+will depend on.
+
 @end table
-@end deftp
 
+@end deftp
 
 @cindex NetworkManager
 
diff --git a/gnu/services/networking.scm b/gnu/services/networking.scm
index 67653e2cbf..4cb7313808 100644
--- a/gnu/services/networking.scm
+++ b/gnu/services/networking.scm
@@ -126,6 +126,7 @@ (define-module (gnu services networking)
             dhcpcd-configuration-vendor-class-id
             dhcpcd-configuration-client-id
             dhcpcd-configuration-extra-content
+            dhcpcd-configuration-shepherd-requirement
 
             ntp-configuration
             ntp-configuration?
@@ -609,6 +610,12 @@ (define-configuration dhcpcd-configuration
     maybe-string
     "Extra content to append to the configuration as-is.")
 
+  (shepherd-requirement
+   (list-of-symbols '())
+   "This is a list of symbols naming Shepherd services that this service
+will depend on."
+   empty-serializer)
+
   (prefix dhcpcd-))
 
 (define (dhcpcd-config-file config)
@@ -628,19 +635,19 @@ (define dhcpcd-account-service
           (shell (file-append shadow "/sbin/nologin")))))
 
 (define (dhcpcd-shepherd-service config)
-  (let* ((config-file (dhcpcd-config-file config))
-         (command-args (dhcpcd-configuration-command-arguments config))
-         (ifaces (dhcpcd-configuration-interfaces config)))
-    (list (shepherd-service
-            (documentation "dhcpcd daemon.")
-            (provision '(networking))
-            (requirement '(user-processes udev))
-            (actions (list (shepherd-configuration-action config-file)))
-            (start
+  (match-record config <dhcpcd-configuration>
+                (command-arguments interfaces shepherd-requirement)
+    (let ((config-file (dhcpcd-config-file config)))
+      (list (shepherd-service
+             (documentation "dhcpcd daemon.")
+             (provision '(networking))
+             (requirement `(user-processes udev ,@shepherd-requirement))
+             (actions (list (shepherd-configuration-action config-file)))
+             (start
               #~(make-forkexec-constructor
-                    (list (string-append #$dhcpcd "/sbin/dhcpcd")
-                          #$@command-args "-B" "-f" #$config-file #$@ifaces)))
-            (stop #~(make-kill-destructor))))))
+                 (list (string-append #$dhcpcd "/sbin/dhcpcd")
+                       #$@command-arguments "-B" "-f" #$config-file #$@interfaces)))
+             (stop #~(make-kill-destructor)))))))
 
 (define dhcpcd-service-type
   (service-type (name 'dhcpcd)
-- 
2.49.0





Information forwarded to sarg@HIDDEN, gabriel@HIDDEN, ludo@HIDDEN, maxim.cournoyer@HIDDEN, guix-patches@HIDDEN:
bug#78546; Package guix-patches. Full text available.

Message received at 78546 <at> debbugs.gnu.org:


Received: (at 78546) by debbugs.gnu.org; 23 May 2025 09:04:54 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri May 23 05:04:54 2025
Received: from localhost ([127.0.0.1]:45522 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1uIOKj-0006i1-Hg
	for submit <at> debbugs.gnu.org; Fri, 23 May 2025 05:04:54 -0400
Received: from mail-ej1-x635.google.com ([2a00:1450:4864:20::635]:42229)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
 (Exim 4.84_2) (envelope-from <sarg@HIDDEN>) id 1uIOKg-0006hJ-1n
 for 78546 <at> debbugs.gnu.org; Fri, 23 May 2025 05:04:51 -0400
Received: by mail-ej1-x635.google.com with SMTP id
 a640c23a62f3a-ad1f6aa2f84so149267266b.0
 for <78546 <at> debbugs.gnu.org>; Fri, 23 May 2025 02:04:50 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=sarg.org.ru; s=google; t=1747991082; x=1748595882; darn=debbugs.gnu.org;
 h=content-transfer-encoding:mime-version:message-id:date:subject:cc
 :to:from:from:to:cc:subject:date:message-id:reply-to;
 bh=8B07q27+a2yMB6svj1avgti2IiU89lrs9J415WqMbzU=;
 b=Nfw4TP2U7nvfSN1NzMcJwZwbQlDIZkLyIgvRLrwwPSdt9966xw4zkcts4JfZKo0q2J
 0GRnuoii9ySZlG3gUvUkqCPNR11QtYPDeDAB9ir+Fv6QfsW8CCsK+rPML5V9nMmiBYq1
 nmJFMDJOknHjG6nZj0i+QRAy4xZGGw64O975fLkjBVOfDUv0QeNuQVa9KsJ52yro2XBp
 J+tFoTr7wQPT8C6GgSiWaCeAfG4Pb882lGQCc6NCGxlvc33TveJ4lwtZCA3GqVj1gu2M
 MFhVoQilyfme02nupGR+L7HAccNawXSJkf/eK5Aqhjnpv8THDpgRSk3gNrI2Moydj13j
 /u+A==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20230601; t=1747991082; x=1748595882;
 h=content-transfer-encoding:mime-version:message-id:date:subject:cc
 :to:from:x-gm-message-state:from:to:cc:subject:date:message-id
 :reply-to;
 bh=8B07q27+a2yMB6svj1avgti2IiU89lrs9J415WqMbzU=;
 b=UkDSllziAsg2VGa7cVNgf5S0tvr+vBsoWEWwUg7GyPiZMik1odogKuzEfpwOX7NHP9
 Jjw59ny1lLiwbr3iJvyhFoIscIeAM5EjSOl8pZovmXess6dOPu6+ZGaq4AAuhRF9g9QI
 6w4Xgnuw4bjXNXB7/7TnoOU9TW9cPognlg8j2QX1SWZoqP2BS2pXHfL1Dxd//8JMpm80
 1W+MUOSPY2HhHBRAUPfJtb6rtC9RP7m+wbq6ELiMkt1wI2mlbNsYlGMooMV/zoV98igs
 WdEaJsIysXO/fbyklFqLvrgxQ4/ATp4jHPR2Hz557yNPmOSTMfBE1Zrx/OtFBIFYxQQy
 vweQ==
X-Gm-Message-State: AOJu0YzR3eGhMRW4CshONBBH5ymjA7ekz5Fwj8rvDZbpHMxv+4IZEp/Y
 mNC00MWTtYY5sUVW2Q/KQjySi1KdYYt2DSmOEwR4S4+Z1/t3MuiZ5LG/jNrMtwTL1XW3xEb9HVh
 5Jfqw03g=
X-Gm-Gg: ASbGncvP07Lr2dNTZNro4Uns21ypRr9coAZIPX03Dn3967kUkRvp1/zIgQ1xaj9Od85
 c6c4LMbYP1LmIEWD67ujH5wgyf0DE8H+i/siEhsWKPq+M1uc0hXXMAnjUJSKEyAfkPZWXZ0Hnoa
 qxHUvUJveczYzltqiG5Gx2pGTzW6sok3Zg/EodfttNBFklVaOP+dCAja8XDd6cPN+JcOp4to7r2
 f6GxBWGiFtxQW6tmJ37PRdCLzQjxsGXi+732TM3S3eYKtlNS5IwH3D9bRfl+ch3uYo+88+rS/2W
 iD4b+CUp8434IThPIdUMbbPW3JZ3JZRUx3O3NZiANpaIp/DcJyFlHkq0nJ8I
X-Google-Smtp-Source: AGHT+IG9B29A+w5HNoTLhiySUxJDoCOEsz1FN1aePufv3RsvTksjxlfEUDwZkWfSGQUC3FlVrXwMNA==
X-Received: by 2002:a17:907:3e8b:b0:ad5:112:490b with SMTP id
 a640c23a62f3a-ad64e7b5146mr208875966b.9.1747991081919; 
 Fri, 23 May 2025 02:04:41 -0700 (PDT)
Received: from localhost ([2a02:2454:a095:5600:a64e:31ff:fe38:fd6c])
 by smtp.gmail.com with ESMTPSA id
 a640c23a62f3a-ad52d4cc5e9sm1205895866b.173.2025.05.23.02.04.41
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Fri, 23 May 2025 02:04:41 -0700 (PDT)
From: Sergey Trofimov <sarg@HIDDEN>
To: 78546 <at> debbugs.gnu.org
Subject: [PATCH 1/3] services: configuration: Add define-enumerated-field-type
 helper.
Date: Fri, 23 May 2025 11:04:32 +0200
Message-ID: <fbf5fe9494765f5f2ccf3ec71beb566fb7faaa04.1747990996.git.sarg@HIDDEN>
X-Mailer: git-send-email 2.49.0
MIME-Version: 1.0
X-Debbugs-Cc: Sergey Trofimov <sarg@HIDDEN>
Content-Transfer-Encoding: 8bit
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 78546
Cc: Sergey Trofimov <sarg@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

* gnu/services/cups.scm (define-enumerated-field-type): Move...
* gnu/services/configuration.scm (define-enumerated-field-type): ...here.
* gnu/services/vpn.scm (define-enumerated-field-type): Remove.
* gnu/services/power.scm
(define-enum): Replace with define-enumerated-field-type.

Change-Id: I89ec40f479e3f800268e714f1f88d638be017c7e
---
 gnu/services/configuration.scm | 14 +++++++++++
 gnu/services/cups.scm          | 12 ---------
 gnu/services/power.scm         | 45 +++++++++++-----------------------
 gnu/services/vpn.scm           | 12 ---------
 4 files changed, 28 insertions(+), 55 deletions(-)

diff --git a/gnu/services/configuration.scm b/gnu/services/configuration.scm
index 15eddd7665..6d9fd1feae 100644
--- a/gnu/services/configuration.scm
+++ b/gnu/services/configuration.scm
@@ -75,6 +75,7 @@ (define-module (gnu services configuration)
             configuration->documentation
             empty-serializer
             serialize-package
+            define-enumerated-field-type
 
             filter-configuration-fields
 
@@ -508,6 +509,19 @@ (define* (interpose ls  #:optional (delimiter "\n") (grammar 'infix))
                           (cons delimiter acc))))
               '() ls))
 
+(define-syntax define-enumerated-field-type
+  (lambda (x)
+    (syntax-case x (prefix)
+      ((_ name (option ...) (prefix serializer-prefix))
+       #`(begin
+           (define (#,(id #'name #'name #'?) x)
+             (memq x '(option ...)))
+           (define (#,(id #'name #'serializer-prefix #'serialize- #'name) field-name val)
+             (#,(id #'name #'serializer-prefix #'serialize-field) field-name val))))
+
+      ((_ name (option ...))
+       #`(define-enumerated-field-type name (option ...) (prefix #{}#))))))
+
 
 ;;;
 ;;; Commonly used predicates
diff --git a/gnu/services/cups.scm b/gnu/services/cups.scm
index 738bb7f5cc..27aac7a16a 100644
--- a/gnu/services/cups.scm
+++ b/gnu/services/cups.scm
@@ -137,18 +137,6 @@ (define (non-negative-integer? val)
 (define (serialize-non-negative-integer field-name val)
   (serialize-field field-name val))
 
-(define-syntax define-enumerated-field-type
-  (lambda (x)
-    (define (id-append ctx . parts)
-      (datum->syntax ctx (apply symbol-append (map syntax->datum parts))))
-    (syntax-case x ()
-      ((_ name (option ...))
-       #`(begin
-           (define (#,(id-append #'name #'name #'?) x)
-             (memq x '(option ...)))
-           (define (#,(id-append #'name #'serialize- #'name) field-name val)
-             (serialize-field field-name val)))))))
-
 (define-enumerated-field-type access-log-level
   (config actions all))
 (define-enumerated-field-type browse-local-protocols
diff --git a/gnu/services/power.scm b/gnu/services/power.scm
index ec8ae555d4..ad386549cd 100644
--- a/gnu/services/power.scm
+++ b/gnu/services/power.scm
@@ -204,23 +204,6 @@ (define-configuration/no-serialization apcupsd-event-handlers
     #~(#t))
    "The handler for the battattach event."))
 
-(define-syntax define-enum
-  (lambda (x)
-    (syntax-case x ()
-      ((_ name values)
-       (let* ((datum/name (syntax->datum #'name))
-              (datum/predicate (string->symbol
-                                (format #f "enum-~a?" datum/name)))
-              (datum/serialize (string->symbol
-                                (format #f "serialize-enum-~a" datum/name))))
-         (with-syntax
-             ((predicate (datum->syntax x datum/predicate))
-              (serialize (datum->syntax x datum/serialize)))
-           #'(begin
-               (define (predicate value)
-                 (memq value values))
-               (define serialize serialize-symbol))))))))
-
 (define mangle-field-name
   (match-lambda
     ('name                            "UPSNAME")
@@ -252,25 +235,25 @@ (define mangle-field-name
     ('data-time                       "DATATIME")
     ('facility                        "FACILITY")))
 
-(define (serialize-string field-name value)
+(define (serialize-field field-name value)
   #~(format #f "~a ~a\n" #$(mangle-field-name field-name) '#$value))
-(define serialize-symbol serialize-string)
-(define serialize-integer serialize-string)
+(define serialize-string serialize-field)
+(define serialize-symbol serialize-field)
+(define serialize-integer serialize-field)
 (define (serialize-boolean field-name value)
-  #~(format #f "~a ~a\n"
-            #$(mangle-field-name field-name)
-            #$(if value "on" "off")))
+  (serialize-field field-name (if value "on" "off")))
 
 (define-maybe string)
 
-(define-enum cable '( simple smart ether usb
-                      940-0119A 940-0127A 940-0128A 940-0020B 940-0020C
-                      940-0023A 940-0024B 940-0024C 940-1524C 940-0024G
-                      940-0095A 940-0095B 940-0095C 940-0625A MAM-04-02-2000))
-(define-enum type '(apcsmart usb net snmp netsnmp dumb pcnet modbus test))
-(define-enum no-logon '(disable timeout percent minutes always))
-(define-enum class '(standalone shareslave sharemaster))
-(define-enum mode '(disable share))
+(define-enumerated-field-type enum-cable
+   ( simple smart ether usb
+     940-0119A 940-0127A 940-0128A 940-0020B 940-0020C
+     940-0023A 940-0024B 940-0024C 940-1524C 940-0024G
+     940-0095A 940-0095B 940-0095C 940-0625A MAM-04-02-2000))
+(define-enumerated-field-type enum-type (apcsmart usb net snmp netsnmp dumb pcnet modbus test))
+(define-enumerated-field-type enum-no-logon (disable timeout percent minutes always))
+(define-enumerated-field-type enum-class (standalone shareslave sharemaster))
+(define-enumerated-field-type enum-mode (disable share))
 
 (define-configuration apcupsd-configuration
   (apcupsd (package apcupsd) "The @code{apcupsd} package to use.")
diff --git a/gnu/services/vpn.scm b/gnu/services/vpn.scm
index f97cbac7bb..56022ac27a 100644
--- a/gnu/services/vpn.scm
+++ b/gnu/services/vpn.scm
@@ -141,18 +141,6 @@ (define (ip-mask? val)
            #f)))
 (define serialize-ip-mask serialize-string)
 
-(define-syntax define-enumerated-field-type
-  (lambda (x)
-    (define (id-append ctx . parts)
-      (datum->syntax ctx (apply symbol-append (map syntax->datum parts))))
-    (syntax-case x ()
-      ((_ name (option ...))
-       #`(begin
-           (define (#,(id-append #'name #'name #'?) x)
-             (memq x '(option ...)))
-           (define (#,(id-append #'name #'serialize- #'name) field-name val)
-             (serialize-field field-name val)))))))
-
 (define-enumerated-field-type proto
   (udp tcp udp6 tcp6))
 (define-enumerated-field-type dev

base-commit: 60025c2425dbac99df1219ed907c7c55e454b932
-- 
2.49.0





Information forwarded to sarg@HIDDEN, guix-patches@HIDDEN:
bug#78546; Package guix-patches. Full text available.

Message received at 78546 <at> debbugs.gnu.org:


Received: (at 78546) by debbugs.gnu.org; 22 May 2025 11:34:57 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu May 22 07:34:57 2025
Received: from localhost ([127.0.0.1]:32823 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1uI4CO-0006OE-GM
	for submit <at> debbugs.gnu.org; Thu, 22 May 2025 07:34:57 -0400
Received: from mail-ed1-x52d.google.com ([2a00:1450:4864:20::52d]:56767)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
 (Exim 4.84_2) (envelope-from <sarg@HIDDEN>) id 1uI4C9-0006M9-7J
 for 78546 <at> debbugs.gnu.org; Thu, 22 May 2025 07:34:43 -0400
Received: by mail-ed1-x52d.google.com with SMTP id
 4fb4d7f45d1cf-601dfef6a8dso7756750a12.1
 for <78546 <at> debbugs.gnu.org>; Thu, 22 May 2025 04:34:41 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=sarg.org.ru; s=google; t=1747913674; x=1748518474; darn=debbugs.gnu.org;
 h=content-transfer-encoding:mime-version:references:in-reply-to
 :message-id:date:subject:cc:to:from:from:to:cc:subject:date
 :message-id:reply-to;
 bh=SmA4NhYUQ32yMS20wNjwa0c9ulRMA9q0oDCVf360xrE=;
 b=rFsq+fKppK5niwPTbRRD5V5sEs8Qs0oqsDacEk/mkOOpx9UosJRnsvtS2ALuXvHulM
 ljzHO/GYLUEwlGdBgDhFiJxC36aGazurA8eL9fAWc2IuFhHvieOYnkIqoCZoO0b9EQeT
 USMYAWpiJSzdCfR11KesROObzA2y3mI1sNz6YX3VfEeyqWd4P+b+Fq6B3hDQkDcdTdLW
 2TnuM9iTijeZyC7oxHVVlNndT93VDWdUP4Eh/4apXplnwQVlGwTeFM5OXpKnNeEpXoyA
 6sXVTE1yPRbP9vIXAjy/NlD8TZCf/VyMKFJQxuAZ4iso5hKR1KaGvHxpDEbdWdTqVd7w
 oe7A==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20230601; t=1747913674; x=1748518474;
 h=content-transfer-encoding:mime-version:references:in-reply-to
 :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc
 :subject:date:message-id:reply-to;
 bh=SmA4NhYUQ32yMS20wNjwa0c9ulRMA9q0oDCVf360xrE=;
 b=FUjqdMoku5UEwEIWHjX1UuiL9MCAFhrWymlOzqkGss44iE4UJIjswi1ifYVy/LxmPe
 SNPyGRz5DIh+UzYRupLaoeq2hMlYC2gtRV/GPR+VmnwYFVwhsiql3lvfYzJq9gxq6JeT
 zfvLGPrJMb2NmxCA4jcvEd5PYSynh5lPDO27KdxmvzkanBaGn8NznDcuFnhNscSgs+fc
 GBrLTN9je/8dqX76oai/Rl+6/05OXD8/uoV8aYkl8xnu3b7C7+CR1pw8EVUBLc4ZLRIv
 AgYtA94NOfRtklRZHN5BI39tZmAV54c7o6oN+wePSSq6OUW/kN3I+AmEkcKl6w6cZ01G
 zXeA==
X-Gm-Message-State: AOJu0YzAjP7ahqH0FbpjTa9dxMl0xbFLZYRY2vZyp052mhryMCm5Oxg8
 Ez5HRsHm2KJCj8pk2vZFpKcKANWx/CQOIvphuZDwMpbmKJrNc8d3Hgpce3D1Pum779sBLV5QjFE
 dpEaP0pU=
X-Gm-Gg: ASbGncsfoXHUIHWDnGxl+MYILcesiGb3SMtANIRPv+ynSTbMLjNmEMCQSzmT4GJn1bZ
 Sfq5CZuzMeUzPXjDFfc2v7cTE3gT3gTJUBNtc6V8dDnakFFqmiqtH++bvkeSwIt+1JCiqwK2x8N
 VgkC17VjYG/7TvUxBeEfY7rv1dd0XAQg6917WLCz21k9OvSEYABB8AgqoS1lvYmLQRC9KikMvtf
 VJXmMDWv0W0KXpaE3T2mctmW1J0QpoXK6PGq+K78VoKRwTWTomIfJerHxUAlnxLRsqoIgwCiSFz
 mnPyg8/EHg0zkr/jnEesHVvEBHDv2rf2ZTitBVIUuTCmIuGs5w==
X-Google-Smtp-Source: AGHT+IG3YpnRTa/RF4JHzwwLV/KEaJP7Xat4zmVv96bscb7W6zUo3x62z8qsqzu3I+bLys7KjbwQBg==
X-Received: by 2002:a05:6402:2681:b0:601:bd34:8876 with SMTP id
 4fb4d7f45d1cf-601bd348bfdmr14547052a12.2.1747913673922; 
 Thu, 22 May 2025 04:34:33 -0700 (PDT)
Received: from localhost ([2a02:2454:a095:5600:a6fe:ab0a:f6f7:9028])
 by smtp.gmail.com with ESMTPSA id
 4fb4d7f45d1cf-6005ae3aed4sm10249120a12.75.2025.05.22.04.34.33
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Thu, 22 May 2025 04:34:33 -0700 (PDT)
From: Sergey Trofimov <sarg@HIDDEN>
To: 78546 <at> debbugs.gnu.org
Subject: [PATCH 3/3] services: networking: Add iwd-service-type.
Date: Thu, 22 May 2025 13:32:57 +0200
Message-ID: <039cf3a826d3caef178bbdb63585b63513b616f3.1747912984.git.sarg@HIDDEN>
X-Mailer: git-send-email 2.49.0
In-Reply-To: <abc454a968ed987ce41af66c632965579e856c81.1747912984.git.sarg@HIDDEN>
References: <abc454a968ed987ce41af66c632965579e856c81.1747912984.git.sarg@HIDDEN>
MIME-Version: 1.0
X-Debbugs-Cc: Gabriel Wicki <gabriel@HIDDEN>, Ludovic Courtès <ludo@HIDDEN>, Maxim Cournoyer <maxim.cournoyer@HIDDEN>
Content-Transfer-Encoding: 8bit
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 78546
Cc: Sergey Trofimov <sarg@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

* gnu/services/networking.scm (iwd-service-type): New service type.
(iwd-configuration), (iwd-settings), (iwd-scan-settings),
(iwd-general-settings), (iwd-network-settings): New configuration types.
* doc/guix.texi (Networking setup): Document it.

Change-Id: I852115b9c6768b3ec4eedb34a7f9e66438bd1429
---
 doc/guix.texi               | 157 ++++++++++++++++++++++++
 gnu/services/networking.scm | 237 ++++++++++++++++++++++++++++++++++++
 2 files changed, 394 insertions(+)

diff --git a/doc/guix.texi b/doc/guix.texi
index 3ef2e50e57..e02dda7d9a 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -22404,6 +22404,163 @@ Networking Setup
 @end table
 @end deftp
 
+@cindex IWD
+@defvar iwd-service-type
+This is the service type to run @acronyml{IWD,Internet Wireless Daemon},
+a wireless daemon required to authenticate against encrypted WiFi
+networks.
+@end defvar
+
+@quotation Warning
+By default @code{iwd} removes and re-creates interfaces it manages.  It
+doesn't play nicely with @code{dhcp-client-service-type} that enumerates
+wireless interfaces before starting the Shepherd service.  Use either
+@code{dhcpcd-service-type} or the @code{iwd}'s built-in DHCP client (see
+@code{enable-network-configuration} option below).
+@end quotation
+
+@c %start of fragment
+
+@deftp {Data Type} iwd-configuration
+Available @code{iwd-configuration} fields are:
+
+@table @asis
+@item @code{iwd} (default: @code{iwd}) (type: file-like)
+The IWD package to use.
+
+@item @code{interfaces} (default: @code{()}) (type: list-of-strings)
+If this is set, it must specify @dfn{glob patterns} matching network
+interfaces that IWD will control.
+
+@item @code{ignored-interfaces} (default: @code{()}) (type: list-of-strings)
+If this is set, it must specify @dfn{glob patterns} matching network
+interfaces that IWD will not manage.
+
+@item @code{phys} (default: @code{()}) (type: list-of-strings)
+If this is set, it must specify @dfn{glob patterns} matching network
+PHYs names that IWD will control.
+
+@item @code{ignored-phys} (default: @code{()}) (type: list-of-strings)
+If this is set, it must specify @dfn{glob patterns} matching network
+PHYs names that IWD will not manage.
+
+@item @code{shepherd-requirement} (default: @code{()}) (type: list-of-symbols)
+Shepherd requirements the service should depend on.
+
+@item @code{shepherd-provision} (default: @code{(iwd)}) (type: list-of-symbols)
+The name(s) of the service.
+
+@item @code{config} (type: iwd-settings)
+Configuration settings.
+
+@end table
+
+@end deftp
+
+
+@c %end of fragment
+
+@c %start of fragment
+
+@deftp {Data Type} iwd-settings
+Available @code{iwd-settings} fields are:
+
+@table @asis
+@item @code{general} (type: iwd-general-settings)
+General settings.
+
+@item @code{network} (type: maybe-iwd-network-settings)
+Network settings.
+
+@item @code{scan} (type: maybe-iwd-scan-settings)
+Scan settings.
+
+@item @code{extra-config} (default: @code{()}) (type: list-of-strings)
+Extra configuration values to append to the IWD configuration file.
+
+@end table
+
+@end deftp
+
+
+@c %end of fragment
+
+@c %start of fragment
+
+@deftp {Data Type} iwd-general-settings
+Available @code{iwd-general-settings} fields are:
+
+@table @asis
+@item @code{enable-network-configuration} (default: @code{#t}) (type: boolean)
+Setting this option to true enables @code{iwd} to configure the network
+interfaces with the IP addresses.
+
+@item @code{extra-options} (default: @code{()}) (type: alist)
+An association list of option symbols/strings to string values to be
+appended to the General settings group.
+
+@end table
+
+@end deftp
+
+
+@c %end of fragment
+
+@c %start of fragment
+
+@deftp {Data Type} iwd-network-settings
+Available @code{iwd-network-settings} fields are:
+
+@table @asis
+@item @code{enable-ipv6} (default: @code{#t}) (type: boolean)
+Sets the global default that tells @code{iwd} whether it should
+configure IPv6 addresses and routes
+
+@item @code{name-resolving-service} (default: @code{none}) (type: resolving-service)
+Configures a DNS resolution method used by the system.
+
+@item @code{extra-options} (default: @code{()}) (type: alist)
+An association list of option symbols/strings to string values to be
+appended to the Network settings group.
+
+@end table
+
+@end deftp
+
+
+@c %end of fragment
+
+@c %start of fragment
+
+@deftp {Data Type} iwd-scan-settings
+Available @code{iwd-scan-settings} fields are:
+
+@table @asis
+@item @code{disable-periodic-scan} (type: maybe-boolean)
+Setting this option to @code{#t} will prevent @code{iwd} from issuing
+the periodic scans for the available networks while disconnected.
+
+@item @code{initial-periodic-scan-interval} (type: maybe-number)
+The initial periodic scan interval upon disconnect (in seconds).
+
+@item @code{maximum-periodic-scan-interval} (type: maybe-number)
+The maximum periodic scan interval (in seconds).
+
+@item @code{disable-roaming-scan} (type: maybe-boolean)
+Setting this option to @code{#t} will prevent @code{iwd} from trying to
+scan when roaming decisions are activated.
+
+@item @code{extra-options} (default: @code{()}) (type: alist)
+An association list of option symbols/strings to string values to be
+appended to the Scan settings group.
+
+@end table
+
+@end deftp
+
+
+@c %end of fragment
+
 @cindex ModemManager
 Some networking devices such as modems require special care, and this is
 what the services below focus on.
diff --git a/gnu/services/networking.scm b/gnu/services/networking.scm
index 4cb7313808..dda0b8c2d0 100644
--- a/gnu/services/networking.scm
+++ b/gnu/services/networking.scm
@@ -41,6 +41,7 @@
 ;;; along with GNU Guix.  If not, see <http://www.gnu.org/licenses/>.
 
 (define-module (gnu services networking)
+  #:use-module (gnu home services utils)
   #:use-module (gnu services)
   #:use-module (gnu services base)
   #:use-module (gnu services configuration)
@@ -80,6 +81,7 @@ (define-module (gnu services networking)
   #:use-module (srfi srfi-9)
   #:use-module (srfi srfi-26)
   #:use-module (srfi srfi-43)
+  #:use-module ((ice-9 curried-definitions) #:select (define))
   #:use-module (ice-9 match)
   #:use-module (ice-9 string-fun)
   #:use-module (json)
@@ -233,6 +235,21 @@ (define-module (gnu services networking)
             wpa-supplicant-configuration-extra-options
             wpa-supplicant-service-type
 
+            iwd-configuration
+            iwd-configuration-config
+            iwd-configuration-ignored-interfaces
+            iwd-configuration-ignored-phys
+            iwd-configuration-interfaces
+            iwd-configuration-iwd
+            iwd-configuration-phys
+            iwd-configuration-shepherd-provision
+            iwd-configuration-shepherd-requirement
+            iwd-service-type
+            iwd-general-settings
+            iwd-network-settings
+            iwd-scan-settings
+            iwd-settings
+
             hostapd-configuration
             hostapd-configuration?
             hostapd-configuration-package
@@ -2083,6 +2100,226 @@ (define wpa-supplicant-service-type
 implements authentication, key negotiation and more for wireless networks.")
                   (default-value (wpa-supplicant-configuration)))))
 
+
+;;;
+;;; IWD
+;;;
+(define-enumerated-field-type resolving-service
+  (none systemd resolvconf))
+
+(define (iwd-uglify-field-name name)
+  (object->camel-case-string name 'upper))
+
+(define (iwd-serialize-base field-name val)
+  (format #f "~a=~a\n" field-name val))
+
+(define (iwd-serialize-field field-name val)
+  (iwd-serialize-base (iwd-uglify-field-name field-name) val))
+
+(define (iwd-serialize-boolean field-name value)
+  (iwd-serialize-field field-name (if value "true" "false")))
+
+(define (iwd-serialize-resolving-service field-name value)
+  (iwd-serialize-field field-name (object->string value)))
+
+(define (iwd-serialize-alist field-name value)
+  #~(string-append #$@(generic-serialize-alist list
+                                               iwd-serialize-base
+                                               value)))
+
+(define (serialize-list-of-strings _ value)
+  (string-join value "\n"))
+
+(define-maybe boolean (prefix iwd-))
+(define-maybe number (prefix iwd-))
+
+(define-configuration iwd-general-settings
+  (enable-network-configuration
+   (boolean #t)
+   "Setting this option to true enables @code{iwd} to configure the network
+interfaces with the IP addresses.")
+  (extra-options
+   (alist '())
+   "An association list of option symbols/strings to string values to be
+appended to the General settings group.")
+
+  (prefix iwd-))
+
+(define-configuration iwd-network-settings
+  (enable-ipv6
+   (boolean #t)
+   "Sets the global default that tells @code{iwd} whether it should configure
+IPv6 addresses and routes")
+
+  (name-resolving-service
+   (resolving-service 'none)
+   "Configures a DNS resolution method used by the system.")
+
+  (extra-options
+   (alist '())
+   "An association list of option symbols/strings to string values to be
+appended to the Network settings group.")
+
+  (prefix iwd-))
+
+(define-configuration iwd-scan-settings
+  (disable-periodic-scan
+   maybe-boolean
+   "Setting this option to @code{#t} will prevent @code{iwd} from issuing the
+periodic scans for the available networks while disconnected.")
+
+  (initial-periodic-scan-interval
+   maybe-number
+   "The initial periodic scan interval upon disconnect (in seconds).")
+
+  (maximum-periodic-scan-interval
+   maybe-number
+   "The maximum periodic scan interval (in seconds).")
+
+  (disable-roaming-scan
+   maybe-boolean
+   "Setting this option to @code{#t} will prevent @code{iwd} from trying to scan
+when roaming decisions are activated.")
+
+  (extra-options
+   (alist '())
+   "An association list of option symbols/strings to string values to be
+appended to the Scan settings group.")
+
+  (prefix iwd-))
+
+(define-maybe iwd-network-settings)
+(define-maybe iwd-scan-settings)
+
+(define ((iwd-serialize-config-section fields) name cfg)
+  #~(format #f "[~a]\n~a\n"
+            (string-upcase (object->string '#$name) 0 1)
+            #$(serialize-configuration cfg fields)))
+
+(define serialize-iwd-network-settings
+  (iwd-serialize-config-section iwd-network-settings-fields))
+
+(define serialize-iwd-scan-settings
+  (iwd-serialize-config-section iwd-scan-settings-fields))
+
+(define serialize-iwd-general-settings
+  (iwd-serialize-config-section iwd-general-settings-fields))
+
+(define-configuration iwd-settings
+  (general
+   (iwd-general-settings (iwd-general-settings))
+   "General settings.")
+
+  (network
+   maybe-iwd-network-settings
+   "Network settings.")
+
+  (scan
+   maybe-iwd-scan-settings
+   "Scan settings.")
+
+  (extra-config
+   (list-of-strings '())
+   "Extra configuration values to append to the IWD configuration file."))
+
+(define-configuration/no-serialization iwd-configuration
+  (iwd
+   (file-like iwd)
+   "The IWD package to use.")
+
+  (interfaces
+   (list-of-strings '())
+   "If this is set, it must specify @dfn{glob patterns} matching network
+interfaces that IWD will control.")
+
+  (ignored-interfaces
+   (list-of-strings '())
+   "If this is set, it must specify @dfn{glob patterns} matching network
+interfaces that IWD will not manage.")
+
+  (phys
+   (list-of-strings '())
+   "If this is set, it must specify @dfn{glob patterns} matching network
+PHYs names that IWD will control.")
+
+  (ignored-phys
+   (list-of-strings '())
+   "If this is set, it must specify @dfn{glob patterns} matching network
+PHYs names that IWD will not manage.")
+
+  (shepherd-requirement
+   (list-of-symbols '())
+   "Shepherd requirements the service should depend on.")
+
+  (shepherd-provision
+   (list-of-symbols '(iwd))
+   "The name(s) of the service.")
+
+  (config
+   (iwd-settings (iwd-settings))
+   "Configuration settings."))
+
+(define (iwd-generate-documentation)
+  (configuration->documentation 'iwd-configuration)
+  (configuration->documentation 'iwd-settings)
+  (configuration->documentation 'iwd-general-settings)
+  (configuration->documentation 'iwd-network-settings)
+  (configuration->documentation 'iwd-scan-settings))
+
+(define (iwd-config-file config)
+  "Return an IWD configuration file."
+  (mixed-text-file "main.conf"
+                   (serialize-configuration
+                    (iwd-configuration-config config)
+                    iwd-settings-fields)))
+
+(define (iwd-shepherd-service config)
+  (match-record config <iwd-configuration>
+                (iwd interfaces ignored-interfaces
+                     phys ignored-phys
+                     shepherd-requirement shepherd-provision)
+
+    (list (shepherd-service
+           (documentation "Run Internet Wireless Daemon")
+           (provision shepherd-provision)
+           (requirement `(user-processes dbus-system loopback ,@shepherd-requirement))
+           (start #~(make-forkexec-constructor
+                     (list (string-append #$iwd "/libexec/iwd")
+                           "--logger=syslog"
+                           #$@(if (null? interfaces) '()
+                                  (list (string-append "--interfaces="
+                                                       (string-join interfaces ","))))
+                           #$@(if (null? ignored-interfaces) '()
+                                  (list (string-append "--nointerfaces="
+                                                       (string-join ignored-interfaces ","))))
+                           #$@(if (null? phys) '()
+                                  (list (string-append "--phys="
+                                                       (string-join phys ","))))
+                           #$@(if (null? ignored-phys) '()
+                                  (list (string-append "--nophys="
+                                                       (string-join ignored-phys ",")))))))
+           (stop #~(make-kill-destructor))))))
+
+(define (iwd-etc-service config)
+  `(("iwd/main.conf" ,(iwd-config-file config))))
+
+(define iwd-service-type
+  (let ((add-iwd-package (compose list iwd-configuration-iwd)))
+    (service-type (name 'iwd)
+                  (extensions
+                   (list (service-extension shepherd-root-service-type
+                                            iwd-shepherd-service)
+                         (service-extension etc-service-type
+                                            iwd-etc-service)
+                         (service-extension dbus-root-service-type
+                                            add-iwd-package)
+                         (service-extension profile-service-type
+                                            add-iwd-package)))
+                  (default-value (iwd-configuration))
+                  (description
+                   "Run @url{https://iwd.wiki.kernel.org/,Iwd},
+a network connection manager."))))
+
 
 ;;;
 ;;; Hostapd.
-- 
2.49.0





Information forwarded to gabriel@HIDDEN, ludo@HIDDEN, maxim.cournoyer@HIDDEN, guix-patches@HIDDEN:
bug#78546; Package guix-patches. Full text available.

Message received at 78546 <at> debbugs.gnu.org:


Received: (at 78546) by debbugs.gnu.org; 22 May 2025 11:34:46 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu May 22 07:34:46 2025
Received: from localhost ([127.0.0.1]:32819 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1uI4CD-0006ND-GB
	for submit <at> debbugs.gnu.org; Thu, 22 May 2025 07:34:46 -0400
Received: from mail-ed1-x52e.google.com ([2a00:1450:4864:20::52e]:51345)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
 (Exim 4.84_2) (envelope-from <sarg@HIDDEN>) id 1uI4C7-0006Lt-JC
 for 78546 <at> debbugs.gnu.org; Thu, 22 May 2025 07:34:40 -0400
Received: by mail-ed1-x52e.google.com with SMTP id
 4fb4d7f45d1cf-601fb2b7884so7289879a12.2
 for <78546 <at> debbugs.gnu.org>; Thu, 22 May 2025 04:34:39 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=sarg.org.ru; s=google; t=1747913672; x=1748518472; darn=debbugs.gnu.org;
 h=content-transfer-encoding:mime-version:references:in-reply-to
 :message-id:date:subject:cc:to:from:from:to:cc:subject:date
 :message-id:reply-to;
 bh=5Funi3tuZKoaYxgLo+kP2aQUe/2aPhnrBGoCo/as63Y=;
 b=cRZPO+OnJwrkA8Jld5XtGAN+OwjdrZIz9WJRsibPuaclJiYSulIlsZjBSnT/1yWUqH
 IuoGIp+T1tpQG7a3dM9QIVs5hhh8hU5KlbY7hMvnyw6hSrne6jPfsM8LZJOEwSvV1NVI
 vOxrFS+ohMn4LqAusDGZ0NqHxd/PsMt5NT5k1LUs3bIdIt5WOlHnixH32z7T3oeBWdb5
 xKxnzy0aog3j67jmB3BmEvGqEkc4oKSX4zUwEbcn4OfXbdZx4mjtFfSlOCJ10Ue1jx0+
 KXd3RIEETITitj+BbTdpvsWC9RoxggI1fMlXOZbA3VFTz5HrgPyq2H15E6eJE8VtFV4i
 TXlw==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20230601; t=1747913672; x=1748518472;
 h=content-transfer-encoding:mime-version:references:in-reply-to
 :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc
 :subject:date:message-id:reply-to;
 bh=5Funi3tuZKoaYxgLo+kP2aQUe/2aPhnrBGoCo/as63Y=;
 b=nVf0pYOq4b+QCSj7t67sQa06p/erh6vqQIIdZdLUWrLYZGBtx7Le56IBax62IVz7F6
 lZJPd50WmNCPjnif0EzSPQbB5iRZAUXs6LDIkOVz28Q+13PGYVZYFZhmTEH4P3WMidIR
 F2BcWWkM4zKusDO4gpZJUsiBbfh7KAs4ZOtB8IZC3fJ4MOlyyU83O7lYiEqYVGB9pK3f
 6tKFZxS13YlKH9dfj2tYZvfNBj2OluRojpfgv6onOlw6h3oCsKE8XGPeovSmL/EdUm/5
 TL8mix4ysW5m7HMvI8zmwHoKkwRPgfZB3DFk8T0EyD70JBxI4wfqzC0Va5sXjeMplLrT
 ms0g==
X-Gm-Message-State: AOJu0YxkTcspDE5EiowQVSCfY313xmDFfwLFbVqUs3K+och/5BrP/lQc
 j21ulAtiyhSOJHFsH6/PeOxjYihxkAlniBNvFhB7KFTEIlagwRN7yRMujl87PfGJJ2f+lRHHLi3
 qwAXUd5k=
X-Gm-Gg: ASbGnct7ZmALRNidyLmB8cTqGaXkevyB0/9vviNAtwAk9m8uP1a8LkuBw65tfjp5eLX
 1ebSh8vRuIdCIhoVbx9Dp0/oo25TzslkBdZtEKxH16jRnquSeX3L/dqdGPalzDhYQHJkvvUIBEF
 fWvsXG6LieQnLnOgODnv7mrj2NCPcCvY40r+XB2eIEVr+TYCQtaMo4YCZa0bX5CrtNMfj4j4nC+
 bEx5UZpZ4tgNN1k4r3vKrFMd2TGdFWXDKGmQq+xd81siJzQqZYEKL8D1bLovQj7PmMuxwzhfvUo
 MN55MfHQbZYhoD2z4lMaD5QqpRr8bvKJLm4euLHS5u+8SgkURw==
X-Google-Smtp-Source: AGHT+IFBkFes/v60TbIwY9ixw/sfWFEQns0lbwYgFo7EK+6wJWli8OJSmktyFETZFESJucv3x/oGCg==
X-Received: by 2002:a05:6402:1ed0:b0:602:10b6:c982 with SMTP id
 4fb4d7f45d1cf-60210b6cf68mr9166667a12.12.1747913672301; 
 Thu, 22 May 2025 04:34:32 -0700 (PDT)
Received: from localhost ([2a02:2454:a095:5600:a6fe:ab0a:f6f7:9028])
 by smtp.gmail.com with ESMTPSA id
 4fb4d7f45d1cf-6005ac336d5sm10472238a12.54.2025.05.22.04.34.31
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Thu, 22 May 2025 04:34:31 -0700 (PDT)
From: Sergey Trofimov <sarg@HIDDEN>
To: 78546 <at> debbugs.gnu.org
Subject: [PATCH 2/3] services: networking: Add shepherd-requirement for dhcpcd.
Date: Thu, 22 May 2025 13:32:56 +0200
Message-ID: <2a43bbb6ead770a9302fe5d7d979dda6e87dcc64.1747912984.git.sarg@HIDDEN>
X-Mailer: git-send-email 2.49.0
In-Reply-To: <abc454a968ed987ce41af66c632965579e856c81.1747912984.git.sarg@HIDDEN>
References: <abc454a968ed987ce41af66c632965579e856c81.1747912984.git.sarg@HIDDEN>
MIME-Version: 1.0
X-Debbugs-Cc: Gabriel Wicki <gabriel@HIDDEN>, Ludovic Courtès <ludo@HIDDEN>, Maxim Cournoyer <maxim.cournoyer@HIDDEN>
Content-Transfer-Encoding: 8bit
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 78546
Cc: Sergey Trofimov <sarg@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

* gnu/services/networking.scm (dhcpcd-configuration): Add
shepherd-requirement field.
(dhcpcd-shepherd-service): Use it.
* doc/guix.texi (Networking Setup): Regenerate dhcpcd-configuration
documentation.
(File Systems): Fix typo.

Change-Id: Id347e2bed2569237685a47be82dbf686640db25b
---
 doc/guix.texi               | 17 +++++++++++------
 gnu/services/networking.scm | 31 +++++++++++++++++++------------
 2 files changed, 30 insertions(+), 18 deletions(-)

diff --git a/doc/guix.texi b/doc/guix.texi
index 02f472246a..3ef2e50e57 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -18332,7 +18332,7 @@ File Systems
 might not be sufficient as @code{networking} being marked as started
 does @emph{not} imply the network has already been configured and in
 working order (for example, when using
-@code{dhcpcd-client-service-type}).  For such cases, adding a
+@code{dhcp-client-service-type}).  For such cases, adding a
 requirement on a custom @code{network-online} service may be necessary.
 A sample @code{network-online} one-shot Shepherd service implementation
 is provided below:
@@ -21980,12 +21980,13 @@ Networking Setup
 @item @code{duid} (default: @code{""}) (type: maybe-string)
 DHCPv4 clients require a unique client identifier, this option uses the
 DHCPv6 Unique Identifier as a DHCPv4 client identifier as well.  For
-more information, refer to @uref{https://www.rfc-editor.org/rfc/rfc4361, RFC 4361}
-and @code{dhcpcd.conf(5)}.
+more information, refer to
+@uref{https://www.rfc-editor.org/rfc/rfc4361,RFC 4361} and
+@code{dhcpcd.conf(5)}.
 
 @item @code{persistent?} (default: @code{#t}) (type: boolean)
-When true, automatically de-configure the interface when @command{dhcpcd}
-exits.
+When true, automatically de-configure the interface when
+@command{dhcpcd} exits.
 
 @item @code{option} (default: @code{("rapid_commit" "domain_name_servers" "domain_name" "domain_search" "host_name" "classless_static_routes" "interface_mtu")}) (type: list-of-strings)
 List of options to request from the server.
@@ -22019,9 +22020,13 @@ Networking Setup
 @item @code{extra-content} (type: maybe-string)
 Extra content to append to the configuration as-is.
 
+@item @code{shepherd-requirement} (default: @code{()}) (type: list-of-symbols)
+This is a list of symbols naming Shepherd services that this service
+will depend on.
+
 @end table
-@end deftp
 
+@end deftp
 
 @cindex NetworkManager
 
diff --git a/gnu/services/networking.scm b/gnu/services/networking.scm
index 67653e2cbf..4cb7313808 100644
--- a/gnu/services/networking.scm
+++ b/gnu/services/networking.scm
@@ -126,6 +126,7 @@ (define-module (gnu services networking)
             dhcpcd-configuration-vendor-class-id
             dhcpcd-configuration-client-id
             dhcpcd-configuration-extra-content
+            dhcpcd-configuration-shepherd-requirement
 
             ntp-configuration
             ntp-configuration?
@@ -609,6 +610,12 @@ (define-configuration dhcpcd-configuration
     maybe-string
     "Extra content to append to the configuration as-is.")
 
+  (shepherd-requirement
+   (list-of-symbols '())
+   "This is a list of symbols naming Shepherd services that this service
+will depend on."
+   empty-serializer)
+
   (prefix dhcpcd-))
 
 (define (dhcpcd-config-file config)
@@ -628,19 +635,19 @@ (define dhcpcd-account-service
           (shell (file-append shadow "/sbin/nologin")))))
 
 (define (dhcpcd-shepherd-service config)
-  (let* ((config-file (dhcpcd-config-file config))
-         (command-args (dhcpcd-configuration-command-arguments config))
-         (ifaces (dhcpcd-configuration-interfaces config)))
-    (list (shepherd-service
-            (documentation "dhcpcd daemon.")
-            (provision '(networking))
-            (requirement '(user-processes udev))
-            (actions (list (shepherd-configuration-action config-file)))
-            (start
+  (match-record config <dhcpcd-configuration>
+                (command-arguments interfaces shepherd-requirement)
+    (let ((config-file (dhcpcd-config-file config)))
+      (list (shepherd-service
+             (documentation "dhcpcd daemon.")
+             (provision '(networking))
+             (requirement `(user-processes udev ,@shepherd-requirement))
+             (actions (list (shepherd-configuration-action config-file)))
+             (start
               #~(make-forkexec-constructor
-                    (list (string-append #$dhcpcd "/sbin/dhcpcd")
-                          #$@command-args "-B" "-f" #$config-file #$@ifaces)))
-            (stop #~(make-kill-destructor))))))
+                 (list (string-append #$dhcpcd "/sbin/dhcpcd")
+                       #$@command-arguments "-B" "-f" #$config-file #$@interfaces)))
+             (stop #~(make-kill-destructor)))))))
 
 (define dhcpcd-service-type
   (service-type (name 'dhcpcd)
-- 
2.49.0





Information forwarded to gabriel@HIDDEN, ludo@HIDDEN, maxim.cournoyer@HIDDEN, guix-patches@HIDDEN:
bug#78546; Package guix-patches. Full text available.

Message received at 78546 <at> debbugs.gnu.org:


Received: (at 78546) by debbugs.gnu.org; 22 May 2025 11:34:45 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu May 22 07:34:45 2025
Received: from localhost ([127.0.0.1]:32817 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1uI4CC-0006N9-Na
	for submit <at> debbugs.gnu.org; Thu, 22 May 2025 07:34:45 -0400
Received: from mail-ej1-x632.google.com ([2a00:1450:4864:20::632]:42415)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
 (Exim 4.84_2) (envelope-from <sarg@HIDDEN>) id 1uI4C6-0006Lr-It
 for 78546 <at> debbugs.gnu.org; Thu, 22 May 2025 07:34:40 -0400
Received: by mail-ej1-x632.google.com with SMTP id
 a640c23a62f3a-acacb8743a7so1345764666b.1
 for <78546 <at> debbugs.gnu.org>; Thu, 22 May 2025 04:34:38 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=sarg.org.ru; s=google; t=1747913671; x=1748518471; darn=debbugs.gnu.org;
 h=content-transfer-encoding:mime-version:message-id:date:subject:cc
 :to:from:from:to:cc:subject:date:message-id:reply-to;
 bh=l3C+IZf0CVAKvJf4kiqt9zhNQm7d+tGEkSKdfF5MPHw=;
 b=o+PAF3yEy0/Vvkd6EIX3P3qhAxSjZcQjxWFNs3bea1rt4Innv8qsz7msE0nR+A/CER
 zTevfACjKotMroAhEvi4OhbC7m7sV6PqwPJvixySGai2wLPB/rioNHFIJzqaZTJ76oss
 F/IvhVF9jDpAFDmup81JiDJP8sIF12hQ19AOo1kRENZQ1Amz1uwO1vgFU3Idji7EO8eU
 rQpdWMlpF808x8AkmTfwUSOy4F+z6Z6pGe8l4tKuy34QMx3Fak2jY1Avj+7VGBthQy36
 f0tKNOlD1OvYHoXL7LW8vUZg5AhMU6kIhtdSKgGJM79ZSOPTLJ2Vw2vwQ95FFdVa0asy
 NzdQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20230601; t=1747913671; x=1748518471;
 h=content-transfer-encoding:mime-version:message-id:date:subject:cc
 :to:from:x-gm-message-state:from:to:cc:subject:date:message-id
 :reply-to;
 bh=l3C+IZf0CVAKvJf4kiqt9zhNQm7d+tGEkSKdfF5MPHw=;
 b=lO5xa4qxXqIytFnGznaB0PYhzTOHcFVPME1M3alU/IrYdujdEdrTB88oEA9XPPQ4x8
 nhLU0y8xW39U8qzpmXZrA7ffB3p077hBcoO0q07eBsC0+eGc7ngkJpK6OBUYKtsYJw2O
 NEJAr0DNqzgLe79RHmZ+ghFSAg2YhXPD8o3HVm1NkP1QE73U1lQnOqwJOIUJg9+sWeYD
 Vs6/CJ580Ax7QvtsvFufCVyRNJhoj1l0wUzp91FwMc7cIfalEqfGociq5QN/dEzEv1Uv
 07qsMZ4qQ/zFFZPg1IqfQtFp/YrXOfvnjorDOuzGUxdm5xrwMxUkvwsoaymrJK76xxLf
 UGqQ==
X-Gm-Message-State: AOJu0Yx4fDRkFqEU9Yf9OZIvTs0BCDzOjHFolnz0SNQnhsQBT3LthrFr
 aNVAneT190tnaxgqusY4tn6bwV2SP0bUeZiGeOjKQp49TaTAKaVj4Sk8kUezpweVPwanahwYfke
 78wMwZ8s=
X-Gm-Gg: ASbGncsD1vj7EUKsTmZT0fsNKrFuPzCGdJly9HpHSkVeI1W0CGITE5WGR0MI9Dg+sTh
 o9EurqyUAxqrKwJeFQmgUwCwy347FAz50JAk8KWBHASH2C5LXQavmpJOBZqVy/A7iprHdBpSXD5
 l2gfS7wV9ZcmOaR80YyFiNR84HCURCawpqmR6yNdek31aZVSwwpaDg9JC6z1ftCVd/ZO3ItV5BI
 Wrnw+O++Sy23zLPMOruHvyzPSpeyJUAPcC0Ri2DT6f3QsQdLxqhkfuyv3V+Go64eXORxYUH714u
 /0RUeVkfBTfZyT4StK3tQ7nevgyc7Fu+Bz82gaFQ+7dXItwKhw==
X-Google-Smtp-Source: AGHT+IGnplal5eqvjx3Tam6HtQMIjLf6Oqo2byVriKQT9LkFSnxJCI3DRw0o2c7F1r34uayR7wW71w==
X-Received: by 2002:a17:907:60d2:b0:ad5:54ec:6b3c with SMTP id
 a640c23a62f3a-ad554ec711bmr1759108166b.27.1747913670680; 
 Thu, 22 May 2025 04:34:30 -0700 (PDT)
Received: from localhost ([2a02:2454:a095:5600:a6fe:ab0a:f6f7:9028])
 by smtp.gmail.com with ESMTPSA id
 a640c23a62f3a-ad52d49afb8sm1064307566b.152.2025.05.22.04.34.30
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Thu, 22 May 2025 04:34:30 -0700 (PDT)
From: Sergey Trofimov <sarg@HIDDEN>
To: 78546 <at> debbugs.gnu.org
Subject: [PATCH 1/3] services: configuration: Add define-enumerated-field-type
 helper.
Date: Thu, 22 May 2025 13:32:55 +0200
Message-ID: <abc454a968ed987ce41af66c632965579e856c81.1747912984.git.sarg@HIDDEN>
X-Mailer: git-send-email 2.49.0
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 78546
Cc: Sergey Trofimov <sarg@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

* gnu/services/cups.scm (define-enumerated-field-type): Move...
* gnu/services/configuration.scm (define-enumerated-field-type): ...here.
* gnu/services/vpn.scm (define-enumerated-field-type): Remove.
* gnu/services/power.scm
(define-enum): Replace with define-enumerated-field-type.

Change-Id: I89ec40f479e3f800268e714f1f88d638be017c7e
---
 gnu/services/configuration.scm | 13 ++++++++++
 gnu/services/cups.scm          | 12 ---------
 gnu/services/power.scm         | 45 +++++++++++-----------------------
 gnu/services/vpn.scm           | 12 ---------
 4 files changed, 27 insertions(+), 55 deletions(-)

diff --git a/gnu/services/configuration.scm b/gnu/services/configuration.scm
index 15eddd7665..659a25f352 100644
--- a/gnu/services/configuration.scm
+++ b/gnu/services/configuration.scm
@@ -75,6 +75,7 @@ (define-module (gnu services configuration)
             configuration->documentation
             empty-serializer
             serialize-package
+            define-enumerated-field-type
 
             filter-configuration-fields
 
@@ -508,6 +509,18 @@ (define* (interpose ls  #:optional (delimiter "\n") (grammar 'infix))
                           (cons delimiter acc))))
               '() ls))
 
+(define-syntax define-enumerated-field-type
+  (lambda (x)
+    (define (id-append ctx . parts)
+      (datum->syntax ctx (apply symbol-append (map syntax->datum parts))))
+    (syntax-case x ()
+      ((_ name (option ...))
+       #`(begin
+           (define (#,(id-append #'name #'name #'?) x)
+             (memq x '(option ...)))
+           (define (#,(id-append #'name #'serialize- #'name) field-name val)
+             (serialize-field field-name val)))))))
+
 
 ;;;
 ;;; Commonly used predicates
diff --git a/gnu/services/cups.scm b/gnu/services/cups.scm
index 738bb7f5cc..27aac7a16a 100644
--- a/gnu/services/cups.scm
+++ b/gnu/services/cups.scm
@@ -137,18 +137,6 @@ (define (non-negative-integer? val)
 (define (serialize-non-negative-integer field-name val)
   (serialize-field field-name val))
 
-(define-syntax define-enumerated-field-type
-  (lambda (x)
-    (define (id-append ctx . parts)
-      (datum->syntax ctx (apply symbol-append (map syntax->datum parts))))
-    (syntax-case x ()
-      ((_ name (option ...))
-       #`(begin
-           (define (#,(id-append #'name #'name #'?) x)
-             (memq x '(option ...)))
-           (define (#,(id-append #'name #'serialize- #'name) field-name val)
-             (serialize-field field-name val)))))))
-
 (define-enumerated-field-type access-log-level
   (config actions all))
 (define-enumerated-field-type browse-local-protocols
diff --git a/gnu/services/power.scm b/gnu/services/power.scm
index ec8ae555d4..ad386549cd 100644
--- a/gnu/services/power.scm
+++ b/gnu/services/power.scm
@@ -204,23 +204,6 @@ (define-configuration/no-serialization apcupsd-event-handlers
     #~(#t))
    "The handler for the battattach event."))
 
-(define-syntax define-enum
-  (lambda (x)
-    (syntax-case x ()
-      ((_ name values)
-       (let* ((datum/name (syntax->datum #'name))
-              (datum/predicate (string->symbol
-                                (format #f "enum-~a?" datum/name)))
-              (datum/serialize (string->symbol
-                                (format #f "serialize-enum-~a" datum/name))))
-         (with-syntax
-             ((predicate (datum->syntax x datum/predicate))
-              (serialize (datum->syntax x datum/serialize)))
-           #'(begin
-               (define (predicate value)
-                 (memq value values))
-               (define serialize serialize-symbol))))))))
-
 (define mangle-field-name
   (match-lambda
     ('name                            "UPSNAME")
@@ -252,25 +235,25 @@ (define mangle-field-name
     ('data-time                       "DATATIME")
     ('facility                        "FACILITY")))
 
-(define (serialize-string field-name value)
+(define (serialize-field field-name value)
   #~(format #f "~a ~a\n" #$(mangle-field-name field-name) '#$value))
-(define serialize-symbol serialize-string)
-(define serialize-integer serialize-string)
+(define serialize-string serialize-field)
+(define serialize-symbol serialize-field)
+(define serialize-integer serialize-field)
 (define (serialize-boolean field-name value)
-  #~(format #f "~a ~a\n"
-            #$(mangle-field-name field-name)
-            #$(if value "on" "off")))
+  (serialize-field field-name (if value "on" "off")))
 
 (define-maybe string)
 
-(define-enum cable '( simple smart ether usb
-                      940-0119A 940-0127A 940-0128A 940-0020B 940-0020C
-                      940-0023A 940-0024B 940-0024C 940-1524C 940-0024G
-                      940-0095A 940-0095B 940-0095C 940-0625A MAM-04-02-2000))
-(define-enum type '(apcsmart usb net snmp netsnmp dumb pcnet modbus test))
-(define-enum no-logon '(disable timeout percent minutes always))
-(define-enum class '(standalone shareslave sharemaster))
-(define-enum mode '(disable share))
+(define-enumerated-field-type enum-cable
+   ( simple smart ether usb
+     940-0119A 940-0127A 940-0128A 940-0020B 940-0020C
+     940-0023A 940-0024B 940-0024C 940-1524C 940-0024G
+     940-0095A 940-0095B 940-0095C 940-0625A MAM-04-02-2000))
+(define-enumerated-field-type enum-type (apcsmart usb net snmp netsnmp dumb pcnet modbus test))
+(define-enumerated-field-type enum-no-logon (disable timeout percent minutes always))
+(define-enumerated-field-type enum-class (standalone shareslave sharemaster))
+(define-enumerated-field-type enum-mode (disable share))
 
 (define-configuration apcupsd-configuration
   (apcupsd (package apcupsd) "The @code{apcupsd} package to use.")
diff --git a/gnu/services/vpn.scm b/gnu/services/vpn.scm
index f97cbac7bb..56022ac27a 100644
--- a/gnu/services/vpn.scm
+++ b/gnu/services/vpn.scm
@@ -141,18 +141,6 @@ (define (ip-mask? val)
            #f)))
 (define serialize-ip-mask serialize-string)
 
-(define-syntax define-enumerated-field-type
-  (lambda (x)
-    (define (id-append ctx . parts)
-      (datum->syntax ctx (apply symbol-append (map syntax->datum parts))))
-    (syntax-case x ()
-      ((_ name (option ...))
-       #`(begin
-           (define (#,(id-append #'name #'name #'?) x)
-             (memq x '(option ...)))
-           (define (#,(id-append #'name #'serialize- #'name) field-name val)
-             (serialize-field field-name val)))))))
-
 (define-enumerated-field-type proto
   (udp tcp udp6 tcp6))
 (define-enumerated-field-type dev

base-commit: ed83953921cd3a2abb09c1709399053c092215a2
prerequisite-patch-id: f9cc903b8048c8c6fde576fbf38ab110263020e3
prerequisite-patch-id: b6d30068ce4971d4d8e67517229916df4e76c529
prerequisite-patch-id: c99e71b3eaa726b8ecf2d9b782d5a6a51476e702
prerequisite-patch-id: 08fa3e98a432063db118aa1502c6bd0166415bdd
prerequisite-patch-id: 95bb686bc7dc0961b89a2900a368f270de065d94
prerequisite-patch-id: f56033bf148a2fdfb5d9321315bdff877ebdb7ba
prerequisite-patch-id: 6d43f84387c6ec611389d6f16c1809cc28a29365
prerequisite-patch-id: 73fabf1570be45886923df86ca4c66e4330c3752
prerequisite-patch-id: 2ed8951b99f17bac7694d7e2c3ed0440e650b0c1
prerequisite-patch-id: 09df1d4083ee7abc4f2f346f8576be31db4d193d
prerequisite-patch-id: bace844ae66e50873074acf659ea8fc33796ac73
prerequisite-patch-id: 58f741d217a355489de150faf91cfa5e111d21b5
prerequisite-patch-id: f7817220252740d4dd3433fa2f689f261b82ae6c
prerequisite-patch-id: 8d312fa060e7f6a2b1d58d40c4ff6dc9f1a529a1
prerequisite-patch-id: 38a9fa9641ee1ec252c7068e1b5f9c1ac3a3281c
prerequisite-patch-id: 500be64418ed5e4994de42cfd99b6c8f15498f9d
-- 
2.49.0





Information forwarded to guix-patches@HIDDEN:
bug#78546; Package guix-patches. Full text available.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 22 May 2025 11:25:18 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu May 22 07:25:18 2025
Received: from localhost ([127.0.0.1]:60933 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1uI433-0002iQ-LP
	for submit <at> debbugs.gnu.org; Thu, 22 May 2025 07:25:18 -0400
Received: from lists.gnu.org ([2001:470:142::17]:43508)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <sarg@HIDDEN>) id 1uI42x-0002dL-7z
 for submit <at> debbugs.gnu.org; Thu, 22 May 2025 07:25:14 -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 <sarg@HIDDEN>) id 1uI42r-0005lX-0g
 for guix-patches@HIDDEN; Thu, 22 May 2025 07:25:05 -0400
Received: from mail-wm1-x32f.google.com ([2a00:1450:4864:20::32f])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
 (Exim 4.90_1) (envelope-from <sarg@HIDDEN>) id 1uI42l-0006wb-Lb
 for guix-patches@HIDDEN; Thu, 22 May 2025 07:25:04 -0400
Received: by mail-wm1-x32f.google.com with SMTP id
 5b1f17b1804b1-43edecbfb94so86441395e9.1
 for <guix-patches@HIDDEN>; Thu, 22 May 2025 04:24:57 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=sarg.org.ru; s=google; t=1747913096; x=1748517896; darn=gnu.org;
 h=content-transfer-encoding:mime-version:message-id:date:subject:cc
 :to:from:from:to:cc:subject:date:message-id:reply-to;
 bh=heqMTgFwY2Lb+yDObCXeY+ieNmH7iEfJggAfeGuVJd0=;
 b=G7klbQbBqERrXPFENWsTXS7czyujTEW0BgmVKrzydfLFhuAwgnUUZT9T9Dw89ogYSN
 7wDomMiK9qs6it+8FHck4d0paRTdxanFAZH1K9xVetAAQVe9Sl6xp4lhfLfRKZpjiPoS
 kZUC8O1cUb3SorN2nPYFmm/NEf3oHQqJVK231Bo/ntMq06svr5U15GmQSzWV7uaWiV/k
 R+1rF4/tfqOA80eJu3m3ZxX+iiUEPW+pev6Fua/30biSPInnNpR05IVhNoFBW8OaS+ih
 beQaKdd0cp1/1cMEiyoommkcEATk4tDh2JHtjyejtUs8IPWIyZNw59GEHScSa6LDVU6T
 WB3w==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20230601; t=1747913096; x=1748517896;
 h=content-transfer-encoding:mime-version:message-id:date:subject:cc
 :to:from:x-gm-message-state:from:to:cc:subject:date:message-id
 :reply-to;
 bh=heqMTgFwY2Lb+yDObCXeY+ieNmH7iEfJggAfeGuVJd0=;
 b=NFcNEP3ckP1IZh8mPnSaI/ifuHaKafXSXOEDO94ra+9famb4XkEjxRAUn3mDHCYw5P
 OBIcvhCS+3FI5iSykS6VFZKXxFREsuxZenl9Jsf4+PNuwm/5dcpfvgwlM7wHKYcFEoDE
 plYYAyrOqxihR3CNplJkPoXWEtzSBChWaHJZM/BftDP/o+4p34j0iMBIVdoLVCYJhCyZ
 eKLL14vJS1alBwIc8sq64naAH/oLLqBSSjAEGtnzNEVWVpAbaFTje5qYIRHFTUwKF8XX
 2gi0p0eNZ9IwY5wrCPY+cCM8soYWd6HFA3UIa//c07iCZ5fnwKVAVD9wnA0mVXQUjQqK
 Gkgg==
X-Gm-Message-State: AOJu0Yzxzljg3HCU3djnlTGnYqdcJMPZTlPj5FEVz7OyqWcvR8PWHEYK
 nOO0sdjVvEqU9Umvdfug65WYwWrnlTEZIztP3ry0bbTrWQNxhpn3Gncciz8ptVyO2yhJGVZexpu
 IEKXC2w4=
X-Gm-Gg: ASbGnctvhQrZpn/qkpHCSIoJbnVCZB04wv735SIAEPkyfT5rX9cF/B1PDggpN1MdArp
 dp5Jfw8JTMMYuNTRZ8HFpq2auUI45djoQdbFLbEcUduHD60gKcCBmrfG1AItBJJbiVTVAzQmA+p
 WAk1UI3rqvYfozHWVo6Rh2Sy09FZ6qefhCOuDNeSm0sldlMxM9Amzke7KpcrwVYGOaX2+BhV/tm
 rpwaoIVmixI3jLKKPpRhWREBpLcNIxIxzD9UXM5mLfg5F2PE9rqM1JNsn2mWd0h6uhSvebqrpc4
 eLhuVUD6vRdTsxQWp4Koj04m5aZhsY7RUAT9zwbDHWHcopxvukddNc0ur5S0
X-Google-Smtp-Source: AGHT+IEXBJli4bCfzJDzwoJ7xeCqVobrQd3gT8Ml65zWZUr9PLa7vfjONsQgrqbnA1D10oBd4Py94Q==
X-Received: by 2002:a05:6000:4022:b0:3a3:7be3:cbaa with SMTP id
 ffacd0b85a97d-3a37be3ced5mr9712404f8f.28.1747913095582; 
 Thu, 22 May 2025 04:24:55 -0700 (PDT)
Received: from localhost ([2a02:2454:a095:5600:a6fe:ab0a:f6f7:9028])
 by smtp.gmail.com with ESMTPSA id
 ffacd0b85a97d-3a35ca62b1bsm23235116f8f.53.2025.05.22.04.24.54
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Thu, 22 May 2025 04:24:55 -0700 (PDT)
From: Sergey Trofimov <sarg@HIDDEN>
To: guix-patches@HIDDEN
Subject: [PATCH 0/3] Add iwd-service-type.
Date: Thu, 22 May 2025 13:24:51 +0200
Message-ID: <cover.1747912263.git.sarg@HIDDEN>
X-Mailer: git-send-email 2.49.0
MIME-Version: 1.0
X-Debbugs-Cc: Gabriel Wicki <gabriel@HIDDEN>, Ludovic Courtès <ludo@HIDDEN>, Maxim Cournoyer <maxim.cournoyer@HIDDEN>
Content-Transfer-Encoding: 8bit
Received-SPF: pass client-ip=2a00:1450:4864:20::32f;
 envelope-from=sarg@HIDDEN; helo=mail-wm1-x32f.google.com
X-Spam_score_int: -20
X-Spam_score: -2.1
X-Spam_bar: --
X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1,
 DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1,
 RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001,
 SPF_PASS=-0.001 autolearn=ham autolearn_force=no
X-Spam_action: no action
X-Spam-Score: 1.0 (+)
X-Debbugs-Envelope-To: submit
Cc: Sergey Trofimov <sarg@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -0.0 (/)

This series adds a shepherd service for IWD.
Resolves https://issues.guix.gnu.org/59971

Sergey Trofimov (3):
  services: configuration: Add define-enumerated-field-type helper.
  services: networking: Add shepherd-requirement for dhcpcd.
  services: networking: Add iwd-service-type.

 doc/guix.texi                  | 166 +++++++++++++++++++-
 gnu/services/configuration.scm |  13 ++
 gnu/services/cups.scm          |  12 --
 gnu/services/networking.scm    | 268 +++++++++++++++++++++++++++++++--
 gnu/services/power.scm         |  45 ++----
 gnu/services/vpn.scm           |  12 --
 6 files changed, 443 insertions(+), 73 deletions(-)


base-commit: ed83953921cd3a2abb09c1709399053c092215a2
-- 
2.49.0





Acknowledgement sent to Sergey Trofimov <sarg@HIDDEN>:
New bug report received and forwarded. Copy sent to gabriel@HIDDEN, ludo@HIDDEN, maxim.cournoyer@HIDDEN, guix-patches@HIDDEN. Full text available.
Report forwarded to gabriel@HIDDEN, ludo@HIDDEN, maxim.cournoyer@HIDDEN, guix-patches@HIDDEN:
bug#78546; Package guix-patches. Full text available.
Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.
Last modified: Fri, 6 Jun 2025 08:15:02 UTC

GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997 nCipher Corporation Ltd, 1994-97 Ian Jackson.