unofficial mirror of help-guix@gnu.org 
 help / color / mirror / Atom feed
From: hot12shots <hot12shots@gmail.com>
To: help-guix@gnu.org
Subject: Using --search-paths with multiple profiles
Date: Mon, 3 Aug 2020 23:26:59 +0000	[thread overview]
Message-ID: <CAAkdc5AbMfBFZTOnC5-XmU+aZhXR+tSKWtS3sSBDMN_pZzkOGA@mail.gmail.com> (raw)

Hi Guix,

The Guix Cookbook chapter "Guix Profiles in Practice" [1] advises
that, when one activates a profile generated from a manifest,
environment variables like MANPATH won't be set automatically unless
the packages that will consume them (in this case man-db) was also
included in the manifest.

There seems to be a Guix command tailor-made for solving this problem:
`guix package --search-paths`. I am wondering if it would make sense
to recommend that as the default way to ensure MANPATH, etc. are set
correctly. I have had success replacing the cookbook's recommended
boilerplate in my .profile with:

  eval \
    $(eval guix package --search-paths=prefix \
                        -p /run/current-system/profile \
                        $(for p in $(guix package --list-profiles); do
                            echo -n " -p '$p'"
                          done) \
                        $(for p in $GUIX_EXTRA_PROFILES/*; do
                            echo -n " -p '$p/$(basename "$p")'"
                          done))

which on my system means:

    guix package --search-paths=prefix \
                 -p /run/current-system/profile  \
                 -p ~/.config/guix/current       \
                 -p ~/.guix-profile              \
                 -p $GUIX_EXTRA_PROFILES/abc/abc \
                 -p $GUIX_EXTRA_PROFILES/xyz/zyz
                 # etc.

This properly sets the manpath etc., as the consuming packages (man-db
and friends) are present in the included "built-in" profiles (first 3
`-p` arguments listed above). The only caveat I'm aware of is that the
multiple `guix` invocations aren't instantaneous, so one might not
want to use this if sourcing their .profile from .bashrc or
equivalent, as it would add some init time to every shell invocation.

Is this a safe solution? Is there ever a reason to explicitly source
the `etc/profile` file of a profile as the cookbook currently
recommends, rather than getting at its contents via `--search-paths`?
Put another way, could a profile's `etc/profile` ever include setup
code that `--search-paths` would miss?

Thanks,
Jacob

[1]: https://guix.gnu.org/cookbook/en/html_node/Guix-Profiles-in-Practice.html


             reply	other threads:[~2020-08-04  0:30 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-08-03 23:26 hot12shots [this message]
2020-08-04 17:01 ` Using --search-paths with multiple profiles Dmitry Alexandrov
2020-08-05 21:13   ` hot12shots

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=CAAkdc5AbMfBFZTOnC5-XmU+aZhXR+tSKWtS3sSBDMN_pZzkOGA@mail.gmail.com \
    --to=hot12shots@gmail.com \
    --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.
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).