all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Efraim Flashner <efraim@flashner.co.il>
To: Reza Housseini <reza.housseini@gmail.com>
Cc: help-guix@gnu.org
Subject: Re: Run a system command in home configuration file
Date: Wed, 9 Mar 2022 09:37:52 +0200	[thread overview]
Message-ID: <YihZUAZXM8lHDLBY@3900XT> (raw)
In-Reply-To: <80e75483-4c4c-31af-8192-0ce2bdd5ae23@gmail.com>

[-- Attachment #1: Type: text/plain, Size: 2012 bytes --]

On Tue, Mar 08, 2022 at 03:38:19PM +0100, Reza Housseini wrote:
> 
> On 3/8/22 11:33, Ludovic Courtès wrote:
> > Hi,
> > 
> > Reza Housseini <reza.housseini@gmail.com> skribis:
> > 
> > > 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 current
> > > implementation which does not work, probably because the command is run
> > > from the daemon, but I need it to run from the current user. Has anyone an
> > > idea how to achieve this?
> > > 
> > > (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* …) above, you could do something like:
> > 
> >    (let* ((pipe (open-input-pipe "gpgconf" …))
> >           (data (get-string-all pipe)))
> >      (close-pipe pipe)
> >      data)
> > 
> > The effect will be that ‘gpgconf’ will run when you invoke ‘guix system
> > reconfigure’, as the user who invokes it.  (You need the (ice-9 popen)
> > and (rnrs io bytevectors) modules.)
> > 
> > I can’t necessarily recommend it because it’s kinda wild, but it should
> > do the trick.
> > 
> 
> Thanks for the reply, it really looks kinda wild :)
> 
> Isn't there a general need to run certain commands for  specific user
> especially in the context of guix home?
> 

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¹.

¹ https://git.sr.ht/~efraim/guix-config/tree/master/item/efraim-home.scm#L694

-- 
Efraim Flashner   <efraim@flashner.co.il>   אפרים פלשנר
GPG key = A28B F40C 3E55 1372 662D  14F7 41AA E7DC CA3D 8351
Confidentiality cannot be guaranteed on emails sent or received unencrypted

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

      reply	other threads:[~2022-03-09  7:41 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-25 10:08 Run a system command in home configuration file Reza Housseini
2022-03-08 10:33 ` Ludovic Courtès
2022-03-08 14:38   ` Reza Housseini
2022-03-09  7:37     ` Efraim Flashner [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=YihZUAZXM8lHDLBY@3900XT \
    --to=efraim@flashner.co.il \
    --cc=help-guix@gnu.org \
    --cc=reza.housseini@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/guix.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.