unofficial mirror of guix-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: zimoun <zimon.toutoune@gmail.com>
To: Ryan Prior <rprior@protonmail.com>, pinoaffe <pinoaffe@airmail.cc>
Cc: guix-devel@gnu.org
Subject: Re: Named environments
Date: Tue, 14 Sep 2021 08:30:38 +0200	[thread overview]
Message-ID: <86zgsfr7n5.fsf@gmail.com> (raw)
In-Reply-To: <4WH_uctsaulZjYrHDmNui178VC8g56-Vt_oSIsY2FvInhC07RDKAQTEv4A4Ghlh8FTNaZLJY1gDzTdzcH_DmbHL_sAxC9DEFP-co6u0ISEY=@protonmail.com>

Hi Ryan,

On Tue, 14 Sep 2021 at 02:32, Ryan Prior <rprior@protonmail.com> wrote:
> On Monday, September 13th, 2021 at 3:48 PM, pinoaffe <pinoaffe@airmail.cc> wrote:
>
>> this sounds very similar to the features offered by profiles
>
> Agreed, and maybe it's good to unify these things or be more explicit
> about how they're different?

“guix environment” is a temporary profile. ;-)

--8<---------------cut here---------------start------------->8---
$ guix environment --ad-hoc hello
$ echo $GUIX_ENVIRONMENT
/gnu/store/lw9x5aimyqcq5iazj786fv7q5l3h0syk-profile
--8<---------------cut here---------------end--------------->8---

And see the option ’--profile’ and ’--root’.

Years ago, it had been discussed a “guix profile” subcommand in order to
help the management.  Maybe it could be resumed.

Also note what is really missing, IMHO, is the feature to
“containerized” some apps.

> What I see as the defining characteristic of a profile, is that it
> exists in a certain directory with a script (etc/profile) & structure
> to allow an end-user to activate it.

Well, a proof-of-concept attempt of such feature could be done with
a script and “guix repl”, then using “GUIX_EXTENSIONS_PATH”, you could
type:

  guix profile load

As a starting point, see
<https://lists.gnu.org/archive/html/guix-devel/2020-04/msg00477.html>.


> It lacks some things I associate with the concept of named environments:
>
> - There is afaik no definitive list of profiles on your machine. I

“guix package --list-profiles” lists all the user profiles.
Running the same as root lists all the profiles.
Do you need more?

> know "guix gc" knows somethings, but "gc --show-roots" doesn't give me
> useful info here. If I give names to "named environments" then that
> implies there's some registry of names which I can easily query to
> refer to a specific environment. This is important for integration
> with tools where you want to refer to a specific environment
> (profile?) by a shorthand name.
>
>
> - I can easily update environments using my text editor, because
> they're based on manifests. I know you can export & import profiles,
> but the API to update profiles is basically imperative. Beyond that,

I do not understand what means «update profiles is basically
imperative».  Somehow, a profile is a list of transactions; the way to
populate such transaction can be “imperative” or “declarative” but I
miss how the transaction itself could be “imperative” or “declarative”.
Well, from my understanding. :-)

> it doesn't seem like you can check a profile into source control, but
> I'd very much like to check manifests for named environments into git

You are speaking about the manifest.scm file, right?  Not the
internal etc/manifest file.

From my understanding, the way to share environment is to share this
manifest.scm file and the channels.scm file.  However, as explained
earlier or elsewhere, it miss “something” to easily write manifest.scm
file where some apps run in container.  Currently, it is:

  guix time-machine -C channels.scm \
       environment -m manifest.scm \
       -C -E <blablabla>

it could be nice to be able to easily declare all the “-C -E <blabla>”
directly in the manifest.scm file.

> to share them with people. Maybe this can just be bridged and we can
> get some kind of profiles-as-code concept going, as well as an
> imperative API for updating manifests (as Sarah Morgensen proposed
> IIRC with her "guix env --edit" command)

Once a profile, you can use ’--export-manifest’.

--8<---------------cut here---------------start------------->8---
$ guix environment --ad-hoc hello
$ echo $GUIX_ENVIRONMENT
/gnu/store/lw9x5aimyqcq5iazj786fv7q5l3h0syk-profile

$ exit
exit

$ guix package --export-manifest -p /gnu/store/lw9x5aimyqcq5iazj786fv7q5l3h0syk-profile
;; This "manifest" file can be passed to 'guix package -m' to reproduce
;; the content of your profile.  This is "symbolic": it only specifies
;; package names.  To reproduce the exact same profile, you also need to
;; capture the channels being used, as returned by "guix describe".
;; See the "Replicating Guix" section in the manual.

(specifications->manifest (list "hello"))
--8<---------------cut here---------------end--------------->8---

You cannot edit on-the-fly the manifest.  It would break the declarative
approach, IMHO.  Well, from my understanding, you cannot have a link
between the manifest.scm file which is used to instantiate a profile and
the profile itself.  It is not a 1:1 map.  Once the profile (named
environment or not :-)), you can only recreate an approximation of a
manifest.scm file.

And from my understanding, the option “-C -E <blabla>“ are not encoded
in the profile.  Maybe something is missing in this area.


> - Profiles don't seem to have certain desirable features that Guix
> environments do, such as pure execution, containerization with or
> without access to network or certain parts of the filesystem,
> etc. Maybe my understanding here is superficial and you can actually
> do this with profiles after all? 

I agree, something is missing here.

All the best,
simon


      parent reply	other threads:[~2021-09-14  6:53 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-10 23:06 Named environments Ryan Prior
2021-09-11  8:59 ` Domagoj Stolfa
2021-09-12 19:33 ` Sarah Morgensen
2021-09-13  8:08   ` zimoun
2021-10-06 13:29   ` Ludovic Courtès
2021-09-13 15:48 ` pinoaffe
2021-09-14  2:32   ` Ryan Prior
2021-09-14  6:27     ` Lars-Dominik Braun
2021-09-14  9:58       ` Pjotr Prins
2021-09-14  6:30     ` zimoun [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://guix.gnu.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=86zgsfr7n5.fsf@gmail.com \
    --to=zimon.toutoune@gmail.com \
    --cc=guix-devel@gnu.org \
    --cc=pinoaffe@airmail.cc \
    --cc=rprior@protonmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).