From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp0 ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms11 with LMTPS id wDorIPeCol9DAwAA0tVLHw (envelope-from ) for ; Wed, 04 Nov 2020 10:31:19 +0000 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp0 with LMTPS id IPgMHPeCol9REwAA1q6Kng (envelope-from ) for ; Wed, 04 Nov 2020 10:31:19 +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 44ECD9401BD for ; Wed, 4 Nov 2020 10:31:19 +0000 (UTC) Received: from localhost ([::1]:41306 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kaG4U-0002qh-8j for larch@yhetil.org; Wed, 04 Nov 2020 05:31:18 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:41026) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kaFxZ-00051n-QU for guix-devel@gnu.org; Wed, 04 Nov 2020 05:24:09 -0500 Received: from mailrelay.tugraz.at ([129.27.2.202]:29914) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kaFxW-0002MW-CO for guix-devel@gnu.org; Wed, 04 Nov 2020 05:24:08 -0500 Received: from nijino.local (217-149-162-161.nat.highway.telekom.at [217.149.162.161]) by mailrelay.tugraz.at (Postfix) with ESMTPSA id 4CR2nD0Hjmz1LWpg; Wed, 4 Nov 2020 11:23:59 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 mailrelay.tugraz.at 4CR2nD0Hjmz1LWpg DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tugraz.at; s=mailrelay; t=1604485440; bh=Bv5hQvQhFvVUFhV6yZNtmxyAlJ/4WjSSRUUCkiKjZNE=; h=Subject:From:To:Cc:Date:In-Reply-To:References:From; b=cJ0fvE39TTOs0wYXE+wLMHpAYreewH5BxtQ98GRmShN9i2y838HqbsMhuslaipR4Z GfvXkIawhJHgxzc3JS/OBOXzMwNL0Wur945Td0P11omX0wSLam6GFSNPsLjK5Nkhj5 NaM+ictiwJ6tzN6664ib5tMRi6ltdBrAS/JK8f7Q= Message-ID: <42ddcb59882ded6c18da226c56bec7e6e224801a.camel@student.tugraz.at> Subject: Re: A public Lisp programming interface provide feature like `guix environment --container` From: Leo Prikler To: Zhu Zihao Date: Wed, 04 Nov 2020 11:23:59 +0100 In-Reply-To: <864km55teh.fsf@163.com> References: <33db285c56516bac910112344b7c9766221bdaf3.camel@student.tugraz.at> <864km55teh.fsf@163.com> Content-Type: text/plain; charset="UTF-8" User-Agent: Evolution 3.34.2 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-TUG-Backscatter-control: bt4lQm5Tva3SBgCuw0EnZw X-Spam-Scanner: SpamAssassin 3.003001 X-Spam-Score-relay: -1.9 X-Scanned-By: MIMEDefang 2.74 on 129.27.10.117 Received-SPF: pass client-ip=129.27.2.202; envelope-from=leo.prikler@student.tugraz.at; helo=mailrelay.tugraz.at X-detected-operating-system: by eggs.gnu.org: First seen = 2020/11/04 04:45:09 X-ACL-Warn: Detected OS = Linux 3.11 and newer [fuzzy] X-Spam_score_int: -42 X-Spam_score: -4.3 X-Spam_bar: ---- X-Spam_report: (-4.3 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: guix-devel@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "Development of GNU Guix and the GNU System distribution." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: guix-devel@gnu.org Errors-To: guix-devel-bounces+larch=yhetil.org@gnu.org Sender: "Guix-devel" X-Scanner: ns3122888.ip-94-23-21.eu Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=tugraz.at header.s=mailrelay header.b=cJ0fvE39; dmarc=pass (policy=none) header.from=student.tugraz.at; spf=pass (aspmx1.migadu.com: domain of guix-devel-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=guix-devel-bounces@gnu.org X-Spam-Score: -0.21 X-TUID: XK7b8wVH4r1S Am Mittwoch, den 04.11.2020, 18:05 +0800 schrieb Zhu Zihao: > Leo Prikler writes: > > > launch-environment/container still assumes the command to be a > > shell > > script, which I think is not quite what you want. You probably > > want to > > take a look at call-with-container from (guix build linux- > > container) or > > child-hurds. > > I just read the source code of call-with-container. IMO, it just run > code in container, without any settings. It's quite inconvenient for > my > usage. For example: I have to setup mount binding of my package > closure manually. Indeed, but in my opinion it also has much of what you'd want for an entry script, does it not? You start with zero settings, then configure the environment in whichever fashion you need, then call some other function. I think like this could be a stepping stone for some higher level abstraction, that you would have to write on your own once, but could then reuse more or less indefinitely. Particularly, you would have to copy the parts of Guix that create the environment and then just figure out how to securely spawn a function inside it, that can't escape the container environment, instead of running shell code. > > I currently don't know of any procedure, that "directly" invokes > > Scheme > > code through Guix environments, so you'd have to build that on your > > own. However, given that your stated goal is to port container > > entry > > scripts [I read this as "the script called by the container at > > entry"] > > to Guile, would it not make sense to have > > > > (guix-environment [ENVIRONMENT OPTIONS] "--" "guile" "entry.scm") > > > > WDYT? > > > > Regards, Leo > > Hmmm, maybe this is the solution, tho it's not very very elegant. For the record, what you do want is something à la (call-in-container-environment THUNK MANIFEST . KWARGS) where manifest is the Guix environment manifest, THUNK is a procedure to call with 0 arguments and KWARGS is a list of options for things you might want to set up, e.g. just the GUIX_ENVIRONMENT variable or more than that. Is that about right? Regards, Leo