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

Previous Next

Package: guix-patches;

Reported by: Carlo Zancanaro <carlo <at> zancanaro.id.au>

Date: Fri, 28 Feb 2025 10:34:01 UTC

Severity: normal

Tags: patch

Done: Maxim Cournoyer <maxim.cournoyer <at> gmail.com>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 76637 in the body.
You can then email your comments to 76637 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to ludo <at> gnu.org, maxim.cournoyer <at> gmail.com, guix-patches <at> gnu.org:
bug#76637; Package guix-patches. (Fri, 28 Feb 2025 10:34:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Carlo Zancanaro <carlo <at> zancanaro.id.au>:
New bug report received and forwarded. Copy sent to ludo <at> gnu.org, maxim.cournoyer <at> gmail.com, guix-patches <at> gnu.org. (Fri, 28 Feb 2025 10:34:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Carlo Zancanaro <carlo <at> zancanaro.id.au>
To: guix-patches <at> gnu.org
Subject: [PATCH] services: wireguard: Add the auto-start? field.
Date: Fri, 28 Feb 2025 21:31:10 +1100
* 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 <at> twilken.net>
 ;;; Copyright © 2023 Maxim Cournoyer <maxim.cournoyer <at> gmail.com>
 ;;; Copyright © 2024 Richard Sent <richard <at> freakingpenguin.com>
+;;; Copyright © 2025 Carlo Zancanaro <carlo <at> zancanaro.id.au>
 ;;;
 ;;; 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





Reply sent to Maxim Cournoyer <maxim.cournoyer <at> gmail.com>:
You have taken responsibility. (Sun, 02 Mar 2025 15:48:01 GMT) Full text and rfc822 format available.

Notification sent to Carlo Zancanaro <carlo <at> zancanaro.id.au>:
bug acknowledged by developer. (Sun, 02 Mar 2025 15:48:02 GMT) Full text and rfc822 format available.

Message #10 received at 76637-done <at> debbugs.gnu.org (full text, mbox):

From: Maxim Cournoyer <maxim.cournoyer <at> gmail.com>
To: Carlo Zancanaro <carlo <at> zancanaro.id.au>
Cc: 76637-done <at> debbugs.gnu.org, Ludovic Courtès <ludo <at> gnu.org>
Subject: Re: [bug#76637] [PATCH] services: wireguard: Add the auto-start?
 field.
Date: Mon, 03 Mar 2025 00:47:16 +0900
Hi,

Carlo Zancanaro <carlo <at> zancanaro.id.au> writes:

> * 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

Pushed, thank you.

-- 
Maxim




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Mon, 31 Mar 2025 11:24:09 GMT) Full text and rfc822 format available.

This bug report was last modified 131 days ago.

Previous Next


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