guix-commits
[Top][All Lists]
Advanced

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

05/06: guix-install.sh: Create an init profile during installation


From: guix-commits
Subject: 05/06: guix-install.sh: Create an init profile during installation
Date: Fri, 17 Jan 2020 11:33:35 -0500 (EST)

civodul pushed a commit to branch master
in repository guix.

commit 30810aff713149d53cb25f36ae6d721ec66385da
Author: Prafulla Giri <address@hidden>
AuthorDate: Sat Dec 28 12:48:52 2019 +0545

    guix-install.sh: Create an init profile during installation
    
    Create an init profile (/etc/profile.d/guix.sh) during installation for
    better integration with foreign distros. This file, read by login-shells
    sets a few environment variables (PATH, GUIX_PROFILE, GUIX_LOCALE, along
    with XDG_DATA_DIRS) and makes guix-installed packages readily available
    for the users. Other environment variables, as listed by `guix package
    --search-paths=prefix`, are also exported.
    
    Checks are in place to prevent the init profile from needlessly polluting
    the user's environment.
    
    * etc/guix-install.sh (sys_create_init_profile): New function to create
    /etc/profile.d/guix.sh init profile.
    
    Signed-off-by: Ludovic Court├Ęs <address@hidden>
---
 etc/guix-install.sh | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)

diff --git a/etc/guix-install.sh b/etc/guix-install.sh
index 111e25f..b57d719 100755
--- a/etc/guix-install.sh
+++ b/etc/guix-install.sh
@@ -393,6 +393,26 @@ sys_authorize_build_farms()
     done
 }
 
+sys_create_init_profile()
+{ # Create /etc/profile.d/guix.sh for better desktop integration
+    cat <<"EOF" > /etc/profile.d/guix.sh
+# _GUIX_PROFILE: `guix pull` profile
+_GUIX_PROFILE="$HOME/.config/guix/current"
+[ -L $_GUIX_PROFILE ] && export PATH="$_GUIX_PROFILE/bin${PATH:+:}$PATH"
+
+# GUIX_PROFILE: User's default profile
+GUIX_PROFILE="$HOME/.guix-profile"
+[ -L $GUIX_PROFILE ] || return
+GUIX_LOCPATH="$GUIX_PROFILE/lib/locale"
+export GUIX_PROFILE GUIX_LOCPATH
+
+eval `guix package --search-paths=prefix 2> /dev/null`
+
+# set XDG_DATA_DIRS to include Guix installations
+export XDG_DATA_DIRS="$GUIX_PROFILE/share${XDG_DATA_DIRS:+:}$XDG_DATA_DIRS"
+EOF
+}
+
 welcome()
 {
     cat<<"EOF"
@@ -449,6 +469,7 @@ main()
     sys_create_build_user
     sys_enable_guix_daemon
     sys_authorize_build_farms
+    sys_create_init_profile
 
     _msg "${INF}cleaning up ${tmp_path}"
     rm -r "${tmp_path}"



reply via email to

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