GNU bug report logs - #76637
[PATCH] services: wireguard: Add the auto-start? field.

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: Carlo Zancanaro <carlo@HIDDEN>; Keywords: patch; dated Fri, 28 Feb 2025 10:34:01 UTC; Maintainer for guix-patches is guix-patches@HIDDEN.

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


Received: (at submit) by debbugs.gnu.org; 28 Feb 2025 10:33:18 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri Feb 28 05:33:18 2025
Received: from localhost ([127.0.0.1]:45530 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1tnxgD-0006L6-Hk
	for submit <at> debbugs.gnu.org; Fri, 28 Feb 2025 05:33:18 -0500
Received: from lists.gnu.org ([2001:470:142::17]:34508)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <carlo@HIDDEN>)
 id 1tnxgA-0006Kf-C3
 for submit <at> debbugs.gnu.org; Fri, 28 Feb 2025 05:33:15 -0500
Received: from eggs.gnu.org ([2001:470:142:3::10])
 by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <carlo@HIDDEN>)
 id 1tnxfp-0006lV-9f
 for guix-patches@HIDDEN; Fri, 28 Feb 2025 05:33:02 -0500
Received: from voltorb.zancanaro.id.au ([45.77.50.64])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <carlo@HIDDEN>)
 id 1tnxfh-0003rt-2s
 for guix-patches@HIDDEN; Fri, 28 Feb 2025 05:32:50 -0500
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; s=k1; bh=DlmGMwJdziRq0Wl
 kwVSpYubUvXBdO/Y7Xwn9KOgtawI=; h=date:subject:to:from;
 d=zancanaro.id.au; b=mL5CMPYqtrHHSKz3z8Ly6AHHmAEcGUAR8zBaTZAYBm0ZE3GqE
 wZKXUYU8J9yxNY+8VPfB+PXttylUxArVygE9zt4e4TChytkrKtGI+4KWCy29m03oChccXw
 CoLucaRSa8eb1ZVIGmrAFKU+kHulirR3REAZqCwx6EuPoUwY0iRA=
Received: by voltorb.zancanaro.id.au (OpenSMTPD) with ESMTPSA id 4d72084d
 (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO) for <guix-patches@HIDDEN>;
 Fri, 28 Feb 2025 10:32:25 +0000 (UTC)
From: Carlo Zancanaro <carlo@HIDDEN>
To: guix-patches@HIDDEN
Subject: [PATCH] services: wireguard: Add the auto-start? field.
Date: Fri, 28 Feb 2025 21:31:10 +1100
Message-ID: <5d18dcc609db2170071a302ee35fc0d74170ae54.1740738670.git.carlo@HIDDEN>
X-Mailer: git-send-email 2.48.1
MIME-Version: 1.0
X-Debbugs-Cc: Ludovic Courtès <ludo@HIDDEN>, Maxim Cournoyer <maxim.cournoyer@HIDDEN>
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Received-SPF: pass client-ip=45.77.50.64; envelope-from=carlo@HIDDEN;
 helo=voltorb.zancanaro.id.au
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_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001,
 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
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 (/)

* gnu/services/vpn.scm (<wireguard-configuration>): Add auto-start?.
(wireguard-shepherd-service): Pass auto-start? to Shepherd service.
* doc/guix.texi (VPN Services)[wireguard]: Document it.

Change-Id: I7880a8c8e9860250f875e845e94eb118a4b852fa
---

Does what it says on the tin.

This makes it possible to define a wireguard service without
automatically starting the service. This is convenient for connections
on desktops/laptops if they are not always used.

 doc/guix.texi        | 8 +++++++-
 gnu/services/vpn.scm | 8 +++++++-
 2 files changed, 14 insertions(+), 2 deletions(-)

diff --git a/doc/guix.texi b/doc/guix.texi
index 93380dc30d..c7ca21ef52 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -43,7 +43,7 @@
 Copyright @copyright{} 2017, 2018, 2019 Clément Lassieur@*
 Copyright @copyright{} 2017, 2018, 2020, 2021, 2022 Mathieu Othacehe@*
 Copyright @copyright{} 2017 Federico Beffa@*
-Copyright @copyright{} 2017, 2018, 2024 Carlo Zancanaro@*
+Copyright @copyright{} 2017, 2018, 2024, 2025 Carlo Zancanaro@*
 Copyright @copyright{} 2017 Thomas Danckaert@*
 Copyright @copyright{} 2017 humanitiesNerd@*
 Copyright @copyright{} 2017, 2021 Christine Lemmer-Webber@*
@@ -35570,6 +35570,12 @@ VPN Services
 altogether, and @code{"auto"} (the default) that adds routes to the
 default table and enables special handling of default routes.
 
+@item @code{auto-start?} (default: @code{#t"})
+Whether the Wireguard network should be started automatically by the
+Shepherd.  If it is @code{#f} the service has to be started manually
+with @code{herd start wireguard-$interface} (for example: @code{herd
+start wireguard-wg0}).
+
 @end table
 @end deftp
 
diff --git a/gnu/services/vpn.scm b/gnu/services/vpn.scm
index c66622ad6c..478a0d543e 100644
--- a/gnu/services/vpn.scm
+++ b/gnu/services/vpn.scm
@@ -13,6 +13,7 @@
 ;;; Copyright © 2022 Timo Wilken <guix@HIDDEN>
 ;;; Copyright © 2023 Maxim Cournoyer <maxim.cournoyer@HIDDEN>
 ;;; Copyright © 2024 Richard Sent <richard@HIDDEN>
+;;; Copyright © 2025 Carlo Zancanaro <carlo@HIDDEN>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -88,6 +89,7 @@ (define-module (gnu services vpn)
             wireguard-configuration-pre-down
             wireguard-configuration-post-down
             wireguard-configuration-table
+            wireguard-configuration-auto-start?
 
             wireguard-service-type))
 
@@ -764,7 +766,9 @@ (define-record-type* <wireguard-configuration>
   (post-down              wireguard-configuration-post-down ;list of strings
                           (default '()))
   (table                  wireguard-configuration-table ;string
-                          (default "auto")))
+                          (default "auto"))
+  (auto-start?            wireguard-configuration-auto-start? ;boolean
+                          (default #t)))
 
 (define (wireguard-configuration-file config)
   (define (peer->config peer)
@@ -916,6 +920,7 @@ (define (wireguard-shepherd-service config)
   (match-record config <wireguard-configuration>
     (wireguard interface)
     (let ((wg-quick (file-append wireguard "/bin/wg-quick"))
+          (auto-start? (wireguard-configuration-auto-start? config))
           (config (wireguard-configuration-file config)))
       (list (shepherd-service
              (requirement '(networking))
@@ -926,6 +931,7 @@ (define (wireguard-shepherd-service config)
                        (invoke #$wg-quick "down" #$config)
                        #f))                       ;stopped!
              (actions (list (shepherd-configuration-action config)))
+             (auto-start? auto-start?)
              (documentation "Run the Wireguard VPN tunnel"))))))
 
 (define (wireguard-monitoring-jobs config)

base-commit: a76708a872e65230931f3c5c3b079d0a39d5cb84
-- 
2.48.1





Acknowledgement sent to Carlo Zancanaro <carlo@HIDDEN>:
New bug report received and forwarded. Copy sent to ludo@HIDDEN, maxim.cournoyer@HIDDEN, guix-patches@HIDDEN. Full text available.
Report forwarded to ludo@HIDDEN, maxim.cournoyer@HIDDEN, guix-patches@HIDDEN:
bug#76637; 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, 28 Feb 2025 10:45:02 UTC

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