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.

Full log


View this message in rfc822 format

From: help-debbugs <at> gnu.org (GNU bug Tracking System)
To: Carlo Zancanaro <carlo <at> zancanaro.id.au>
Subject: bug#76637: closed (Re: [bug#76637] [PATCH] services: wireguard:
 Add the auto-start? field.)
Date: Sun, 02 Mar 2025 15:48:02 +0000
[Message part 1 (text/plain, inline)]
Your bug report

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

which was filed against the guix-patches package, has been closed.

The explanation is attached below, along with your original report.
If you require more details, please reply to 76637 <at> debbugs.gnu.org.

-- 
76637: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=76637
GNU Bug Tracking System
Contact help-debbugs <at> gnu.org with problems
[Message part 2 (message/rfc822, inline)]
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

[Message part 3 (message/rfc822, inline)]
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




This bug report was last modified 134 days ago.

Previous Next


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