GNU bug report logs - #73467
[PATCH] Wireguard: Add autostart? field.

Previous Next

Package: guix-patches;

Reported by: Apoorv Singh <apoorvs569 <at> gmail.com>

Date: Wed, 25 Sep 2024 09:39:02 UTC

Severity: normal

Tags: patch

Full log


View this message in rfc822 format

From: Sergey Trofimov <sarg <at> sarg.org.ru>
To: Apoorv Singh <apoorvs569 <at> gmail.com>
Cc: 73467 <at> debbugs.gnu.org
Subject: [bug#73467] [PATCH] Wireguard: Add autostart? field.
Date: Thu, 26 Sep 2024 19:45:26 +0200
Apoorv Singh <apoorvs569 <at> gmail.com> writes:

> The following patch adds a record field autostart? which can be used by the user
> to configure weather the wireguard service should start automatically.

I generally agree that there should be a way to disable autostart and
I've solved it in a more generic way:

--8<---------------cut here---------------start------------->8---
(define (no-autostart input-service)
  "Augment shepherd extension of INPUT-SERVICE to disable auto-start."
  (define (transform-extension ex)
    (match ex
      (($ (@@ (gnu services) <service-extension>)
          (and ($ (@@ (gnu services) <service-type>) 'shepherd-root _) kind)
          compute)

       (service-extension
        kind
        (lambda (config)
          (let ((orig (car (compute config))))
            (list (shepherd-service (inherit orig) (auto-start? #f)))))))

      (_ ex)))

  (match input-service
    (($ (@@ (gnu services) <service>)
        (and ($ (@@ (gnu services) <service-type>) _ extensions _) kind)
        value)

     (service
      (service-type
       (inherit kind)
       (extensions (map transform-extension extensions)))
      value))))
--8<---------------cut here---------------end--------------->8---

Anyway, you need to document the new configuration parameter in the manual.




This bug report was last modified 97 days ago.

Previous Next


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