From unknown Tue Aug 19 22:01:05 2025 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Mailer: MIME-tools 5.509 (Entity 5.509) Content-Type: text/plain; charset=utf-8 From: bug#43408 <43408@debbugs.gnu.org> To: bug#43408 <43408@debbugs.gnu.org> Subject: Status: [PATCH] environment: '--link-profile' uses ~/.guix-profile for environment variables. Reply-To: bug#43408 <43408@debbugs.gnu.org> Date: Wed, 20 Aug 2025 05:01:05 +0000 retitle 43408 [PATCH] environment: '--link-profile' uses ~/.guix-profile fo= r environment variables. reassign 43408 guix-patches submitter 43408 Ludovic Court=C3=A8s severity 43408 normal tag 43408 patch thanks From debbugs-submit-bounces@debbugs.gnu.org Mon Sep 14 16:53:37 2020 Received: (at submit) by debbugs.gnu.org; 14 Sep 2020 20:53:37 +0000 Received: from localhost ([127.0.0.1]:56432 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kHvTl-0001Bk-Ad for submit@debbugs.gnu.org; Mon, 14 Sep 2020 16:53:37 -0400 Received: from lists.gnu.org ([209.51.188.17]:54154) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kHvTi-0001Bc-Lj for submit@debbugs.gnu.org; Mon, 14 Sep 2020 16:53:36 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:36022) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kHvTi-0000WW-DE for guix-patches@gnu.org; Mon, 14 Sep 2020 16:53:34 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]:60390) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kHvTh-0007f2-Du; Mon, 14 Sep 2020 16:53:33 -0400 Received: from [2a01:e0a:1d:7270:af76:b9b:ca24:c465] (port=33928 helo=gnu.org) by fencepost.gnu.org with esmtpsa (TLS1.2:DHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1kHvTf-00073H-05; Mon, 14 Sep 2020 16:53:32 -0400 From: =?UTF-8?q?Ludovic=20Court=C3=A8s?= To: guix-patches@gnu.org Subject: [PATCH] environment: '--link-profile' uses ~/.guix-profile for environment variables. Date: Mon, 14 Sep 2020 22:53:15 +0200 Message-Id: <20200914205315.15748-1-ludo@gnu.org> X-Mailer: git-send-email 2.28.0 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: submit Cc: =?UTF-8?q?Ludovic=20Court=C3=A8s?= X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 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: -3.3 (---) Before this patch, we had: $ guix environment -CP --ad-hoc coreutils [env]$ echo $PATH /gnu/store/…-profile/bin [env]$ echo $GUIX_ENVIRONMENT /gnu/store/…-profile After this patch: $ guix environment -CP --ad-hoc coreutils [env]$ echo $PATH /home/ludo/.guix-profile/bin [env]$ echo $GUIX_ENVIRONMENT /home/ludo/.guix-profile * guix/scripts/environment.scm (launch-environment/container): When LINK-PROFILE? is true, pass ~/.guix-profile as the second argument to 'launch-environment'. * tests/guix-environment-container.sh: Adjust test accordingly. * doc/guix.texi (Invoking guix environment): Update accordingly. --- doc/guix.texi | 5 +++-- guix/scripts/environment.scm | 6 +++++- tests/guix-environment-container.sh | 10 +++++++--- 3 files changed, 15 insertions(+), 6 deletions(-) diff --git a/doc/guix.texi b/doc/guix.texi index 5e4bfd8e85..e4650b2311 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -5420,8 +5420,9 @@ device. @item --link-profile @itemx -P For containers, link the environment profile to @file{~/.guix-profile} -within the container. This is equivalent to running the command -@samp{ln -s $GUIX_ENVIRONMENT ~/.guix-profile} within the container. +within the container and set @code{GUIX_ENVIRONMENT} to that. +This is equivalent to making @file{~/.guix-profile} a symlink to the +actual profile within the container. Linking will fail and abort the environment if the directory already exists, which will certainly be the case if @command{guix environment} was invoked in the user's home directory. diff --git a/guix/scripts/environment.scm b/guix/scripts/environment.scm index ad50281eb2..e2e481dd02 100644 --- a/guix/scripts/environment.scm +++ b/guix/scripts/environment.scm @@ -564,7 +564,11 @@ WHILE-LIST." (primitive-exit/status ;; A container's environment is already purified, so no need to ;; request it be purified again. - (launch-environment command profile manifest #:pure? #f))) + (launch-environment command + (if link-profile? + (string-append home-dir "/.guix-profile") + profile) + manifest #:pure? #f))) #:guest-uid uid #:guest-gid gid #:namespaces (if network? diff --git a/tests/guix-environment-container.sh b/tests/guix-environment-container.sh index 45264d4978..040f32cce9 100644 --- a/tests/guix-environment-container.sh +++ b/tests/guix-environment-container.sh @@ -127,11 +127,15 @@ grep -e "$NIX_STORE_DIR/.*-bash" $tmpdir/mounts # bootstrap bash rm $tmpdir/mounts -# Make sure 'GUIX_ENVIRONMENT' is linked to '~/.guix-profile' when requested +# Make sure 'GUIX_ENVIRONMENT' is set to '~/.guix-profile' when requested # within a container. ( - linktest='(exit (string=? (getenv "GUIX_ENVIRONMENT") -(readlink (string-append (getenv "HOME") "/.guix-profile"))))' + linktest=' +(exit (and (string=? (getenv "GUIX_ENVIRONMENT") + (string-append (getenv "HOME") "/.guix-profile")) + (string-prefix? "'"$NIX_STORE_DIR"'" + (readlink (string-append (getenv "HOME") + "/.guix-profile")))))' cd "$tmpdir" \ && guix environment --bootstrap --container --link-profile \ -- 2.28.0 From debbugs-submit-bounces@debbugs.gnu.org Mon Sep 21 17:38:56 2020 Received: (at 43408-done) by debbugs.gnu.org; 21 Sep 2020 21:38:56 +0000 Received: from localhost ([127.0.0.1]:56538 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kKTWR-0001Ce-U9 for submit@debbugs.gnu.org; Mon, 21 Sep 2020 17:38:56 -0400 Received: from eggs.gnu.org ([209.51.188.92]:44772) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kKTWR-0001CO-2x for 43408-done@debbugs.gnu.org; Mon, 21 Sep 2020 17:38:55 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]:37467) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kKTWL-0005yd-Pz for 43408-done@debbugs.gnu.org; Mon, 21 Sep 2020 17:38:49 -0400 Received: from [2a01:e0a:1d:7270:af76:b9b:ca24:c465] (port=48138 helo=ribbon) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1kKTWK-0005tR-PZ for 43408-done@debbugs.gnu.org; Mon, 21 Sep 2020 17:38:49 -0400 From: =?utf-8?Q?Ludovic_Court=C3=A8s?= To: 43408-done@debbugs.gnu.org Subject: Re: [bug#43408] [PATCH] environment: '--link-profile' uses ~/.guix-profile for environment variables. References: <20200914205315.15748-1-ludo@gnu.org> Date: Mon, 21 Sep 2020 23:38:47 +0200 In-Reply-To: <20200914205315.15748-1-ludo@gnu.org> ("Ludovic =?utf-8?Q?Cou?= =?utf-8?Q?rt=C3=A8s=22's?= message of "Mon, 14 Sep 2020 22:53:15 +0200") Message-ID: <877dsmizdk.fsf@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 43408-done X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 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: -3.3 (---) Ludovic Court=C3=A8s skribis: > Before this patch, we had: > > $ guix environment -CP --ad-hoc coreutils > [env]$ echo $PATH > /gnu/store/=E2=80=A6-profile/bin > [env]$ echo $GUIX_ENVIRONMENT > /gnu/store/=E2=80=A6-profile > > After this patch: > > $ guix environment -CP --ad-hoc coreutils > [env]$ echo $PATH > /home/ludo/.guix-profile/bin > [env]$ echo $GUIX_ENVIRONMENT > /home/ludo/.guix-profile > > * guix/scripts/environment.scm (launch-environment/container): When > LINK-PROFILE? is true, pass ~/.guix-profile as the second argument to > 'launch-environment'. > * tests/guix-environment-container.sh: Adjust test accordingly. > * doc/guix.texi (Invoking guix environment): Update accordingly. Pushed as 9b65281de51bcb56714509524f5ae0731c9b96d0. Ludo=E2=80=99. From unknown Tue Aug 19 22:01:05 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Tue, 20 Oct 2020 11:24:05 +0000 User-Agent: Fakemail v42.6.9 # This is a fake control message. # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator