[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Using --search-paths with multiple profiles

From: hot12shots
Subject: Using --search-paths with multiple profiles
Date: Mon, 3 Aug 2020 23:26:59 +0000

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")'"

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?



reply via email to

[Prev in Thread] Current Thread [Next in Thread]