From mboxrd@z Thu Jan 1 00:00:00 1970 From: ludo@gnu.org (Ludovic =?UTF-8?Q?Court=C3=A8s?=) Subject: bug#20255: 'search-paths' should respect both user and system profile. Date: Thu, 19 Nov 2015 23:32:03 +0100 Message-ID: <87lh9tvcws.fsf@gnu.org> References: <877ftschjt.fsf@gmail.com> <87fv8fip01.fsf@gnu.org> <87d23j1bxk.fsf@gmail.com> <871tjyfnl8.fsf@gnu.org> <876199q4z1.fsf@gmail.com> <87ioca4ojo.fsf@gnu.org> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:52517) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZzXlJ-00021T-JI for bug-guix@gnu.org; Thu, 19 Nov 2015 17:33:06 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZzXlG-0008QM-Au for bug-guix@gnu.org; Thu, 19 Nov 2015 17:33:05 -0500 Received: from debbugs.gnu.org ([208.118.235.43]:55565) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZzXlG-0008QI-7T for bug-guix@gnu.org; Thu, 19 Nov 2015 17:33:02 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1ZzXlG-0001UE-1E for bug-guix@gnu.org; Thu, 19 Nov 2015 17:33:02 -0500 Sender: "Debbugs-submit" Resent-Message-ID: In-Reply-To: <87ioca4ojo.fsf@gnu.org> ("Ludovic \=\?utf-8\?Q\?Court\=C3\=A8s\=22'\?\= \=\?utf-8\?Q\?s\?\= message of "Sun, 03 May 2015 00:12:11 +0200") List-Id: Bug reports for GNU Guix List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-guix-bounces+gcggb-bug-guix=m.gmane.org@gnu.org Sender: bug-guix-bounces+gcggb-bug-guix=m.gmane.org@gnu.org To: =?UTF-8?Q?=E5=AE=8B=E6=96=87=E6=AD=A6?= Cc: 20255@debbugs.gnu.org --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable ludo@gnu.org (Ludovic Court=C3=A8s) skribis: > =E5=AE=8B=E6=96=87=E6=AD=A6 skribis: > >>> [...] >>>> >>>> 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 =E2=80=9Cguessed=E2=80= =9D 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? >> I see, currently search-paths depends on the packages recipes. If we >> update the related scheme code, then search-paths got updated, even we >> didn't touch packages in profile at all. It's a little confusing. >> So I think we should encode the search-paths for each package in >> manifest. > > Done in dedb17a. > > That will make it easier to generate environment variable settings. Here=E2=80=99s the patch that does that, to try on b2a7223 or later. Could you comment and give it a try? My main concern was the latency introduced at log-in shells, but it=E2=80=99s OK, at least on my i5+SSD lap= top. --8<---------------cut here---------------start------------->8--- $ time guix package -p ~/.guix-profile -p /run/current-system/profile --sea= rch-paths > /dev/null real 0m0.290s user 0m0.372s sys 0m0.028s $ guix package -I | wc -l 215 $ guix package -p /run/current-system/profile -I | wc -l 43 --8<---------------cut here---------------end--------------->8--- I=E2=80=99ll push it soon if there are no objections. TIA! Ludo=E2=80=99. --=-=-= Content-Type: text/x-patch Content-Disposition: inline diff --git a/gnu/system.scm b/gnu/system.scm index 2755d85..7d1d33e 100644 --- a/gnu/system.scm +++ b/gnu/system.scm @@ -429,35 +429,49 @@ export SSL_CERT_DIR=/etc/ssl/certs export SSL_CERT_FILE=\"$SSL_CERT_DIR/ca-certificates.crt\" export GIT_SSL_CAINFO=\"$SSL_CERT_FILE\" -# Crucial variables that could be missing in the profiles' 'etc/profile' -# because they would require combining both profiles. -# FIXME: See . -export MANPATH=$HOME/.guix-profile/share/man:/run/current-system/profile/share/man -export INFOPATH=$HOME/.guix-profile/share/info:/run/current-system/profile/share/info +# Search paths for GLib schemas, GTK+ icons, and so on. export XDG_DATA_DIRS=$HOME/.guix-profile/share:/run/current-system/profile/share export XDG_CONFIG_DIRS=$HOME/.guix-profile/etc/xdg:/run/current-system/profile/etc/xdg # Ignore the default value of 'PATH'. unset PATH -# Load the system profile's settings. +if [ -x /run/current-system/profile/bin/guix ] +then + # Crucial variables such as 'MANPATH' or 'INFOPATH' may be missing from the + # profiles' individual 'etc/profile'. Thus, combine both profiles when + # computing the search paths. + # + # This may take a few hundred milliseconds, but it's OK because this is + # performed for log-in shells only. + eval `/run/current-system/profile/bin/guix package \\ + -p /run/current-system/profile \\ + -p \"$HOME/.guix-profile\" --search-paths` +else + # In the unlikely case that Guix is not in the global profile, + # fall back to the simpler, yet less accurate method (see + # .) GUIX_PROFILE=/run/current-system/profile \\ . /run/current-system/profile/etc/profile -# Prepend setuid programs. -export PATH=/run/setuid-programs:$PATH - if [ -f \"$HOME/.guix-profile/etc/profile\" ] then # Load the user profile's settings. GUIX_PROFILE=\"$HOME/.guix-profile\" \\ . \"$HOME/.guix-profile/etc/profile\" -else + fi +fi + +if [ ! -f \"$HOME/.guix-profile\" ] +then # At least define this one so that basic things just work # when the user installs their first package. export PATH=\"$HOME/.guix-profile/bin:$PATH\" fi +# Prepend setuid programs. +export PATH=/run/setuid-programs:$PATH + # Append the directory of 'site-start.el' to the search path. export EMACSLOADPATH=:/etc/emacs --=-=-=--