From debbugs-submit-bounces@debbugs.gnu.org Thu Nov 19 17:32:30 2015 Received: (at 20255) by debbugs.gnu.org; 19 Nov 2015 22:32:30 +0000 Received: from localhost ([127.0.0.1]:45273 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1ZzXkk-0001SS-1u for submit@debbugs.gnu.org; Thu, 19 Nov 2015 17:32:30 -0500 Received: from eggs.gnu.org ([208.118.235.92]:42174) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1ZzXkQ-0001RO-0A for 20255@debbugs.gnu.org; Thu, 19 Nov 2015 17:32:28 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZzXkM-0008Ex-BY for 20255@debbugs.gnu.org; Thu, 19 Nov 2015 17:32:09 -0500 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-0.6 required=5.0 tests=BAYES_20,RP_MATCHES_RCVD autolearn=disabled version=3.3.2 Received: from fencepost.gnu.org ([2001:4830:134:3::e]:35633) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZzXkM-0008Et-87; Thu, 19 Nov 2015 17:32:06 -0500 Received: from reverse-83.fdn.fr ([80.67.176.83]:46114 helo=pluto) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_128_CBC_SHA1:128) (Exim 4.82) (envelope-from ) id 1ZzXkL-0004Fy-Jy; Thu, 19 Nov 2015 17:32:06 -0500 From: ludo@gnu.org (Ludovic =?utf-8?Q?Court=C3=A8s?=) To: =?utf-8?B?5a6L5paH5q2m?= Subject: Re: bug#20255: 'search-paths' should respect both user and system profile. 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> Date: Thu, 19 Nov 2015 23:32:03 +0100 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") Message-ID: <87lh9tvcws.fsf@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2001:4830:134:3::e X-Spam-Score: -5.6 (-----) X-Debbugs-Envelope-To: 20255 Cc: 20255@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -5.6 (-----) --=-=-= 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 --=-=-=--