From mboxrd@z Thu Jan 1 00:00:00 1970 From: Gary Johnson Subject: Re: a first question about parallel environments Date: Mon, 16 Mar 2020 17:54:04 -0400 Message-ID: <87zhcg2cg3.fsf@disroot.org> References: <2eb7ac48-65ab-46fa-95e1-808ce156749d@www.fastmail.com> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:470:142:3::10]:44411) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jDxgm-0000Bi-Ea for help-guix@gnu.org; Mon, 16 Mar 2020 17:54:26 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jDxgk-0004Ac-KG for help-guix@gnu.org; Mon, 16 Mar 2020 17:54:24 -0400 Received: from knopi.disroot.org ([178.21.23.139]:39482) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1jDxgj-0003cA-Rn for help-guix@gnu.org; Mon, 16 Mar 2020 17:54:22 -0400 Received: from localhost (localhost [127.0.0.1]) by disroot.org (Postfix) with ESMTP id 329E626B0F for ; Mon, 16 Mar 2020 22:54:19 +0100 (CET) Received: from knopi.disroot.org ([127.0.0.1]) by localhost (disroot.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id lXjai1DQ1_s8 for ; Mon, 16 Mar 2020 22:54:17 +0100 (CET) In-reply-to: <2eb7ac48-65ab-46fa-95e1-808ce156749d@www.fastmail.com> List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-guix-bounces+gcggh-help-guix=m.gmane-mx.org@gnu.org Sender: "Help-Guix" To: help-guix@gnu.org Hi Ben, Just another humble Guix user here. I can't speak to your questions about vagrant, but as far as parallel environments are concerned, you are right that Guix can handle them. The general terminology goes like so: - A user installs packages into a profile. - A user may combine packages into an environment. - A profile is a saved environment. - A user may specify which environments or profiles are active at any time. - A user has a default profile created for them automatically by Guix, into which packages are installed unless specified otherwise. Now a package is just a Scheme declaration that defines: 1. where to download the source code for a particular version of some software 2. how to patch, compile, and otherwise build it 3. some metadata like name, version, description, copyright, etc. If you want to install multiple versions of a piece of software onto your machine, you need a Scheme declaration for each version of that software. That's it. Now the trick to this is that when you pull the latest version of Guix (e.g. "guix pull"), you get the latest version of the Guix build tools as well as all of the Scheme declarations for every package supported by that version of Guix. In general, the Guix distribution only provides one version of each package. Therefore, if you want multiple versions of something, you will have to provide the Scheme declarations for the version(s) that are missing from the current Guix distribution. You can so either by adding them to a directory on your $GUIX_PACKAGE_PATH or by creating a separate channel to serve up those packages. (See the Guix info docs about channels.) For your particular situation, the easiest way to manage two sets of packages installed on the same machine is just to make two user accounts. Install one set of packages with the first user and the second set of packages with the second user. The package files are always stored in Guix's store directory (usually /gnu/store), so if both users install the same package, it only exists once under /gnu/store. However, each user's default profile will contain a set of symlinks that only point to the packages that they installed. This provides clean isolation between the different package versions without wasting disk space. Messing directly with environments is another way to accomplish your goal, but it wouldn't be nearly as easy to manage. You can create one-off environments (collections of "installed" packages) using the `guix environment' command. However, without saving the environments to profiles, you would have to manually specify all the packages in your environment each time you wanted to run a command within it. It's still a perfectly viable path (especially if you hard-coded the long commands into shell scripts), but using the default profile for multiple user accounts definitely eliminates the extra DIY aspect of manual environment/profile activation and deactivation. Just my 2c, Gary Ben writes: > Hi all > I've watched all the introduction videos (which are really helpful) and red some documentation, but I think I still miss something fundamental. > > I run a vagrant vm with a simple node server app behind apache. The setup is small, but still has a some configuration and packaging (npm) involved. So I'd like to try to introduce guix into this setup. In addition to that I have a second vagrant vm running with the same basic setup, but some minor differences. > > Would it be possible to put these two setups from two different vagrant machines into one machine? I don't need strong isolation, but I need the possibility of having different versions of software installed on a single vagrant vm. > > If it is possible I would like to keep using vagrant. I know about docker, but in this case the preferred way would be: a vagrant vm with guix installed with a couple of parallel environments (if thats the correct term). > > When reading about guix I always imagine the case when you're sitting infront of your linux notebook, something (package, dependency) breaks and now thanks to guix you're able to roll back very easily. So this would be a single user environment. But can guix also be helpful in a case where you have multiple different environments (I hope the term is correct) running in parallel? What is the best way to achieve that? Creating multiple users? Using containers? > > Thanks > Ben -- GPG Key ID: 7BC158ED Use `gpg --search-keys lambdatronic' to find me Protect yourself from surveillance: https://emailselfdefense.fsf.org ======================================================================= () ascii ribbon campaign - against html e-mail /\ www.asciiribbon.org - against proprietary attachments Please avoid sending me MS-Office attachments. See http://www.gnu.org/philosophy/no-word-attachments.html