emacs-bug-tracker
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#61483: closed ([PATCH 0/5] Some basic Home Shepherd Services)


From: GNU bug Tracking System
Subject: bug#61483: closed ([PATCH 0/5] Some basic Home Shepherd Services)
Date: Fri, 17 Mar 2023 11:54:01 +0000

Your message dated Fri, 17 Mar 2023 12:53:35 +0100
with message-id <87h6ujoaps.fsf@gnu.org>
and subject line Re: bug#61483: [PATCH 0/5] Some basic Home Shepherd Services
has caused the debbugs.gnu.org bug report #61483,
regarding [PATCH 0/5] Some basic Home Shepherd Services
to be marked as done.

(If you believe you have received this mail in error, please contact
help-debbugs@gnu.org.)


-- 
61483: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=61483
GNU Bug Tracking System
Contact help-debbugs@gnu.org with problems
--- Begin Message --- Subject: [PATCH 0/5] Some basic Home Shepherd Services Date: Mon, 13 Feb 2023 17:46:42 +0100
From: "Janneke Nieuwenhuizen" <janneke@gnu.org>

Hi!

I've been waiting for Guix Home to offer some basic shepherd services for most
used daemons, replacing the neat shepherd hack described in

    https://guix.gnu.org/en/blog/2020/gnu-shepherd-user-services/

that I've been using, and am a bit puzzled as to why this didn't happen.  Are
people using Guix Home?

Anyway, here's my attempt to address this, adding ssh-agent, git-daemon, and
also the probably less-used kodi and znc that I use on my home server.

To add a git-daemon and ssh-agent to your guix home profile, you need
a home-configuration.scm that has something like this:

--8<---------------cut here---------------start------------->8---
(use-modules (gnu home)
             (gnu home services shells)
             (gnu home services shepherd)
             (gnu home services shepherd-xyz)
             (gnu packages)
             (gnu packages base)
             (gnu services)
             (guix gexp))

(services
 (list (service home-shepherd-service-type)
       (service home-git-daemon-service-type)
       (service home-ssh-agent-service-type)))
--8<---------------cut here---------------end--------------->8---

The weird thing is that after running

    ./pre-inst-env guix home reconfigure home-configuration.scm

the shepherd starts automatically, starting ssh-agent and git-daemon.  Upon a
fresh login, however, it seems the shepherd must still be started manually,
kind of defeating its purpose as a home service...

Thoughts?

Greetings,
Janneke

Also pushed to https://gitlab.com/janneke/guix/-/commits/wip-home/

Janneke Nieuwenhuizen (5):
  DRAFT gnu: home: services: Add home-git-daemon-service-type.
  DRAFT gnu: home: services: Add home-ssh-agent-service-type.
  DRAFT gnu: home: services: Add home-znc-service-type.
  DRAFT gnu: home: services: Add home-kodi-service-type.
  DRAFT doc: Document Home Shepherd Services.

 doc/guix.texi                      |  90 ++++++++++-
 gnu/home/services/shepherd-xyz.scm | 239 +++++++++++++++++++++++++++++
 gnu/local.mk                       |   3 +-
 3 files changed, 330 insertions(+), 2 deletions(-)
 create mode 100644 gnu/home/services/shepherd-xyz.scm

-- 
2.38.1




--- End Message ---
--- Begin Message --- Subject: Re: bug#61483: [PATCH 0/5] Some basic Home Shepherd Services Date: Fri, 17 Mar 2023 12:53:35 +0100 User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.2 (gnu/linux)
Janneke Nieuwenhuizen writes:

Hi!

> Ludovic Courtès writes:
>
> Hi,
>
>> Janneke Nieuwenhuizen <janneke@gnu.org> skribis:
>>
>>> +@lisp
>>> +(environment-variables
>>> + '(("SSH_AUTH_SOCK"
>>> + . 
>>> "$@{SSH_AUTH_SOCK-$@{XDG_RUNTIME_DIR-$HOME/.cache@}/ssh-agent/socket@}")))
>>> +@end lisp
>>
>> Maybe we should automate that by having ‘home-ssh-agent-service-type’
>> extend ‘home-environment-variables-service-type’?  That way it’d work
>> out-of-the-box regardless of the shell being used.
>
> Oh that's a neat idea!  Someone will have to figure out how to do that,
> later.

I've pushed the attached patch to take care of this.  Pretty neat!

Closing this bug now, if we want to address the git-daemon "transform"
and #:user "git-daemon" issue better to open a new bug report.

Greetings,
Janneke

>From 2714c9ef2d6cb42f15c2f284449f602467f0d1c0 Mon Sep 17 00:00:00 2001
From: "Jan (janneke) Nieuwenhuizen" <janneke@gnu.org>
Date: Fri, 17 Mar 2023 12:40:16 +0100
Subject: [PATCH] home: services: ssh-agent: Handle setting of SSH_AUTH_SOCK.

* gnu/home/services/ssh.scm (home-ssh-agent-environment-variables): New
procedure.
(home-ssh-agent-service-type): Use it as ahome-environment-service type
extension.
* doc/guix.texi (Secure Shell): Remove advice about, and examples of setting
SSH_AUTH_SOCK.
---
 doc/guix.texi             | 17 -----------------
 gnu/home/services/ssh.scm |  8 +++++++-
 2 files changed, 7 insertions(+), 18 deletions(-)

diff --git a/doc/guix.texi b/doc/guix.texi
index 4807f16c0a..2d42ca8de2 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -42473,23 +42473,6 @@ machines using the @acronym{SSH, secure shell} 
protocol.  With the
 @code{(gnu home services ssh-agent)} service, you can configure the
 OpenSSH ssh-agent to run upon login.
 
-When using the @code{home-ssh-agent-service-type}, you need to add your
-@file{~/.bash_profile}:
-
-@example
-SSH_AUTH_SOCK=$@{XDG_RUNTIME_DIR-$HOME/.cache@}/ssh-agent/socket
-export SSH_AUTH_SOCK
-@end example
-
-Of course, you can do that using the @code{home-bash-service-type}, by
-adding something like:
-
-@lisp
-(environment-variables
- '(("SSH_AUTH_SOCK"
- . "$@{SSH_AUTH_SOCK-$@{XDG_RUNTIME_DIR-$HOME/.cache@}/ssh-agent/socket@}")))
-@end lisp
-
 Here is an example of a service and its configuration that you could add
 to the @code{services} field of your @code{home-environment}:
 
diff --git a/gnu/home/services/ssh.scm b/gnu/home/services/ssh.scm
index dc37ecf329..01917a29cd 100644
--- a/gnu/home/services/ssh.scm
+++ b/gnu/home/services/ssh.scm
@@ -295,12 +295,18 @@ (define (home-ssh-agent-services config)
                         (fork+exec-command #$command #:log-file #$log-file)))
              (stop #~(make-kill-destructor)))))))
 
+(define (home-ssh-agent-environment-variables config)
+  '(("SSH_AUTH_SOCK"
+     . "${SSH_AUTH_SOCK-${XDG_RUNTIME_DIR-$HOME/.cache}/ssh-agent/socket}")))
+
 (define home-ssh-agent-service-type
   (service-type
    (name 'home-ssh-agent)
    (default-value (home-ssh-agent-configuration))
    (extensions
     (list (service-extension home-shepherd-service-type
-                             home-ssh-agent-services)))
+                             home-ssh-agent-services)
+          (service-extension home-environment-variables-service-type
+                             home-ssh-agent-environment-variables)))
    (description
     "Install and configure @command{ssh-agent} as a Shepherd service.")))
-- 
2.39.1

-- 
Janneke Nieuwenhuizen <janneke@gnu.org>  | GNU LilyPond https://LilyPond.org
Freelance IT https://www.JoyOfSource.com | Avatar® https://AvatarAcademy.com

--- End Message ---

reply via email to

[Prev in Thread] Current Thread [Next in Thread]