From: Reza Housseini <reza.housseini@gmail.com>
To: "Ludovic Courtès" <ludo@gnu.org>
Cc: help-guix@gnu.org
Subject: Re: Run a system command in home configuration file
Date: Tue, 8 Mar 2022 15:38:19 +0100 [thread overview]
Message-ID: <80e75483-4c4c-31af-8192-0ce2bdd5ae23@gmail.com> (raw)
In-Reply-To: <87bkyg7mz6.fsf@gnu.org>
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.
>
> HTH,
> Ludo’.
Hi Ludo
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?
Cheers,
Reza
next prev parent reply other threads:[~2022-03-08 14:38 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 [this message]
2022-03-09 7:37 ` Efraim Flashner
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=80e75483-4c4c-31af-8192-0ce2bdd5ae23@gmail.com \
--to=reza.housseini@gmail.com \
--cc=help-guix@gnu.org \
--cc=ludo@gnu.org \
/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.