From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp2 ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms11 with LMTPS id AP3qDWHbkl9/QAAA0tVLHw (envelope-from ) for ; Fri, 23 Oct 2020 13:32:17 +0000 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp2 with LMTPS id gNQ0CGHbkl+/fwAAB5/wlQ (envelope-from ) for ; Fri, 23 Oct 2020 13:32:17 +0000 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 00EA994043B for ; Fri, 23 Oct 2020 13:32:15 +0000 (UTC) Received: from localhost ([::1]:56326 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kVxAz-0008IR-WB for larch@yhetil.org; Fri, 23 Oct 2020 09:32:14 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:56112) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kVxAo-0008I5-RZ for guix-patches@gnu.org; Fri, 23 Oct 2020 09:32:02 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:44826) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kVxAo-0002bZ-Gz for guix-patches@gnu.org; Fri, 23 Oct 2020 09:32:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1kVxAo-0005zn-Cf for guix-patches@gnu.org; Fri, 23 Oct 2020 09:32:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#43921] [PATCH v3 2/2] Add User Service example. Resent-From: Ludovic =?UTF-8?Q?Court=C3=A8s?= Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Fri, 23 Oct 2020 13:32:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 43921 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: "Jan (janneke) Nieuwenhuizen" Cc: 43921@debbugs.gnu.org, Efraim Flashner Received: via spool by 43921-submit@debbugs.gnu.org id=B43921.160345990021989 (code B ref 43921); Fri, 23 Oct 2020 13:32:02 +0000 Received: (at 43921) by debbugs.gnu.org; 23 Oct 2020 13:31:40 +0000 Received: from localhost ([127.0.0.1]:56372 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kVxAS-0005iH-Bb for submit@debbugs.gnu.org; Fri, 23 Oct 2020 09:31:40 -0400 Received: from eggs.gnu.org ([209.51.188.92]:55922) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kVxAP-0005cD-1r for 43921@debbugs.gnu.org; Fri, 23 Oct 2020 09:31:39 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]:49549) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kVxAH-0002aF-UG; Fri, 23 Oct 2020 09:31:29 -0400 Received: from [2a01:e0a:1d:7270:af76:b9b:ca24:c465] (port=55398 helo=ribbon) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1kVxAH-0007Fx-A6; Fri, 23 Oct 2020 09:31:29 -0400 From: Ludovic =?UTF-8?Q?Court=C3=A8s?= References: <874kn1rtgn.fsf@gnu.org> <20201012051536.1609-1-janneke@gnu.org> Date: Fri, 23 Oct 2020 15:31:27 +0200 In-Reply-To: <20201012051536.1609-1-janneke@gnu.org> (Jan Nieuwenhuizen's message of "Mon, 12 Oct 2020 07:15:36 +0200") Message-ID: <87h7qlnk5s.fsf@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -2.3 (--) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-Spam-Score: -3.3 (---) X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+larch=yhetil.org@gnu.org Sender: "Guix-patches" X-Scanner: scn0 Authentication-Results: aspmx1.migadu.com; dkim=none; dmarc=pass (policy=none) header.from=gnu.org; spf=pass (aspmx1.migadu.com: domain of guix-patches-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=guix-patches-bounces@gnu.org X-Spam-Score: -1.51 X-TUID: eSVjIc77FKxH Hello! "Jan (janneke) Nieuwenhuizen" skribis: > * modules/shepherd/support.scm: Export %user-cache-dir, %user-config-dir, > %user-runtime-dir. > * doc/shepherd.texi (User Service examples): Use them in new subsection w= ith > example. > > Co-authored-by: Efraim Flashner Good idea! > +@menu > +* User Service examples:: > +@end menu > + > +@node User Service examples > +@subsection User Service examples The subsection looks lonely. :-) How about making it a section, at the same level as =E2=80=9CService Examples=E2=80=9D? Also, since =E2=80=9Cuser services=E2=80=9D are no different than =E2=80=9C= non-user=E2=80=9D services, perhaps the focus should be on using the Shepherd as an unprivileged user. Thus, I=E2=80=99d suggest calling the section =E2=80=9CManaging User= Services=E2=80=9D, or =E2=80=9CRunning the Shepherd as a User=E2=80=9D, which do not imply tha= t =E2=80=9Cuser services=E2=80=9D are a new concept. WDYT? > +For starters, use a toplevel @code{$XDG_CONFIG_HOME/shepherd/init.scm} > +that looks like this: Maybe: =E2=80=9C=E2=80=A6 we suggest the following top-level @file{$XDG_CONFIG_HOME/shepherd/init.scm} file, which will automatically load individual service definitions from @file{~/.config/shepherd/init.d}:=E2=80=9D > +@lisp > +;;; Commentary: > +;;; > +;;; Add to your ~/.bash_profile: > +;;; > +;;; if [[ ! -S ${XDG_RUNTIME_DIR-$HOME/.cache}/shepherd/socket ]]; then > +;;; shepherd > +;;; fi Maybe make it a paragraph in the text, above the =E2=80=98init.scm=E2=80=99= example: First, to use the Shepherd as an unprivileged user, you may want to ensure it is up and running every time you log in. One way to accomplish that is by adding the following lines to @file{~/.bashrc} (@pxref{Bash Startup Files,,, bash, The GNU Bash Reference Manual}): =E2=80=A6 > +Then, individual user services can be put in > +@code{$XDG_CONFIG_HOME/shepherd/init.d/}, e.g., for ssh-agent @command{ssh-agent} and period. :-) > +@lisp > +;;; Commentary: > +;;; > +;;; Add to your ~/.bash_profile: > +;;; > +;;; SSH_AUTH_SOCK=3D${XDG_RUNTIME_DIR-$HOME/.cache}/ssh-agent/socket > +;;; export SSH_AUTH_SOCK > +;;; > +;;; Code: > + > +(use-modules (shepherd support)) > + > +(define ssh-agent > + (make > + #:provides '(ssh-agent) > + #:docstring "Run `ssh-agent'" > + #:start (let ((socket-dir (string-append %user-runtime-dir "/ssh-age= nt"))) > + (unless (file-exists? socket-dir) > + (mkdir-p socket-dir) > + (chmod socket-dir #o700)) > + (make-forkexec-constructor > + `("ssh-agent" "-D" "-a" ,(string-append socket-dir "/sock= et")) > + #:log-file (string-append %user-cache-dir "/ssh-agent.log= "))) This is misleading because the code to create the socket directory runs from the top-level, i.e., when shepherd starts. I=E2=80=99d write: #:start (lambda () ;; make socket dir (fork+exec-command =E2=80=A6 #:log-file =E2=80=A6)) (BTW, I use =E2=80=98gnupg-agent=E2=80=99, which I think is pretty nice bec= ause it=E2=80=99s integrated with pinentry and all. I run it as: eval `gpg-agent --daemon --enable-ssh-support` =E2=80=A6 from ~/.xsession.) Thanks, Ludo=E2=80=99.