From patchwork Fri Mar 17 11:53:35 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Janneke Nieuwenhuizen X-Patchwork-Id: 48068 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id C6BBF16DED; Fri, 17 Mar 2023 11:54:22 +0000 (GMT) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-1.8 required=5.0 tests=DKIM_INVALID,DKIM_SIGNED, MAILING_LIST_MULTI,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.6 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id B712F16D4A for ; Fri, 17 Mar 2023 11:54:20 +0000 (GMT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pd8eq-0006wC-HF; Fri, 17 Mar 2023 07:54:04 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pd8eo-0006vY-LG for guix-patches@gnu.org; Fri, 17 Mar 2023 07:54:02 -0400 Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pd8eo-00083i-37 for guix-patches@gnu.org; Fri, 17 Mar 2023 07:54:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1pd8en-0007Jc-VY for guix-patches@gnu.org; Fri, 17 Mar 2023 07:54:01 -0400 Subject: bug#61483: [PATCH 0/5] Some basic Home Shepherd Services Resent-From: Janneke Nieuwenhuizen Original-Sender: "Debbugs-submit" Resent-To: guix-patches@gnu.org Resent-Date: Fri, 17 Mar 2023 11:54:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: cc-closed 61483 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: Ludovic =?utf-8?q?Court=C3=A8s?= Cc: 61483-done@debbugs.gnu.org Mail-Followup-To: 61483@debbugs.gnu.org, janneke@gnu.org, janneke@gnu.org Received: via spool by 61483-done@debbugs.gnu.org id=D61483.167905403028098 (code D ref 61483); Fri, 17 Mar 2023 11:54:01 +0000 Received: (at 61483-done) by debbugs.gnu.org; 17 Mar 2023 11:53:50 +0000 Received: from localhost ([127.0.0.1]:43856 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pd8eb-0007J7-Hw for submit@debbugs.gnu.org; Fri, 17 Mar 2023 07:53:49 -0400 Received: from eggs.gnu.org ([209.51.188.92]:56962) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pd8ea-0007Iv-9x for 61483-done@debbugs.gnu.org; Fri, 17 Mar 2023 07:53:48 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pd8eS-00081r-KB; Fri, 17 Mar 2023 07:53:41 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-Version:In-Reply-To:Date:References:Subject:To: From; bh=vt3Nxt+hCW2h8a7skd+WPH7PQ2zo6DrEqdibeV9a0VQ=; b=i9iNFvsslvyZWGtq0tm1 GVmD0RZ9bG6NEFu4jXgdNNQIkcIt4ULxeK4/8zV4trqSFVyenqOkc0KpyM8zKFqmoBRIYpKLDsetm uE9SUYcViAasO6hh628z3eMtJPGHFXhT7YPtXauGTdsAFxK1DmjsoHjex17PnY8afGg/3rQL679QV uMrZNKTByDAs8DLyfXf40El0jO9vIEBmYX/+vdBKLaNSKdQVcGkjLaV+3r1IAxe4Tb+eqyg791fJY nnlZJeG4WzfOO9PsxuuMoSDPiInXZRk/HF1hMMZsVZBLT0pJHy31PVWf2kNjXifB2JQ1ZQUuNRFS1 slHIz5AEXBrKww==; Received: from 2a02-a462-da03-1-2701-7f81-a736-4607.fixed6.kpn.net ([2a02:a462:da03:1:2701:7f81:a736:4607] helo=drakenpad.janneke.lilypond.org) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pd8eS-00079k-5U; Fri, 17 Mar 2023 07:53:40 -0400 From: Janneke Nieuwenhuizen Organization: AvatarAcademy.nl References: <20230213164642.24419-1-janneke@gnu.org> <20230305181305.30992-1-janneke@gnu.org> <87h6ulgdu3.fsf_-_@gnu.org> <87ttykokjy.fsf@gnu.org> X-Url: http://AvatarAcademy.nl Date: Fri, 17 Mar 2023 12:53:35 +0100 In-Reply-To: <87ttykokjy.fsf@gnu.org> (Janneke Nieuwenhuizen's message of "Thu, 16 Mar 2023 15:08:49 +0100") Message-ID: <87h6ujoaps.fsf@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.2 (gnu/linux) MIME-Version: 1.0 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org X-getmail-retrieved-from-mailbox: Patches Janneke Nieuwenhuizen writes: Hi! > Ludovic Courtès writes: > > Hi, > >> Janneke Nieuwenhuizen 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" 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