unofficial mirror of help-guix@gnu.org 
 help / color / mirror / Atom feed
* Using --search-paths with multiple profiles
@ 2020-08-03 23:26 hot12shots
  2020-08-04 17:01 ` Dmitry Alexandrov
  0 siblings, 1 reply; 3+ messages in thread
From: hot12shots @ 2020-08-03 23:26 UTC (permalink / raw)
  To: help-guix

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


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-08-05 21:13 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-03 23:26 Using --search-paths with multiple profiles hot12shots
2020-08-04 17:01 ` Dmitry Alexandrov
2020-08-05 21:13   ` hot12shots

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).