unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
From: Philip McGrath <philip@philipmcgrath.com>
To: 56050@debbugs.gnu.org
Cc: "Ludovic Courtès" <ludo@gnu.org>,
	"Philip McGrath" <philip@philipmcgrath.com>
Subject: [bug#56050] [PATCH v2 1/2] etc/guix-install.sh: Initialize XDG base directories.
Date: Sun,  3 Jul 2022 22:35:02 -0400	[thread overview]
Message-ID: <605a74b1f064e2b057f6c9d57692dda5bccf8edf.1656899134.git.philip@philipmcgrath.com> (raw)
In-Reply-To: <cover.1656899134.git.philip@philipmcgrath.com>

The default values from the XDG base directory specification make little
sense for Guix System, and some scripts in Guix assume that they are not
"empty or unset": for example, see <https://issues.guix.gnu.org/56050>.
On foreign distros, however, omitting the default values is likely to
break software from the distro, perhaps even preventing the desktop
environment from starting. To smooth over the difference, use the
system-wide configuration to ensure the environment variables are always
explicitly set on foreign distros.

* etc/guix-install.sh (sys_create_init_profile): Explicitly initialize
XDG base directory variables.
---
 etc/guix-install.sh | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/etc/guix-install.sh b/etc/guix-install.sh
index cd1a1c34c1..62a33a55c4 100755
--- a/etc/guix-install.sh
+++ b/etc/guix-install.sh
@@ -504,6 +504,16 @@ sys_create_init_profile()
   # This will not take effect until the next shell or desktop session!
     [ -d "/etc/profile.d" ] || mkdir /etc/profile.d # Just in case
     cat <<"EOF" > /etc/profile.d/guix.sh
+# Explicitly initialize XDG base directory variables to ease compatibility
+# with Guix System: see <https://issues.guix.gnu.org/56050#3>.
+export XDG_DATA_HOME="${XDG_DATA_HOME:-$HOME/.local/share}"
+export XDG_CONFIG_HOME="${XDG_CONFIG_HOME:-$HOME/.config}"
+export XDG_STATE_HOME="${XDG_STATE_HOME:-$HOME/.local/state}"
+export XDG_DATA_DIRS="${XDG_DATA_DIRS:-/usr/local/share/:/usr/share/}"
+export XDG_CONFIG_DIRS="${XDG_CONFIG_DIRS:-/etc/xdg}"
+export XDG_CACHE_HOME="${XDG_CACHE_HOME:-$HOME/.cache}"
+# no default for XDG_RUNTIME_DIR (depends on foreign distro for semantics)
+
 # _GUIX_PROFILE: `guix pull` profile
 _GUIX_PROFILE="$HOME/.config/guix/current"
 export PATH="$_GUIX_PROFILE/bin${PATH:+:}$PATH"
@@ -522,7 +532,7 @@ export GUIX_LOCPATH
 [ -f "$GUIX_PROFILE/etc/profile" ] && . "$GUIX_PROFILE/etc/profile"
 
 # set XDG_DATA_DIRS to include Guix installations
-export XDG_DATA_DIRS="$GUIX_PROFILE/share:${XDG_DATA_DIRS:-/usr/local/share/:/usr/share/}"
+export XDG_DATA_DIRS="$GUIX_PROFILE/share:$XDG_DATA_DIRS"
 EOF
 }
 
-- 
2.32.0





  reply	other threads:[~2022-07-04  2:37 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-18  5:25 [bug#56050] [PATCH] home: services: environment-variables: Fix XDG base directories Philip McGrath
2022-06-22 20:38 ` Ludovic Courtès
2022-06-23 21:33   ` Philip McGrath
2022-06-25 21:39     ` Ludovic Courtès
2022-07-04  2:35       ` [bug#56050] [PATCH v2 0/2] etc/guix-install.sh: Initialize " Philip McGrath
2022-07-04  2:35         ` Philip McGrath [this message]
2022-07-04  9:11           ` [bug#56050] [PATCH v2 1/2] " Ludovic Courtès
2022-07-04 16:36             ` Philip McGrath
2022-07-04 21:01               ` Ludovic Courtès
2022-07-04 20:18           ` [bug#56050] [PATCH] home: services: environment-variables: Fix " Ludovic Courtès
2022-07-04  2:35         ` [bug#56050] [PATCH v2 2/2] etc/guix-install.sh: Check for profile from 'guix home' Philip McGrath
2022-07-04  9:13           ` Ludovic Courtès
2022-07-12  6:44           ` Andrew Tropin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://guix.gnu.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=605a74b1f064e2b057f6c9d57692dda5bccf8edf.1656899134.git.philip@philipmcgrath.com \
    --to=philip@philipmcgrath.com \
    --cc=56050@debbugs.gnu.org \
    --cc=ludo@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).