From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp0 ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id 0/xNKP8JP2EmGwEAgWs5BA (envelope-from ) for ; Mon, 13 Sep 2021 10:21:19 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp0 with LMTPS id SNNrI/8JP2G5UQAA1q6Kng (envelope-from ) for ; Mon, 13 Sep 2021 08:21: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 6894514368 for ; Mon, 13 Sep 2021 10:21:19 +0200 (CEST) Received: from localhost ([::1]:51580 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mPhDJ-0006to-CF for larch@yhetil.org; Mon, 13 Sep 2021 04:21:18 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:53568) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mPhC6-0006si-4f for guix-devel@gnu.org; Mon, 13 Sep 2021 04:20:02 -0400 Received: from mail-wm1-x32e.google.com ([2a00:1450:4864:20::32e]:55911) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mPhC3-0005VO-Qj for guix-devel@gnu.org; Mon, 13 Sep 2021 04:20:01 -0400 Received: by mail-wm1-x32e.google.com with SMTP id g128so1532735wma.5 for ; Mon, 13 Sep 2021 01:19:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:in-reply-to:references:date:message-id :mime-version:content-transfer-encoding; bh=cbJiRd3ZO8EVxJ2EJl4OQZhMWO2y4rYrueNtGchfQTU=; b=pTN96QbGiH4ClWyCDOETkwqBn0xSaCy498pPVbj+hSkVK/zbzyMW5PrTSI+ctTjLBH rY/CpNA07KEcyNJ1hCKbiAYExoiz3TdqKVap8qxSfebu8eRFEJ7gkixfKUI8cOFrbCaM 8KGYnc6IzH19GYbDMIApuo6qYySRuK0kUYjIgOOZaJTHFSRL1i/VIRdcNspYqaVk6jnA oGXmExyQP2c51TCP11YADjG6XZsJQa8M7JEDqFY/3Qd7xw0H3Nyi/5+kpaKtVCOHv+ff WBgdbvMNLKp29RYda/kRkMPgY1T0ItnHC6cX2V5EeRm0eUW15JOro5IPRyqAzTyvgB44 rDMg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:in-reply-to:references:date :message-id:mime-version:content-transfer-encoding; bh=cbJiRd3ZO8EVxJ2EJl4OQZhMWO2y4rYrueNtGchfQTU=; b=N41UkRyjGBZ2qo963tat7pmT5Q3s7XOvYu3+NT4txlMTGzCL4VaSl70h4zUldEn2tN 8TeS2XckDG/yP4sDMaxHGMT0f2Fhi2pZVOGkQxtge7k89rtDjA8G+7LJg/4tAsJ+bL7h LML3Tr44lnwYNESlm4I7/pYCRefDAx3jE7AgAXqwtPagMuOEhVeq9VXJbIPDtppX8Z2e jqApozHkovsHIqZuLNQTe3aYSkhsjjwKf1xm0GlaGQjZ7VPSUuDIdJRPatQ4pGy7NGSj LEU0EctZHDqw9TfFHrxj12o1l7Bqm+E+p8u7wUSHr0sbyT7ToluuYZAqDDZUMEtqCroe o9ug== X-Gm-Message-State: AOAM53243FqDIOKUovVHtviGzAt0EZs7/1RTJFZYh2SxCkVXZnIHDANT RoVqT+INIyxeuWyGRnjapLJp72RqOvE= X-Google-Smtp-Source: ABdhPJzJijDnSzGgtsWASO8Ry5XYJwyvTN2A/JrspszwtLj9mU4p717JIV3rlTpArznBXA1pwJdqEA== X-Received: by 2002:a7b:cb44:: with SMTP id v4mr9833631wmj.169.1631521196107; Mon, 13 Sep 2021 01:19:56 -0700 (PDT) Received: from lili ([2a01:e0a:59b:9120:65d2:2476:f637:db1e]) by smtp.gmail.com with ESMTPSA id g13sm4738767wmh.20.2021.09.13.01.19.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 13 Sep 2021 01:19:55 -0700 (PDT) From: zimoun To: Sarah Morgensen , Ryan Prior Subject: Re: Named environments In-Reply-To: <86zgshlhbt.fsf@mgsn.dev> References: <86zgshlhbt.fsf@mgsn.dev> Date: Mon, 13 Sep 2021 10:08:14 +0200 Message-ID: <8635q8x5ht.fsf@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Received-SPF: pass client-ip=2a00:1450:4864:20::32e; envelope-from=zimon.toutoune@gmail.com; helo=mail-wm1-x32e.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 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, RCVD_IN_DNSWL_NONE=-0.0001, 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 X-Migadu-Spam-Score: -4.00 Authentication-Results: aspmx1.migadu.com; none X-Migadu-Queue-Id: 6894514368 X-Spam-Score: -4.00 X-Migadu-Scanner: scn0.migadu.com X-TUID: RtK1rcAXJgPE Hi, On Sun, 12 Sep 2021 at 12:33, Sarah Morgensen wrote: > Ryan Prior writes: >> I've been thinking lately it would be convenient to create certain uniqu= ely >> named execution environments on my machine. For example, I might have one >> set up with dependencies for my Python webapp & environment variables se= t 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 netw= ork >> & 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 kin= d of >> system. Would anybody else be interested in using such a thing? Would it >> make sense to integrate this capability into Guix itself? > > I like this idea! (And adding a built-in alias from "environment" to "en= v" > might be worth it, too.) > > I actually use an ad-hoc version of this in my ~/.bashrc, using aliases. = For > example, > > alias geg=3D'guix environment guix --pure --ad-hoc nano git git:send-em= ail less help2man strace nss-certs' > > This also lets me add on any ad-hoc packages at the end, like > > geg dejagnu expect You might be interested by GUIX_EXTENSIONS_PATH which is somehow documented by this thread: :-) It is a not-enough known feature but really handy to: 1) define your own flavour, e.g., =E2=80=9Cguix env --options you --like= =E2=80=9C 2) experiment for a new subcommand Once a subcommand is in Guix, it is really hard to make a CLI change so it seems better to experiment before, IMHO. :-) For an instance of this last claim: . > 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 cor= eutils > > (environment "@myapp-test" > (load '("guix.scm")) > (ad-hoc-packages '("strace" "coreutils" "findutils")) > (flags '(pure container))) > --8<---------------cut here---------------end--------------->8--- This kind of ideas is exposed here: or here and there: Thanks for the revival. :-) > 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 ex= ists > for manifests). So, we could pin the channel used to make the environmen= t: > > --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 --chan= nels > file' does. I think the correct workflow is: $ guix describe -f channels > channels.scm $ guix time-machine -C channels.scm -- subcommand --options All the best, simon