all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Pierre Neidhardt <mail@ambrevar.xyz>
To: help-guix@gnu.org, guix-blog@gnu.org
Subject: [Blog/Cookbook?] On multiple Guix profiles and manifests
Date: Sat, 05 Oct 2019 12:55:39 +0200	[thread overview]
Message-ID: <87y2xzihqs.fsf@ambrevar.xyz> (raw)

[-- Attachment #1: Type: text/plain, Size: 3117 bytes --]

Hi!

While the documentation refers to profiles and manifests, it does not tell much
of the use cases and the practical benefits.

For users coming from non-functional package managers, it's not really obvious
why we would need profiles.

Regarding manifest, I suppose some people might find them annoying to use
because updating/adding just 1 program means rebuilding the whole profile, which
after a Guix pull can be somewhat lengthy.

So what about writing a blog article / cookbook chapter to explain why
profiles and manifests are truly awesome indeed?  (Unless this has
already been done and I missed it?)

A quick 'n' dirty outline:

A manifest can be slow to install if it's too big.  But Guix supports profile,
which are perfect to break down manifests into multiple sets of semantically
connected packages.

Example profiles:

- Emacs.
- TeXlive (this one can be really useful when you need to install just one
  package for the next document you've received over email).
- Your favourite programming language libraries.
- The dependencies of a project you are working on
- Games :p

We can create a manifest per profile and install them this way:

  guix package --manifest=/path/to/guix-dev-manifest.scm  --profile=$HOME/.guix-extra-profiles/dev/dev
  
Placing all your profiles in a single folder, with each profile getting its own
subfolder is somewhat cleaner, plus it's obvious to "loop over profiles" from
any programming language (e.g. a shell script) by
simply looping over the sub-directories of .guix-extra-profiles.

Note that it's also possible to loop over the output of `guix package
--list-profiles` although you'll probably have to filter out
`~/.config/guix/current`.


To "enable" all profiles on login, add this to your .bash_profile (or .profile
if you don't use bash):

#+begin_src sh
for i in ~/.guix-extra-profiles/*; do
	profile=$i/$(basename "$i")
	if [ -f "$profile"/etc/profile ]; then
		GUIX_PROFILE="$profile" ; . "$profile"/etc/profile
	fi
	unset profile
done
#+end_src

I like to keep the default ~/.guix-profile manifest-less for trash-away packages
that I would just use for a couple of days.  
This way it's easy to just run

  guix install FOO
  guix upgrade BAR
  
and I don't have to specify the profile.

Other benefits of manifests:

- No need to generate or maintain a manifest from an ad-hoc profile.
  
- "guix package -u" will always suggest to update some packages of those have
  propagated inputs.  Guix manifests avoid this problem.
  
- "guix package -u [packages...]" may report conflicts which are annoying to
  resolve manually.  Manifests avoid this problem altogether.

Other benefits of multiple profiles

- It's easy to toggle a specific profile on/off.
  
- When a profile is off, it's easy to enable it for an individual shell without
  "polluting" the rest of the user session:

  #+begin_src sh
  GUIX_PROFILE="$profile" ; . "$profile"/etc/profile 
  #+end_src


Happy to hear about your feedback!

Cheers!

-- 
Pierre Neidhardt
https://ambrevar.xyz/

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 487 bytes --]

             reply	other threads:[~2019-10-05 10:55 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-05 10:55 Pierre Neidhardt [this message]
2019-10-07  9:56 ` [Blog/Cookbook?] On multiple Guix profiles and manifests Todor Kondić
2019-10-07 15:17   ` Pierre Neidhardt
2019-10-07 14:05 ` Konrad Hinsen
2019-10-07 15:25   ` Pierre Neidhardt
2019-10-07 15:37     ` Konrad Hinsen
2019-10-07 16:17       ` Todor Kondić
2019-10-11  8:23 ` Ludovic Courtès
2019-10-11 15:16   ` Pierre Neidhardt
2019-10-11 16:51     ` Ricardo Wurmus
2019-10-12  8:34       ` Pierre Neidhardt
2019-10-12 23:08     ` Ludovic Courtès
2019-10-13 10:27       ` Pierre Neidhardt
2019-10-14 10:35         ` Pierre Neidhardt
2019-10-14 13:30         ` Ludovic Courtès
2019-10-14  4:38 ` Chris Marusich
2019-10-14  7:27   ` Pierre Neidhardt
2019-10-14 11:26     ` Konrad Hinsen
2019-10-14 11:49       ` Pierre Neidhardt
2019-10-14 14:53     ` Chris Marusich
2019-10-14 15:01       ` Chris Marusich
2019-10-14 15:39       ` Pierre Neidhardt

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

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

  git send-email \
    --in-reply-to=87y2xzihqs.fsf@ambrevar.xyz \
    --to=mail@ambrevar.xyz \
    --cc=guix-blog@gnu.org \
    --cc=help-guix@gnu.org \
    /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 external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.