[Top][All Lists]

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

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

From: Ludovic Courtès
Subject: bug#20255: 'search-paths' should respect both user and system profile.
Date: Thu, 19 Nov 2015 23:32:03 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux)

address@hidden (Ludovic Courtès) skribis:

> 宋文武 <address@hidden> 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 “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?
>> 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’s 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’s OK, at least on my i5+SSD laptop.

--8<---------------cut here---------------start------------->8---
$ time guix package -p ~/.guix-profile -p /run/current-system/profile 
--search-paths > /dev/null

real    0m0.290s
user    0m0.372s
sys     0m0.028s
$ guix package -I | wc -l
$ guix package -p /run/current-system/profile -I | wc -l
--8<---------------cut here---------------end--------------->8---

I’ll push it soon if there are no objections.



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\"
-# Crucial variables that could be missing in the profiles' 'etc/profile'
-# because they would require combining both profiles.
-# FIXME: See <http://bugs.gnu.org/20255>.
+# Search paths for GLib schemas, GTK+ icons, and so on.
 # Ignore the default value of 'PATH'.
 unset PATH
-# Load the system profile's settings.
+if [ -x /run/current-system/profile/bin/guix ]
+  # 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`
+  # In the unlikely case that Guix is not in the global profile,
+  # fall back to the simpler, yet less accurate method (see
+  # <http://bugs.gnu.org/20255>.)
   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\" ]
     # Load the user profile's settings.
     GUIX_PROFILE=\"$HOME/.guix-profile\" \\
     . \"$HOME/.guix-profile/etc/profile\"
+  fi
+if [ ! -f \"$HOME/.guix-profile\" ]
   # 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\"
+# Prepend setuid programs.
+export PATH=/run/setuid-programs:$PATH
 # Append the directory of 'site-start.el' to the search path.
 export EMACSLOADPATH=:/etc/emacs

reply via email to

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