[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Defining user services in Guix.
From: |
Mathieu Othacehe |
Subject: |
Re: Defining user services in Guix. |
Date: |
Fri, 28 Apr 2017 17:22:41 +0200 |
User-agent: |
mu4e 0.9.18; emacs 25.2.1 |
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
>From caf7d9f5a7875663623b24662c1c23b99e60c5ad Mon Sep 17 00:00:00 2001
From: Mathieu Othacehe <address@hidden>
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 <address@hidden>
+;;; Copyright © 2017 Mathieu Othacehe <address@hidden>
;;;
;;; 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
Re: Defining user services in Guix., Carlo Zancanaro, 2017/04/22