GNU bug report logs

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

PackageSource(s)Maintainer(s)
guix PTS Buildd Popcon
Full log

Message #29 received at 20255@debbugs.gnu.org (full text, mbox, reply):

Received: (at 20255) by debbugs.gnu.org; 5 May 2015 08:29:35 +0000
From debbugs-submit-bounces@debbugs.gnu.org Tue May 05 04:29:35 2015
Received: from localhost ([127.0.0.1]:34317 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.80)
	(envelope-from <debbugs-submit-bounces@debbugs.gnu.org>)
	id 1YpYEQ-0000Nz-Og
	for submit@debbugs.gnu.org; Tue, 05 May 2015 04:29:35 -0400
Received: from mail-pd0-f172.google.com ([209.85.192.172]:35065)
 by debbugs.gnu.org with esmtp (Exim 4.80)
 (envelope-from <iyzsong@gmail.com>) id 1YpYEO-0000NY-1o
 for 20255@debbugs.gnu.org; Tue, 05 May 2015 04:29:32 -0400
Received: by pdbqd1 with SMTP id qd1so188548439pdb.2
 for <20255@debbugs.gnu.org>; Tue, 05 May 2015 01:29:26 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113;
 h=from:to:cc:subject:in-reply-to:references:user-agent:date
 :message-id:mime-version:content-type:content-transfer-encoding;
 bh=CXk5Yon3X81WaTapx49qsnO6/M6KUgOgNgLhHN7xBB0=;
 b=Qkaqrire4BywxA0EotpgJj6ofeWiX76qLB/kQH75ajaf8sjzXVM54j/XPWUy7MWwAG
 S0Cl4tXdikFNoGsZUzq0Tl2+WeZjft0kQn+KIuBvJCVQR73k1N/LZSTFiX+NhqoDNPx5
 7uTPhsu72NmKGKxlDG/QClU4oeN8Kr3WJrLIGMQ3rlYz0ye2UU5V5p894UJ96isY3ZKk
 x/pnvTP6sYlyrLDcy9LdF5w/UXIMEuIEkk6wQ4ThmmWpl+sAY7ifMBmv1t1DOMbHjwNr
 dTZIkSmcFqWKI2sFeCojZQ1fuaL+ZRZjjUoaZabyuvlszVJinIHj0tjU3ZlDIIOkeYH7
 X5pQ==
X-Received: by 10.70.101.2 with SMTP id fc2mr49871808pdb.77.1430814497324;
 Tue, 05 May 2015 01:28:17 -0700 (PDT)
Received: from localhost ([108.61.250.36])
 by mx.google.com with ESMTPSA id jg3sm15023511pbb.72.2015.05.05.01.28.15
 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);
 Tue, 05 May 2015 01:28:16 -0700 (PDT)
From: 宋文武 <iyzsong@gmail.com>
To: Ludovic Courtès <ludo@gnu.org>
Subject: Re: bug#20255: 'search-paths' should respect both user and system
 profile.
In-Reply-To: <87lhh43tn0.fsf@gnu.org>
References: <877ftschjt.fsf@gmail.com> <87fv8fip01.fsf@gnu.org>
 <87d23j1bxk.fsf@gmail.com> <87lhh43tn0.fsf@gnu.org>
User-Agent: Notmuch/0.18.1 (http://notmuchmail.org) Emacs/24.5.1
 (x86_64-unknown-linux-gnu)
Date: Tue, 05 May 2015 16:28:53 +0800
Message-ID: <87k2wnqvga.fsf@gmail.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
X-Spam-Score: -0.7 (/)
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: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request@debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit@debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request@debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request@debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces@debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces@debbugs.gnu.org>
X-Spam-Score: -0.7 (/)
Ludovic Courtès <ludo@gnu.org> writes:

> 宋文武 <iyzsong@gmail.com> skribis:
>
>> 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
>>     [...]
>
> There’s a further complication here: ‘profile-derivation’, which builds
> the profile, doesn’t know its user-visible name ~/.guix-profile.  It
> just knows its store file name.  However, we don’t want etc/profile to
> read:
>
>   export PATH=/gnu/store/...-profile/bin:$PATH
>
> because then, the user’s environment variables in a running session
> would keep pointing to a given profile generation.
Indeed.  Run guix to install a package should make it available
immediately.  Currently, we have 'PATH=~/.guix-profile/bin' in
profile and print hint for additional variables.
(Note that when profile changes, even we build all variables with the
location they going to be, a hint or re-source is still needed when the
new profile bring new variables.)
>
> So we have to tell ‘profile-generation’ what the user-visible name of
> the profile is going to be.  Attached is a very rough patch to do that.
> This is not so nice because all user interfaces will now have to pass
> that #:target parameter or etc/profile will be “wrong.”
>
> Another option would be to simply run:
>
>   eval `guix package -p ~/.guix-profile --search-paths`
>
> This has two downsides:
>
>   1. It takes ~200 ms to run on my laptop, which can maybe be
>      noticeable; OTOH it’s only for interactive shells, so maybe that’s
>      OK.
>
>   2. If there’s a manifest format change and /etc/profile calls a ‘guix’
>      command that cannot handle the manifest format (because it’s older
>      than the ‘guix’ used to build the profile), then it doesn’t work at
>      all (that’s a bit contrived, but not completely impossible.)
>
> Thoughts?
>
How about using a shell variable as input for the location:
(replace /gnu/store/xxx with $GUIX_PROFILE)

  # etc/profile
  export PATH=$GUIX_PROFILE/bin:$PATH
  export MANPATH=$GUIX_PROFILE/share/man:$MANPATH
  ...

Then when 'source' it, we pass the location:
(we did know where $GUIX_PROFILE is when do the 'source')

  # ~/.bash_profile
  GUIX_PROFILE=$HOME/.guix-profile
  if [ -f $GUIX_PROFILE/etc/profile ]; then
    . $GUIX_PROFILE/etc/profile
  fi

  # /etc/profile
  GUIX_PROFILE=/run/current-system/profile
  source $GUIX_PROFILE/etc/profile




Send a report that this bug log contains spam.


debbugs.gnu.org maintainers <help-debbugs@gnu.org>. Last modified: Sun Sep 7 12:38:54 2025; Machine Name: wallace-server

GNU bug tracking system

Debbugs is free software and licensed under the terms of the GNU Public License version 2. The current version can be obtained from https://bugs.debian.org/debbugs-source/.

Copyright © 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson, 2005-2017 Don Armstrong, and many other contributors.