From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp2 ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id MKbXASFWPmE6XgEAgWs5BA (envelope-from ) for ; Sun, 12 Sep 2021 21:33:53 +0200 Received: from aspmx1.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp2 with LMTPS id oNUAOSBWPmENEQAAB5/wlQ (envelope-from ) for ; Sun, 12 Sep 2021 19:33:52 +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 14AF819570 for ; Sun, 12 Sep 2021 21:33:52 +0200 (CEST) Received: from localhost ([::1]:50432 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mPVEd-0001vx-5H for larch@yhetil.org; Sun, 12 Sep 2021 15:33:51 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:38874) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mPVEO-0001r4-CI for guix-devel@gnu.org; Sun, 12 Sep 2021 15:33:37 -0400 Received: from out1.migadu.com ([91.121.223.63]:31086) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mPVEL-0003g9-Fx for guix-devel@gnu.org; Sun, 12 Sep 2021 15:33:36 -0400 X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mgsn.dev; s=key1; t=1631475209; h=from:from: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; bh=m+go6qHlYI/54Bm/pIixVTbztC3t0GLkBDaQnCKWsgk=; b=k+XUtVBXchEpB23Lb5Q9610pifZBKAcNlR/4e/Kg73A/YRaBW5SQIP1DXxcuilOEGRKYgF k6QJwGhNOYVJlnv2u+bRM/g5YauEtp1DJ6VDw1hOxmjmZAwL1LoLbb+ubBUOgtCMbe5F9U LxtiqyDg+055Gkm2ky/BotCWDxnauWI= From: Sarah Morgensen To: Ryan Prior Subject: Re: Named environments In-Reply-To: (message from Ryan Prior on Fri, 10 Sep 2021 23:06:43 +0000) Date: Sun, 12 Sep 2021 12:33:26 -0700 Message-ID: <86zgshlhbt.fsf@mgsn.dev> MIME-Version: 1.0 Content-Type: text/plain Received-SPF: pass client-ip=91.121.223.63; envelope-from=iskarian@mgsn.dev; helo=out1.migadu.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 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, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-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-Migadu-Flow: FLOW_IN ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1631475232; 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:list-id:list-help: list-unsubscribe:list-subscribe:list-post:dkim-signature; bh=m+go6qHlYI/54Bm/pIixVTbztC3t0GLkBDaQnCKWsgk=; b=MfCs1ToeUFsGhUfPvIuHN1bxe7/HCJyjFvWE0YbQLtxwi9ZWIL+WeaxKoHsjJ+rjBz9ZCr e920AENOcMKB6ztHFmxy9Bv3+D2EVp5vl5JSSB4S/BPG3J7IMYzCOzlyCw4Na9QZeAFCI8 lY0hBDYDBAA+pGkXXf5p/FeKwHS7ifyYIfglGS8JGRf3Fm5cG3rINGm+c7H0pRicUSjH0m 1ySWOvbj9TyLZAbaMEoi/DOufnKGn40LUIe6gpvNoEbJq7fbrcOCOUOH43OJzpySrLDH5E H68tCg24nFT1Cfqptsw5M1HYUQEbYBmxyDMEv2ao3RC44mS/UMoTrU8Rk4KWrA== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1631475232; a=rsa-sha256; cv=none; b=jwuWFvU98NS07IVYJGxB0enXSs1TOHs1Im4KVY8TnDKTcSQQGgv2+s7uTxHNvYebvrACxg Ma6bvSSgkDCsq2K73L0nIEE8/8xQzt5FvpQ/KIYap07opoE2rlXe06B78NsiFWDcsdJoZ9 lOqDpiL4F+y78ftRYV5mhpSYIG2nXNK5M6h3eKPqcgBfg8oLX3on52+UIyAwN1H/CCatpC 5Au461k+BifVOOel1LpwPUCLaSJlRuFDvrPuhPnjbEClWgGVoJchiAT9veErLGYM547HcX fx6BofjPPTC84pm1JcrYmkCDqCi4mLueRK6CXwwQQfDLEo53I8gXjKxEy1Dk2w== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=mgsn.dev header.s=key1 header.b=k+XUtVBX; dmarc=pass (policy=none) header.from=mgsn.dev; 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-Migadu-Spam-Score: -1.61 Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=mgsn.dev header.s=key1 header.b=k+XUtVBX; dmarc=pass (policy=none) header.from=mgsn.dev; 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-Migadu-Queue-Id: 14AF819570 X-Spam-Score: -1.61 X-Migadu-Scanner: scn0.migadu.com X-TUID: JTRr67Qstox9 Ryan Prior writes: > Hey Guix. > > I've been thinking lately it would be convenient to create certain uniquely > named execution environments on my machine. For example, I might have one > set up with dependencies for my Python webapp & environment variables set to > autoconnect to a Postgres server. I might have another that's got test > dependencies and is containerized, such that it can only access the network > & not the rest of my filesystem. Suppose I name these two "webapp" and > "test" respectively. > > I picture running eg `guix env @webapp -- uvicorn main:app` to start my > server, then `guix env @test -- pytest` to run my tests. > > I might write a wrapper in some scripting language that sets up this kind of > system. Would anybody else be interested in using such a thing? Would it > make sense to integrate this capability into Guix itself? > >Ryan I like this idea! (And adding a built-in alias from "environment" to "env" might be worth it, too.) I actually use an ad-hoc version of this in my ~/.bashrc, using aliases. For example, alias geg='guix environment guix --pure --ad-hoc nano git git:send-email less help2man strace nss-certs' This also lets me add on any ad-hoc packages at the end, like geg dejagnu expect However, an actual `guix env' could do a lot more! Like you allude to, being able to essentially save the options of a `guix environment' invocation would be great: $ guix env --edit @test $ guix env @test -- pytest But also imagine portable environments (used, for example, for project dev environments, checked in with the source): --8<---------------cut here---------------start------------->8--- $ guix env --export @myapp-test --pure -C -f guix.scm --ad-hoc strace coreutils (environment "@myapp-test" (load '("guix.scm")) (ad-hoc-packages '("strace" "coreutils" "findutils")) (flags '(pure container))) --8<---------------cut here---------------end--------------->8--- Of course, this isn't entirely reproducible, as packages could change as you update your Guix, even if you give a version spec (the same issue that exists for manifests). So, we could pin the channel used to make the environment: --8<---------------cut here---------------start------------->8--- $ guix env --export @myapp-test --pin-channels ... (environment "@myapp-test" (channels (list (channel (name 'guix) (url ...) (commit ...))) (load '("guix.scm")) (ad-hoc-packages '("strace" "coreutils" "findutils")) (flags '(pure container)))) --8<---------------cut here---------------end--------------->8--- which, when evaluated, would internally do what `guix time-machine --channels file' does. These environments could then be used like: $ guix env -e environment.scm @myapp-test but that's quite long... perhaps we could allow `guix env' to automatically read a "guix.scm" or "environment.scm" file in the current directory, and make the environment definitions within available? ...so I definitely think there's room for such a feature in Guix :) -- Sarah