From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp12.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id eK8uJyhaKGLYMwAAgWs5BA (envelope-from ) for ; Wed, 09 Mar 2022 08:41:28 +0100 Received: from aspmx1.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp12.migadu.com with LMTPS id cLEyJChaKGJtTgAAauVa8A (envelope-from ) for ; Wed, 09 Mar 2022 08:41:28 +0100 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 1E60D20971 for ; Wed, 9 Mar 2022 08:41:28 +0100 (CET) Received: from localhost ([::1]:52564 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nRqwo-0002C5-Dx for larch@yhetil.org; Wed, 09 Mar 2022 02:41:26 -0500 Received: from eggs.gnu.org ([209.51.188.92]:41462) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nRqwE-0002Bt-Nn for help-guix@gnu.org; Wed, 09 Mar 2022 02:40:50 -0500 Received: from flashner.co.il ([178.62.234.194]:48224) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nRqw9-0002w8-2f; Wed, 09 Mar 2022 02:40:46 -0500 Received: from localhost (unknown [31.210.181.166]) by flashner.co.il (Postfix) with ESMTPSA id 23E20404EF; Wed, 9 Mar 2022 07:40:42 +0000 (UTC) Date: Wed, 9 Mar 2022 09:37:52 +0200 From: Efraim Flashner To: Reza Housseini Subject: Re: Run a system command in home configuration file Message-ID: Mail-Followup-To: Reza Housseini , Ludovic =?utf-8?Q?Court=C3=A8s?= , help-guix@gnu.org References: <87bkyg7mz6.fsf@gnu.org> <80e75483-4c4c-31af-8192-0ce2bdd5ae23@gmail.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="oVXU32Zy48GltjRm" Content-Disposition: inline In-Reply-To: <80e75483-4c4c-31af-8192-0ce2bdd5ae23@gmail.com> X-PGP-Key-ID: 0x41AAE7DCCA3D8351 X-PGP-Key: https://flashner.co.il/~efraim/efraim_flashner.asc X-PGP-Fingerprint: A28B F40C 3E55 1372 662D 14F7 41AA E7DC CA3D 8351 Received-SPF: pass client-ip=178.62.234.194; envelope-from=efraim@flashner.co.il; helo=flashner.co.il X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: help-guix@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: help-guix@gnu.org Errors-To: help-guix-bounces+larch=yhetil.org@gnu.org Sender: "Help-Guix" X-Migadu-Flow: FLOW_IN X-Migadu-Country: US ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1646811688; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post; bh=eayjlvZ+kvAVmr0N7NfscJ7g5+n53bLuCj33K21lP1s=; b=edCB4TGTPZNVPUbLqnSLYH4DISxh1hgHH3xPArR1C6TqyTFW+0cuzczqoO3Lz1N9dWK22y EbG+hOlTLFFizsA1BqveAWix2b3MKf7RzmcqNNE0SpXDSk2N0eEouExE+dK9Pxzkti4nUm Q2YXB2+cJ1XgEoKhagEEGy3xXJlwXb79h0/bD+2M7DniO6EMXnBD1/ovJepFOFrtm44ARc oVoKmt9GLDFcl+H85GblW9h35TB+h6jt6tSpMnWfntxzQONRLlwgCnf2iblxn5tIzGV+CQ GFnllcD1HxE3SW+6kGDfbYg0PG+EIWAI80Io5gwBNZfU2qMM0B2849iCjoQYmQ== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1646811688; a=rsa-sha256; cv=none; b=EyN1jXSWncNRVBk20tWB7qHqxjPipnMxzbpI7ZEBYJzIIkYcBcaUJz9xRlt9Pql7ii/nPR YDRlgmbh2cc5244OpW+4izajtINgx9cX7V9Dvw5Kmlrti1y1hzBIbIOekp+H9ZYPpnnXM4 WaAj7VvIR5dq3mehw/Ea7zDgtAmppykJFrMl/AD9OIWC/jUKup5kQGo3CfXvISyC3l+K8a vSLDV5XN4aLpMcrgfEB5kfq2AI7Ku4kEi0RPQkgQIPSE56qmXf8PSFCDsui+PP38wi7VIw 42zGKFUM2nFDy2JarPUnqEVk2YlAisu9+92lRzy2p2yvF/x4FJuSeHMK8ewNEw== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=none; dmarc=none; spf=pass (aspmx1.migadu.com: domain of "help-guix-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="help-guix-bounces+larch=yhetil.org@gnu.org" X-Migadu-Spam-Score: -5.72 Authentication-Results: aspmx1.migadu.com; dkim=none; dmarc=none; spf=pass (aspmx1.migadu.com: domain of "help-guix-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="help-guix-bounces+larch=yhetil.org@gnu.org" X-Migadu-Queue-Id: 1E60D20971 X-Spam-Score: -5.72 X-Migadu-Scanner: scn0.migadu.com X-TUID: UF1WdbdBbZON --oVXU32Zy48GltjRm Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Tue, Mar 08, 2022 at 03:38:19PM +0100, Reza Housseini wrote: >=20 > On 3/8/22 11:33, Ludovic Court=C3=A8s wrote: > > Hi, > >=20 > > Reza Housseini skribis: > >=20 > > > I want to run a system command and use the output inside my ssh config > > > file. Below is the service configuration I'm talking about and my cur= rent > > > implementation which does not work, probably because the command is r= un > > > from the daemon, but I need it to run from the current user. Has anyo= ne an > > > idea how to achieve this? > > >=20 > > > (simple-service 'ssh-config > > > home-files-service-type > > > (list `("ssh/config" > > > ,(mixed-text-file "config" " > > > Host * > > > IdentityAgent " #~(system* #$(file-append gnupg "/bin/gpgconf") > > > "--list-dirs" "agent-ssh-socket")" > > > ")))) > > Instead of #~(system* =E2=80=A6) above, you could do something like: > >=20 > > (let* ((pipe (open-input-pipe "gpgconf" =E2=80=A6)) > > (data (get-string-all pipe))) > > (close-pipe pipe) > > data) > >=20 > > The effect will be that =E2=80=98gpgconf=E2=80=99 will run when you inv= oke =E2=80=98guix system > > reconfigure=E2=80=99, as the user who invokes it. (You need the (ice-9= popen) > > and (rnrs io bytevectors) modules.) > >=20 > > I can=E2=80=99t necessarily recommend it because it=E2=80=99s kinda wil= d, but it should > > do the trick. > >=20 >=20 > Thanks for the reply, it really looks kinda wild :) >=20 > Isn't there a general need to run certain commands for=C2=A0 specific user > especially in the context of guix home? >=20 One option is a one-off shepherd service. For finding the SSH_AUTH_SOCKET using gpgconf I stuck with the tried and true method of setting it in .bash_profile=C2=B9. =C2=B9 https://git.sr.ht/~efraim/guix-config/tree/master/item/efraim-home.s= cm#L694 --=20 Efraim Flashner =D7=90=D7=A4=D7=A8=D7=99=D7=9D = =D7=A4=D7=9C=D7=A9=D7=A0=D7=A8 GPG key =3D A28B F40C 3E55 1372 662D 14F7 41AA E7DC CA3D 8351 Confidentiality cannot be guaranteed on emails sent or received unencrypted --oVXU32Zy48GltjRm Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEoov0DD5VE3JmLRT3Qarn3Mo9g1EFAmIoWUwACgkQQarn3Mo9 g1Enow//QgDAhB+KTcTuJ8a2I6NoS8UNGfhZWmJqRBj9csOQ//URifGObLbG9csS QrK/836O880X9Lpwl6UPue3Vx7csjXgWU9F6Pi6qfhw07KCAgQ3Xy3LjJWZ2lqtP BO5XjTumqyvnHqRhn7eOMCEzVH+Pd3cBrirGZHivy1lhYt7UBV8PDhf6XFQAShzM tGq1pQZUq+0KmNmfLT77GxMbqJiZhuynb9BcR4z/XnKc+zAkbz4+YDixDPVo1umM 48SdbIHg/dw4i/+4SrUh+yK3m/bQBALlR+syjwutsu7PQJ4TfUi5GZb0fqxb8s9c i7qWRPyQHxIbcsAT8/sWJjPJyzhz2FlZTVQSxXDRAkGkO/2iFNOcw3gwDoaR3mn1 SFKn+i6HL08+sT6QUL4N0JRgJXphy9oFEoVTAlRcLa43i8k8pfz8bBAokjpyboym iA4Bym4YcsxDdTgUrn/Zh4oTboRXuB2ACwCGI5W+Uu2GSoZa3KilYj7YnItvGfJg FqYZJGksOjd8T+XfIkBvzU+AZQxC0ptl+ht1Ixr72z3vLt1q/37UekoIAS432W1T 2sfFME4GxqfunV7A1PoH1H1ebTrlbzZcQRINMzFvNAntoDHQ/vxayYf91itw0bo2 ovxHtYCwWgm9EleUhAm6GtxlDbZziEtEuPsYZ/uREJ6W7Pahpe4= =cYtQ -----END PGP SIGNATURE----- --oVXU32Zy48GltjRm--