From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp11.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id oNoWD3dqJ2KgcQAAgWs5BA (envelope-from ) for ; Tue, 08 Mar 2022 15:38:47 +0100 Received: from aspmx1.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp11.migadu.com with LMTPS id wCp8DHdqJ2IzRwEA9RJhRA (envelope-from ) for ; Tue, 08 Mar 2022 15:38:47 +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 BDD953EBD8 for ; Tue, 8 Mar 2022 15:38:46 +0100 (CET) Received: from localhost ([::1]:35574 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nRaz7-0006zE-Vd for larch@yhetil.org; Tue, 08 Mar 2022 09:38:45 -0500 Received: from eggs.gnu.org ([209.51.188.92]:59500) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nRayn-0006ya-25 for help-guix@gnu.org; Tue, 08 Mar 2022 09:38:25 -0500 Received: from [2a00:1450:4864:20::636] (port=37712 helo=mail-ej1-x636.google.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nRayl-0005YM-HY; Tue, 08 Mar 2022 09:38:24 -0500 Received: by mail-ej1-x636.google.com with SMTP id bg10so39738039ejb.4; Tue, 08 Mar 2022 06:38:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=message-id:date:mime-version:user-agent:subject:content-language:to :cc:references:from:in-reply-to:content-transfer-encoding; bh=Bfqge+hpp04eOl+F85ZpNDvtbSIR4sqEVBcnfgJ8Xv4=; b=ogaZYqogUPNGUZbTi7Zg8in3PtIWGHWUHXhnvOwpjD+6RjCe8B9e3wmFHBGjY+CDOy LUyfRqlLSO9imv01CRUh6rMNPHhG04XYaUrEYHwgZInz+bFu5vpnhaaTXDSs587dzKdp 4ivp0PykrvFj7g1ZB21YtfarbWsVTYbP4X/SLbOektv9UZzUINXYEdUq8MbKaF8o384s 3uOHJrZQ91k/j5W4Zd8t8GvVzb7pmAWIx82CTZz4kJBvMRk9uijvoH4kJKjKjngCDI46 mpjI0mTcn+ld0zAv4pAJw0dGxDp437RthKjqSnTLROBvYWSSie77LQhm30DwLlw0eZZ1 vt7A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:message-id:date:mime-version:user-agent:subject :content-language:to:cc:references:from:in-reply-to :content-transfer-encoding; bh=Bfqge+hpp04eOl+F85ZpNDvtbSIR4sqEVBcnfgJ8Xv4=; b=Da7anteUsy1RnwYWovhqWv9ylDFFa8dRplv6pejka8ObupFzGA4uH3Zt8qfp8k6yku tB7yZtxkA6ef792liRIJ908H9DXMV9gQTzjflz3jyhr7wSCLEHOxOhAnl0f/vXKA6wJg NDTVz/SwqyUZ5Y1A6W2bYlFYeen0ssM/63CcoXnO97xs9iFQbB7cLH572dTMXqztS4KK mYtP0eowk3zmyfhMpNbUdN4adkl0EYLmPSBWqhObkf5Kz+OqWbqPwK9rgoaAucbBM7XI 0RFJOIOIaJ6KEdPlGg0d7w0NZ4o04sCaH7al8Up8DUd+/IILptWgm/kam6gc+DUQVkwD jV7Q== X-Gm-Message-State: AOAM532tJ/lZTa/lZOO45POJ5OfUFBwwmk5/+26t77CWjfuils5/xgUx BTaXQ0BH1BDvs/nnydrSwSISfLUZf2fAd1VQ X-Google-Smtp-Source: ABdhPJyrZ0FIW4wuMSLOnnpg8/0oL/wCL94TmdML479BtCA/SGnHeWRjXLNSU7tyYiXBTFRvN7sMsw== X-Received: by 2002:a17:907:7b86:b0:6da:8a95:35bf with SMTP id ne6-20020a1709077b8600b006da8a9535bfmr13286872ejc.652.1646750301040; Tue, 08 Mar 2022 06:38:21 -0800 (PST) Received: from [152.96.218.75] ([152.96.218.75]) by smtp.gmail.com with ESMTPSA id u19-20020aa7d893000000b00415a0f25f33sm7719606edq.34.2022.03.08.06.38.20 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 08 Mar 2022 06:38:20 -0800 (PST) Message-ID: <80e75483-4c4c-31af-8192-0ce2bdd5ae23@gmail.com> Date: Tue, 8 Mar 2022 15:38:19 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.6.1 Subject: Re: Run a system command in home configuration file Content-Language: en-US To: =?UTF-8?Q?Ludovic_Court=c3=a8s?= References: <87bkyg7mz6.fsf@gnu.org> From: Reza Housseini In-Reply-To: <87bkyg7mz6.fsf@gnu.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Host-Lookup-Failed: Reverse DNS lookup failed for 2a00:1450:4864:20::636 (failed) Received-SPF: pass client-ip=2a00:1450:4864:20::636; envelope-from=reza.housseini@gmail.com; helo=mail-ej1-x636.google.com X-Spam_score_int: -6 X-Spam_score: -0.7 X-Spam_bar: / X-Spam_report: (-0.7 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, NICE_REPLY_A=-0.001, PDS_HP_HELO_NORDNS=0.659, RCVD_IN_DNSWL_NONE=-0.0001, RDNS_NONE=0.793, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=no 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=1646750326; 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: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post:dkim-signature; bh=Bfqge+hpp04eOl+F85ZpNDvtbSIR4sqEVBcnfgJ8Xv4=; b=QugyqKRPk0r4a4KWiyoDd/CYNkfxreckch7k0WwF6K8fUCviOiP+OY/JVCCmgU1YgbcBVc 2rkqT0M2OFchhcYT7HVi2GQb1FZq1w2m//XafISKbXJkU494TprLOqX/f5bDT1uKPfOepu xV7VB2pbdszPbtAFhzYejVQEF+9xfLUwpqmgmRLcwu0hRTbazvt2tmD2IoMqBuXX+FtiLu L0uipqahRxS43wgNOZg6T6GtH0jA/5O/kacGdNJfewp5hK7ICMro0pJW931qsul7EcNxhX eEnQe5MUlW1gcor6SHykYpFlBATVGd33gAYwpWz3NoD97YrFw03DoIT48Y6Bbg== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1646750326; a=rsa-sha256; cv=none; b=QBHFaz6voMMFwUBKlspiJVzhtahZHsunUyNOa7tIZHnebX95fK0ngmUsse7DxADkD3CXQ/ 1itPM3Jq/ZnUXjEWdbPFLMd6mVgfLhh9I+hifRS+xR6g6jAnMRYPZ913JIOzYNDjWFMWLM EAJ2/m0o+iCvqlkeSsNtpIjgPKW+eVXT8FPGFLvwsdF1vW9gqoDFX4J1YKAH5nKL5dRs1T f5KFvrfJ0y3FC8DUussvfo50sSkx+Hb4sPUvCuPUT8walU9BynXGalfatZejOc41in4oa5 Hl90R+bMPmbnT+IHjJCF9AxKlWH+4rc5hS8aXubJ9LkoTigjf0XTqooXNBa1oQ== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=ogaZYqog; dmarc=pass (policy=none) header.from=gmail.com; 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: -4.22 Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=ogaZYqog; dmarc=pass (policy=none) header.from=gmail.com; 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: BDD953EBD8 X-Spam-Score: -4.22 X-Migadu-Scanner: scn1.migadu.com X-TUID: Zk3eRvyleBsj On 3/8/22 11:33, Ludovic Courtès wrote: > Hi, > > Reza Housseini 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