Subject: Re: bug#20255: 'search-paths' should respect both user and system profile.

From: [email-masked] (Ludovic Courtès)
Date: Sun, 05 Apr 2015 20:15:47 +0200

宋文武 <[email-masked]> skribis:

> As 'guix package' is for only one profile, that's fine.
> Since we can get search-paths from system profile using:
>   guix package -p /run/current-system/profile --search-paths

Right.

> I think the missing is to check whether we are under GuixSD,
> and then merge those 2 search-paths object in scheme level
> to get a full search-paths.
>
> Or better to generate a 'profile' script for each manifest, and then
> merged in shell level, so it can work out-of-the-box. How about:
>   - /etc/profile:
>     # configuration for the whole system goes here.
>     # shouldn't refer profile paths.
>     export LANG=en_US.utf8
>     export SSL_CERT_DIR=/etc/ssl/certs
>     export LINUX_MODULE_DIRECTORY=/run/booted-system/kernel/lib/modules
>     [...]
>
>     source /run/current-system/profile/etc/profile
>
>     if [ -f $HOME/.guix-profile/etc/profile ]; then
>       source $HOME/.guix-profile/etc/profile
>     fi
>
>     # honor setuid-programs
>     export PATH=/run/setuid-programs:$PATH
>
>   - /run/current-system/profile/etc/profile:
>     export PATH=/run/current-system/profile/bin:/run/current-system/profile/sbin:$PATH
>     export MANPATH=/run/current-system/profile/share/man:$PATH
>     [...]
>     
>   - ~/.guix-profile/etc/profile:
>     export PATH=~/.guix-profile/bin:~/.guix-profile/sbin:$PATH
>     [...]
>
> The idea to generate profile from search-paths is not new,
> I heard it from you IIRC.
> I think it's the time to do it.

Agreed, the plan makes sense and I think we have all the bits.

A related question is whether to encode search path environment
variables into the manifest (currently they are “guessed” by looking at
same-named packages; see (guix build package).)  I think that would
probably simplify things and make it easier to share this environment
variable code.

Thoughts?

Thanks,
Ludo’.