From: Mathieu Othacehe <m.othacehe@gmail.com>
To: "Ludovic Courtès" <ludo@gnu.org>
Cc: guix-devel@gnu.org
Subject: Re: Defining user services in Guix.
Date: Fri, 28 Apr 2017 17:22:41 +0200 [thread overview]
Message-ID: <877f24pnem.fsf@gmail.com> (raw)
In-Reply-To: <8737cu7z0s.fsf@gnu.org>
[-- Attachment #1: Type: text/plain, Size: 1021 bytes --]
Hi,
> Agreed. A ‘guix user’ tool (or similar) could talk to the user’s
> Shepherd instance to upgrade user services like
> ‘upgrade-shepherd-services’ does in (guix scripts system).
With the attached patch, it is possibe to use (gnu services herd) to
interact with a user shepherd instance.
For instance :
--8<---------------cut here---------------start------------->8---
(use-modules (gnu services herd))
(parameterize
((%shepherd-socket-file "/home/mathieu/.config/shepherd/run/socket"))
(current-services))
--8<---------------cut here---------------end--------------->8---
Which returns :
--8<---------------cut here---------------start------------->8---
$1 = (#<<live-service> provision: (redshift) requirement: () running: 3632> #<<live-service> provision: (root shepherd) requirement: () running: #t>)
--8<---------------cut here---------------end--------------->8---
Based on that, I'll try to define a guix user command to upgrade user
services if it is ok for everyone :).
Thanks,
Mathieu
[-- Attachment #2: 0001-services-herd-Make-shepherd-socket-file-a-parameter-.patch --]
[-- Type: text/x-patch, Size: 1598 bytes --]
From caf7d9f5a7875663623b24662c1c23b99e60c5ad Mon Sep 17 00:00:00 2001
From: Mathieu Othacehe <m.othacehe@gmail.com>
Date: Fri, 28 Apr 2017 17:09:53 +0200
Subject: [PATCH] services: herd: Make %shepherd-socket-file a parameter and
export it.
* gnu/services/herd.scm (%shepherd-socket-file): Make it an exported
parameter.
(open-connection): Adapt.
---
gnu/services/herd.scm | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/gnu/services/herd.scm b/gnu/services/herd.scm
index 03bfbf1d7..f8d60a480 100644
--- a/gnu/services/herd.scm
+++ b/gnu/services/herd.scm
@@ -1,5 +1,6 @@
;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2016 Ludovic Courtès <ludo@gnu.org>
+;;; Copyright © 2017 Mathieu Othacehe <m.othacehe@gmail.com>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -23,7 +24,9 @@
#:use-module (srfi srfi-34)
#:use-module (srfi srfi-35)
#:use-module (ice-9 match)
- #:export (shepherd-error?
+ #:export (%shepherd-socket-file
+
+ shepherd-error?
service-not-found-error?
service-not-found-error-service
action-not-found-error?
@@ -58,9 +61,9 @@
;;; Code:
(define %shepherd-socket-file
- "/var/run/shepherd/socket")
+ (make-parameter "/var/run/shepherd/socket"))
-(define* (open-connection #:optional (file %shepherd-socket-file))
+(define* (open-connection #:optional (file (%shepherd-socket-file)))
"Open a connection to the daemon, using the Unix-domain socket at FILE, and
return the socket."
;; The protocol is sexp-based and UTF-8-encoded.
--
2.12.2
next prev parent reply other threads:[~2017-04-28 15:22 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-04-22 16:50 Defining user services in Guix Mathieu Othacehe
2017-04-22 18:31 ` Danny Milosavljevic
2017-04-22 23:06 ` Ludovic Courtès
2017-04-23 16:27 ` Mathieu Othacehe
2017-04-25 0:02 ` Mekeor Melire
2017-04-25 8:36 ` Ricardo Wurmus
2017-04-27 13:36 ` Ludovic Courtès
2017-04-28 15:22 ` Mathieu Othacehe [this message]
2017-05-02 10:02 ` Ludovic Courtès
2017-05-02 19:23 ` Mathieu Othacehe
2017-05-02 21:21 ` Ludovic Courtès
2017-05-02 21:44 ` Ricardo Wurmus
2017-05-03 9:43 ` Mathieu Othacehe
2017-06-11 1:29 ` Invoking user shepherd; Was: Re: Defining *user* " Danny Milosavljevic
2017-06-11 8:33 ` Mathieu Othacehe
2017-06-13 8:00 ` Ludovic Courtès
2017-06-13 8:06 ` Ludovic Courtès
2017-06-13 14:32 ` Danny Milosavljevic
2017-06-13 16:06 ` Ludovic Courtès
2017-05-02 21:22 ` Defining user " Ludovic Courtès
2017-04-22 23:53 ` Carlo Zancanaro
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=877f24pnem.fsf@gmail.com \
--to=m.othacehe@gmail.com \
--cc=guix-devel@gnu.org \
--cc=ludo@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 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).