unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
From: Sergey Trofimov <sarg@sarg.org.ru>
To: Apoorv Singh <apoorvs569@gmail.com>
Cc: 73467@debbugs.gnu.org
Subject: [bug#73467] [PATCH] Wireguard: Add autostart? field.
Date: Thu, 26 Sep 2024 19:45:26 +0200	[thread overview]
Message-ID: <87ikui1f7t.fsf@sarg.org.ru> (raw)
In-Reply-To: <87cyksjfhw.fsf@gmail.com>

Apoorv Singh <apoorvs569@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.




  reply	other threads:[~2024-09-26 20:26 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-09-25  8:37 [bug#73467] [PATCH] Wireguard: Add autostart? field Apoorv Singh
2024-09-26 17:45 ` Sergey Trofimov [this message]
2024-10-03 12:53   ` Maxim Cournoyer
2024-10-03  5:30 ` [bug#73467] Wireguard: Add auto-start? field Apoorv Singh
2024-10-03 12:47   ` Maxim Cournoyer
2024-10-03 12:37 ` [bug#73467] [PATCH] Wireguard: Add autostart? field Maxim Cournoyer
2024-10-03 17:43 ` [bug#73467] PATCH V3 for Wireguard: Add auto-start? field Apoorv Singh

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://guix.gnu.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87ikui1f7t.fsf@sarg.org.ru \
    --to=sarg@sarg.org.ru \
    --cc=73467@debbugs.gnu.org \
    --cc=apoorvs569@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).