* [bug#39049] guix-install.sh: Create an init profile for better out-of-the-box experience on foreign distros
@ 2020-01-09 7:23 Prafulla Giri
2020-01-17 16:29 ` Ludovic Courtès
0 siblings, 1 reply; 3+ messages in thread
From: Prafulla Giri @ 2020-01-09 7:23 UTC (permalink / raw)
To: 39049
[-- Attachment #1.1: Type: text/plain, Size: 655 bytes --]
Esteemed maintainers,
Attached is a patch that I think improves the guix user experience on a
foreign distro. It creates a guix.sh init profile at /etc/profile.d (in the
same vein as flatpak with it's /etc/profile.d/flatpak.sh). I have been
using the init file on few of my friends computers with no regressions.
I have tried my best to emulate the commit-logs as seen from `git log
etc/guix-install.sh`. Please do let me know if I am doing anything wrong.
This is my first real contribution to a GNU project, ever. I am still a
n00b, and only have had experiences with GitHub based PRs so far, and still
have a lot to learn. Please forgive my klutzes.
[-- Attachment #1.2: Type: text/html, Size: 744 bytes --]
[-- Attachment #2: 0001-guix-install.sh-Create-an-init-profile-during-instal.patch --]
[-- Type: text/x-patch, Size: 2072 bytes --]
From 527d82c66a1e80779f75a16cfdd65634d55f32c1 Mon Sep 17 00:00:00 2001
From: Prafulla Giri <pratheblackdiamond@gmail.com>
Date: Sat, 28 Dec 2019 12:48:52 +0545
Subject: [PATCH] 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.
---
etc/guix-install.sh | 21 +++++++++++++++++++++
1 file changed, 21 insertions(+)
diff --git a/etc/guix-install.sh b/etc/guix-install.sh
index 111e25fbcb..b57d71981f 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}"
--
2.24.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [bug#39049] guix-install.sh: Create an init profile for better out-of-the-box experience on foreign distros
2020-01-09 7:23 [bug#39049] guix-install.sh: Create an init profile for better out-of-the-box experience on foreign distros Prafulla Giri
@ 2020-01-17 16:29 ` Ludovic Courtès
[not found] ` <CAFw+=j1GvNd0Mi1q5cB9W11gsgZ42HTMD=r_Y=_ZW7wYThfA_Q@mail.gmail.com>
0 siblings, 1 reply; 3+ messages in thread
From: Ludovic Courtès @ 2020-01-17 16:29 UTC (permalink / raw)
To: Prafulla Giri; +Cc: 39049
Hello Prafulla,
Prafulla Giri <pratheblackdiamond@gmail.com> skribis:
> Attached is a patch that I think improves the guix user experience on a
> foreign distro. It creates a guix.sh init profile at /etc/profile.d (in the
> same vein as flatpak with it's /etc/profile.d/flatpak.sh). I have been
> using the init file on few of my friends computers with no regressions.
That’s a great idea! Do you know how common the /etc/profile.d/*.sh
convention is?
> I have tried my best to emulate the commit-logs as seen from `git log
> etc/guix-install.sh`. Please do let me know if I am doing anything wrong.
> This is my first real contribution to a GNU project, ever. I am still a
> n00b, and only have had experiences with GitHub based PRs so far, and still
> have a lot to learn. Please forgive my klutzes.
You did very well, no worries! (And it’s normal to need some time to
discover a project’s conventions when one joins it.)
> From 527d82c66a1e80779f75a16cfdd65634d55f32c1 Mon Sep 17 00:00:00 2001
> From: Prafulla Giri <pratheblackdiamond@gmail.com>
> Date: Sat, 28 Dec 2019 12:48:52 +0545
> Subject: [PATCH] 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.
Applied, thanks!
Ludo’.
^ permalink raw reply [flat|nested] 3+ messages in thread
* [bug#39049] guix-install.sh: Create an init profile for better out-of-the-box experience on foreign distros
[not found] ` <CAFw+=j1GvNd0Mi1q5cB9W11gsgZ42HTMD=r_Y=_ZW7wYThfA_Q@mail.gmail.com>
@ 2020-01-20 8:38 ` Ludovic Courtès
0 siblings, 0 replies; 3+ messages in thread
From: Ludovic Courtès @ 2020-01-20 8:38 UTC (permalink / raw)
To: Prafulla Giri; +Cc: 39049
Hello,
Prafulla Giri <pratheblackdiamond@gmail.com> skribis:
> /etc/profile.d/*.sh seems to be the norm these days. All the debian-based
> distros that I have used seem to have it (Mint, Elementary, Ubuntu, etc.)
> and even Alpine Linux's docker containers support them.
OK, great.
> I didn't really think this patch will get merged in one go. I did find
> another thing that I could add to this patch the other day but had not
> gotten around to updating this. It is regarding the infopath: setting it to
> contain _GUIX_PROFILE/share/info seems to be a good default to have, esp.
> because it isn't exported by `guix package --search-paths`. I ran into this
> issue just the other day, myself. I wish I had made haste to send in an
> update.
I agree that it’d be nice!
> Should I send in a patch, sir? And do I send it in this thread or should I
> do it in another one, please?
Could you send another patch to guix-patches@gnu.org?
Thank you,
Ludo’.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2020-01-20 8:39 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-01-09 7:23 [bug#39049] guix-install.sh: Create an init profile for better out-of-the-box experience on foreign distros Prafulla Giri
2020-01-17 16:29 ` Ludovic Courtès
[not found] ` <CAFw+=j1GvNd0Mi1q5cB9W11gsgZ42HTMD=r_Y=_ZW7wYThfA_Q@mail.gmail.com>
2020-01-20 8:38 ` Ludovic Courtès
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).