all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: "Clément Lassieur" <clement@lassieur.org>
To: Arun Isaac <arunisaac@systemreboot.net>
Cc: help-guix@gnu.org
Subject: Re: Configuring a service but not starting it on boot
Date: Wed, 28 Nov 2018 10:34:22 +0100	[thread overview]
Message-ID: <87y39dy28x.fsf@lassieur.org> (raw)
In-Reply-To: <cu7efb5wsn8.fsf@systemreboot.net>

[-- Attachment #1: Type: text/plain, Size: 459 bytes --]

Hi Arun,

Arun Isaac <arunisaac@systemreboot.net> writes:

> I would like to have the a service (specifically the tor service) listed
> in my config.scm and configured using `guix system reconfigure
> config.scm'. But, I do not want the service to start up at boot time. I
> want to start/stop it using `herd' later as and when I require it. How
> do I achieve this?
>
> Thanks!

Attached is a hack I did a while ago.

Hope it helps,
Clément

[-- Attachment #2: dont-auto-start.patch --]
[-- Type: text/x-diff, Size: 1795 bytes --]

commit 5ebc46a52e543c316924ac936bb65c3ae7f113bb
Author: Clément Lassieur <clement@lassieur.org>
Date:   Fri May 5 15:11:37 2017 +0200

    guix: don't auto-start nginx

diff --git a/guix/configs/modules/rodion/web.scm b/guix/configs/modules/rodion/web.scm
index 5c26651..35fe3d3 100644
--- a/guix/configs/modules/rodion/web.scm
+++ b/guix/configs/modules/rodion/web.scm
@@ -1,6 +1,8 @@
 (define-module (rodion web)
   #:use-module (gnu services)
   #:use-module (gnu services web)
+  #:use-module (srfi srfi-1) ; find
+  #:use-module (gnu services shepherd) ; shepherd-root-service-type
   #:export (%my-nginx-service))
 
 (define my-nginx-configuration
@@ -18,5 +20,29 @@
          (uri "/")
          (body (list "index index.html;"))))))))))
 
+(define (my-nginx-shepherd-service nginx-conf)
+  (let ((nginx-shepherd-service
+         (service-extension-compute
+          (find (lambda (ext)
+                  (eq? (service-extension-target ext)
+                       shepherd-root-service-type))
+                (service-type-extensions nginx-service-type)))))
+    (list
+     (shepherd-service
+      (inherit (car (nginx-shepherd-service nginx-conf)))
+      (auto-start? #f)))))
+
+(define my-nginx-service-type
+  (service-type
+   (inherit nginx-service-type)
+   (extensions
+    (cons
+     (service-extension shepherd-root-service-type
+                        my-nginx-shepherd-service)
+     (remove (lambda (ext)
+               (eq? (service-extension-target ext)
+                    shepherd-root-service-type))
+             (service-type-extensions nginx-service-type))))))
+
 (define %my-nginx-service
-  (service nginx-service-type my-nginx-configuration))
+  (service my-nginx-service-type my-nginx-configuration))

  reply	other threads:[~2018-11-28  9:34 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-11-28  7:47 Configuring a service but not starting it on boot Arun Isaac
2018-11-28  9:34 ` Clément Lassieur [this message]
2018-11-28 16:11   ` Arun Isaac
2018-11-28 16:44     ` znavko
2018-11-28 17:20     ` Ludovic Courtès
2018-11-28 17:52       ` Arun Isaac
2018-11-29 10:49         ` Ludovic Courtès
2018-11-30  9:03           ` Arun Isaac

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

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

  git send-email \
    --in-reply-to=87y39dy28x.fsf@lassieur.org \
    --to=clement@lassieur.org \
    --cc=arunisaac@systemreboot.net \
    --cc=help-guix@gnu.org \
    /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 external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.