From: ludo@gnu.org (Ludovic Courtès)
To: 宋文武 <iyzsong@gmail.com>
Cc: 20255@debbugs.gnu.org
Subject: bug#20255: 'search-paths' should respect both user and system profile.
Date: Thu, 19 Nov 2015 23:32:03 +0100 [thread overview]
Message-ID: <87lh9tvcws.fsf@gnu.org> (raw)
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")
[-- Attachment #1: Type: text/plain, Size: 1727 bytes --]
ludo@gnu.org (Ludovic Courtès) skribis:
> 宋文武 <iyzsong@gmail.com> 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
215
$ guix package -p /run/current-system/profile -I | wc -l
43
--8<---------------cut here---------------end--------------->8---
I’ll push it soon if there are no objections.
TIA!
Ludo’.
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: Type: text/x-patch, Size: 2383 bytes --]
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 <http://bugs.gnu.org/20255>.
-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
+ # <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\" ]
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
next prev parent reply other threads:[~2015-11-19 22:33 UTC|newest]
Thread overview: 46+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-04-04 10:29 bug#20255: 'search-paths' should respect both user and system profile 宋文武
2015-04-04 21:04 ` Ludovic Courtès
2015-04-05 3:39 ` 宋文武
2015-04-05 18:15 ` Ludovic Courtès
2015-04-06 4:02 ` 宋文武
2015-04-06 8:24 ` Mark H Weaver
2015-05-02 22:12 ` Ludovic Courtès
2015-11-19 22:32 ` Ludovic Courtès [this message]
2015-11-20 22:42 ` Alex Kost
2015-11-21 8:57 ` Ludovic Courtès
2015-11-21 18:41 ` Alex Kost
2015-11-21 20:10 ` Ludovic Courtès
2015-11-22 7:52 ` Alex Kost
2015-11-22 10:52 ` Ludovic Courtès
2015-11-22 18:44 ` Alex Kost
2015-11-22 23:04 ` Ludovic Courtès
2015-11-23 11:55 ` Alex Kost
2015-11-23 14:31 ` Ludovic Courtès
2015-11-24 17:22 ` Ludovic Courtès
2015-11-30 9:08 ` Alex Kost
2015-11-30 12:25 ` Ludovic Courtès
2015-05-04 21:44 ` Ludovic Courtès
2015-05-05 8:28 ` 宋文武
2015-05-05 12:35 ` Ludovic Courtès
2015-05-06 16:35 ` Ludovic Courtès
2015-11-12 11:13 ` Ludovic Courtès
2020-02-21 15:53 ` bug#20255: (old)bug#20255: 'search-paths' should respect both user and system profiles zimoun
2020-02-21 17:18 ` Alex Kost
2021-06-26 2:37 ` bug#20255: 'search-paths' should respect both user and system profile Maxim Cournoyer
2021-06-26 5:59 ` Leo Prikler
2021-06-28 4:35 ` Maxim Cournoyer
2021-06-28 6:58 ` Leo Prikler
2021-06-27 9:59 ` Alex Kost
2021-06-28 4:48 ` Maxim Cournoyer
2021-06-29 17:29 ` Alex Kost
2020-12-18 20:27 ` bug#20255: «the Oldest» [PATCH] 'search-paths' should respect both user and system profiles zimoun
2023-05-12 12:34 ` bug#20255: 'search-paths' should respect both user and system profile 宋文武 via Bug reports for GNU Guix
2023-05-15 13:53 ` Maxim Cournoyer
2023-05-15 17:14 ` Josselin Poiret via Bug reports for GNU Guix
2023-05-15 17:46 ` Maxim Cournoyer
2023-05-16 9:37 ` Josselin Poiret via Bug reports for GNU Guix
2023-05-16 11:00 ` 宋文武 via Bug reports for GNU Guix
2023-05-17 14:04 ` bug#20255: [PATCH 1/4] home: shells: Merge search-paths of multiple profiles iyzsong--- via Bug reports for GNU Guix
2023-05-17 14:04 ` bug#20255: [PATCH 2/4] system: default-skeletons: Set up Guix home profile when it exists iyzsong--- via Bug reports for GNU Guix
2023-05-17 14:04 ` bug#20255: [PATCH 3/4] system: Only source system profile's settings in '/etc/profile' iyzsong--- via Bug reports for GNU Guix
2023-05-17 14:04 ` bug#20255: [PATCH 4/4] news: Add entry for '/etc/profile' changes iyzsong--- via Bug reports for GNU Guix
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://guix.gnu.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87lh9tvcws.fsf@gnu.org \
--to=ludo@gnu.org \
--cc=20255@debbugs.gnu.org \
--cc=iyzsong@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/guix.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).