unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
* [bug#75130] [PATCH] home: Load system profile in setup-environment.
@ 2024-12-26 23:27 Antero Mejr
  2024-12-27 10:08 ` Andrew Tropin via Guix-patches via
  0 siblings, 1 reply; 2+ messages in thread
From: Antero Mejr @ 2024-12-26 23:27 UTC (permalink / raw)
  To: 75130; +Cc: andrew, janneke, ludo, tanguy


This ensures packages installed with `guix install` are available on
$PATH when using Guix home with a foreign distro.

* gnu/home/services.scm (environment-variables->setup-environment-script):
Load system profile while loading home profile in setup-environment.

Change-Id: I96b047b92f3c050b15e521fecc96740390cae2ca
---
 gnu/home/services.scm | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/gnu/home/services.scm b/gnu/home/services.scm
index 39c9033ad6..1cf5ce0835 100644
--- a/gnu/home/services.scm
+++ b/gnu/home/services.scm
@@ -268,8 +268,6 @@ (define (environment-variables->setup-environment-script vars)
    %store-monad
    (return
     `(("setup-environment"
-       ;; TODO: It's necessary to source ~/.guix-profile too
-       ;; on foreign distros
        ,(computed-file "setup-environment"
                        #~(call-with-output-file #$output
                            (lambda (port)
@@ -280,6 +278,10 @@ (define (environment-variables->setup-environment-script vars)
 PROFILE_FILE=\"$HOME_ENVIRONMENT/profile/etc/profile\"
 [ -f $PROFILE_FILE ] && . $PROFILE_FILE
 
+SYSTEM_ENVIRONMENT=$HOME/.guix-profile
+SYSTEM_PROFILE_FILE=\"$SYSTEM_ENVIRONMENT/etc/profile\"
+[ -f $SYSTEM_PROFILE_FILE ] && . $SYSTEM_PROFILE_FILE
+
 case $XDG_DATA_DIRS in
   *$HOME_ENVIRONMENT/profile/share*) ;;
   *) export XDG_DATA_DIRS=$HOME_ENVIRONMENT/profile/share:$XDG_DATA_DIRS ;;

base-commit: e4bdd464ebb49f4e698e5105f70b29688fff9475
-- 
2.47.1





^ permalink raw reply related	[flat|nested] 2+ messages in thread

* [bug#75130] [PATCH] home: Load system profile in setup-environment.
  2024-12-26 23:27 [bug#75130] [PATCH] home: Load system profile in setup-environment Antero Mejr
@ 2024-12-27 10:08 ` Andrew Tropin via Guix-patches via
  0 siblings, 0 replies; 2+ messages in thread
From: Andrew Tropin via Guix-patches via @ 2024-12-27 10:08 UTC (permalink / raw)
  To: Antero Mejr, 75130; +Cc: ludo, tanguy, janneke

[-- Attachment #1: Type: text/plain, Size: 2295 bytes --]

On 2024-12-26 18:27, Antero Mejr wrote:

> This ensures packages installed with `guix install` are available on
> $PATH when using Guix home with a foreign distro.
>
> * gnu/home/services.scm (environment-variables->setup-environment-script):
> Load system profile while loading home profile in setup-environment.
>
> Change-Id: I96b047b92f3c050b15e521fecc96740390cae2ca
> ---
>  gnu/home/services.scm | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/gnu/home/services.scm b/gnu/home/services.scm
> index 39c9033ad6..1cf5ce0835 100644
> --- a/gnu/home/services.scm
> +++ b/gnu/home/services.scm
> @@ -268,8 +268,6 @@ (define (environment-variables->setup-environment-script vars)
>     %store-monad
>     (return
>      `(("setup-environment"
> -       ;; TODO: It's necessary to source ~/.guix-profile too
> -       ;; on foreign distros
>         ,(computed-file "setup-environment"
>                         #~(call-with-output-file #$output
>                             (lambda (port)
> @@ -280,6 +278,10 @@ (define (environment-variables->setup-environment-script vars)
>  PROFILE_FILE=\"$HOME_ENVIRONMENT/profile/etc/profile\"
>  [ -f $PROFILE_FILE ] && . $PROFILE_FILE
>  
> +SYSTEM_ENVIRONMENT=$HOME/.guix-profile
> +SYSTEM_PROFILE_FILE=\"$SYSTEM_ENVIRONMENT/etc/profile\"
> +[ -f $SYSTEM_PROFILE_FILE ] && . $SYSTEM_PROFILE_FILE
> +

IIRC, it called user profile.

/etc/profile on Guix System already contains this:
https://git.savannah.gnu.org/cgit/guix.git/tree/gnu/system.scm?h=092467b3b6#n1085
Unconditionally sourcing it two times is not the best idea (while it
probably will work most of the time, still feels wrong and probably can
cause unexpected issues).

There is a reason why GUIX_PROFILE is set before sourcing profile file.
Its value used to set PATH and similiar variables to
~/path/to/profile/bin instead of /gnu/blabla-profile/bin, so in case of
changing of ~/path/to/profile content/symlink all respective variables
don't require updates.

>  case $XDG_DATA_DIRS in
>    *$HOME_ENVIRONMENT/profile/share*) ;;
>    *) export XDG_DATA_DIRS=$HOME_ENVIRONMENT/profile/share:$XDG_DATA_DIRS ;;
>
> base-commit: e4bdd464ebb49f4e698e5105f70b29688fff9475

-- 
Best regards,
Andrew Tropin

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 832 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2024-12-27 10:09 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-12-26 23:27 [bug#75130] [PATCH] home: Load system profile in setup-environment Antero Mejr
2024-12-27 10:08 ` Andrew Tropin via Guix-patches via

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).