all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Environment variables on GNOME on foreign distro (Debian)
@ 2020-02-23 21:24 Jorge
  2020-02-24  4:49 ` 宋文武
  0 siblings, 1 reply; 3+ messages in thread
From: Jorge @ 2020-02-23 21:24 UTC (permalink / raw)
  To: help-guix

Hi.  On a previous thread [1] I asked about best practices for Guix
environment variables on foreign distro.  My problem was not
fundamentally solved, and it resurfaced again recently.  In summary:

I use Guix on an updated Debian buster (with 59 packages from
buster-backports) to get some up-to-date packages atop Debian stable.
Currently I set Guix environment variables on ~/.profile, but recently I
started getting error messages from Evince (my Evince is from Debian's
APT).  In fact, in /var/log/user.log I get:

--8<---------------cut here---------------start------------->8---
Feb 23 17:04:19 jorge--inspiron-5570 org.gnome.Evince.desktop[1788]: /home/jorge/.guix-profile/lib/gio/modules/libdconfsettings.so: cannot open shared object file: Permission denied
Feb 23 17:04:19 jorge--inspiron-5570 org.gnome.Evince.desktop[1788]: Failed to load module: /home/jorge/.guix-profile/lib/gio/modules/libdconfsettings.so
Feb 23 17:04:19 jorge--inspiron-5570 evince[5252]: Using the 'memory' GSettings backend.  Your settings will not be saved or shared with other applications.
--8<---------------cut here---------------end--------------->8---

The problem seems to be that Debian's Evince is seeing the
`GIO_EXTRA_MODULES' environment variable from Guix.  In fact:

    $ sudo tr \\0 \\n < "/proc/$(pgrep evince)/environ" | grep GIO_EXTRA_MODULES
    GIO_EXTRA_MODULES=/home/jorge/.guix-profile/lib/gio/modules

Side note: `sudo` was unnecessary in that command.

Ludovic Courtès on 12 Mar 2018 had suggested me to to source
 ~/.guix-profile/etc/profile from ~/.bash_profile (or similar).
However, that does not work, at least for me.  If I source Guix's
etc/profile from ~/.bash_profile, the icons of my graphical Guix
applications fail to appear in my GNOME docker, because XDG_DATA_DIRS
was not set by Guix.  In fact, if I open gnome-terminal and issue
`env | grep -i guix`, I see no Guix environment variables.  In fact,
that happens even inside Guix-installed emacs-next.

So what should I do?

Footnotes:
[1] [[notmuch:id:a1855c067a1a07c20e6bf79fa0a88d64@disroot.org][Email
     Sat, 10 Mar 2018 22:32:37 +0000 from Jorge: Best practices for Guix
     environment variables on foreign distro]],
     https://lists.gnu.org/archive/html/help-guix/2018-03/msg00091.html

Regards
-- 
- <https://jorgemorais.gitlab.io/justice-for-rms/>
- I am Brazilian.  I hope my English is correct and I welcome feedback.
- <https://www.defectivebydesign.org/>
- <https://www.gnu.org/>

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

* Re: Environment variables on GNOME on foreign distro (Debian)
  2020-02-23 21:24 Environment variables on GNOME on foreign distro (Debian) Jorge
@ 2020-02-24  4:49 ` 宋文武
  2020-02-29 17:21   ` Jorge P. de Morais Neto
  0 siblings, 1 reply; 3+ messages in thread
From: 宋文武 @ 2020-02-24  4:49 UTC (permalink / raw)
  To: Jorge; +Cc: help-guix

Jorge <jorge+list@disroot.org> writes:

> Hi.  On a previous thread [1] I asked about best practices for Guix
> environment variables on foreign distro.  My problem was not
> fundamentally solved, and it resurfaced again recently.

Hello, I'd say it's not a solved problem in general.

> In summary:
>
> I use Guix on an updated Debian buster (with 59 packages from
> buster-backports) to get some up-to-date packages atop Debian stable.
> Currently I set Guix environment variables on ~/.profile, but recently I
> started getting error messages from Evince (my Evince is from Debian's
> APT).  In fact, in /var/log/user.log I get:
>
> Feb 23 17:04:19 jorge--inspiron-5570 org.gnome.Evince.desktop[1788]: /home/jorge/.guix-profile/lib/gio/modules/libdconfsettings.so: cannot open shared object file: Permission denied
> Feb 23 17:04:19 jorge--inspiron-5570 org.gnome.Evince.desktop[1788]: Failed to load module: /home/jorge/.guix-profile/lib/gio/modules/libdconfsettings.so
> Feb 23 17:04:19 jorge--inspiron-5570 evince[5252]: Using the 'memory' GSettings backend.  Your settings will not be saved or shared with other applications.
>
> The problem seems to be that Debian's Evince is seeing the
> `GIO_EXTRA_MODULES' environment variable from Guix.  In fact:
>
>     $ sudo tr \0 \n < "/proc/$(pgrep evince)/environ" | grep GIO_EXTRA_MODULES
>     GIO_EXTRA_MODULES=/home/jorge/.guix-profile/lib/gio/modules

Yes, the host evince (and any GNOME apps, in fact) is not compatible
with gio modules from guix, as they may have different glib versions and
ABI.

>
> Side note: `sudo` was unnecessary in that command.
>
> Ludovic Courtès on 12 Mar 2018 had suggested me to to source
>  ~/.guix-profile/etc/profile from ~/.bash_profile (or similar).
> However, that does not work, at least for me.  If I source Guix's
> etc/profile from ~/.bash_profile, the icons of my graphical Guix
> applications fail to appear in my GNOME docker, because XDG_DATA_DIRS
> was not set by Guix.
Well, ~/.profile and ~/.bash_profile should both works for bash, but
your login manager may not source ~/.bash_profile.

> In fact, if I open gnome-terminal and issue
> `env | grep -i guix`, I see no Guix environment variables.  In fact,
> that happens even inside Guix-installed emacs-next.

For ~/.profile (or ~/.bash_profile) to be loaded, gnome-terminal need to
launch a login shell (by default it's not).

>
> So what should I do?

I guess you can:
  figure out what environment variables from guix are needed, what are not.
    (eg: filter out GIO_EXTRA_MOUDLES)
  figure out how the login manager got environment variables, and set them.
    make sure XDG_DATA_DIRS from guix is added here, so that
    applications can be found by the gnome launcher.
    (eg: only from ~/.profile, or other?)
  for guix only environment variables, find a way to launch them.
    (eg: when launch a guix gnome application that requires GIO_EXTRA_MODULES)

Hope it helps!

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

* Re: Environment variables on GNOME on foreign distro (Debian)
  2020-02-24  4:49 ` 宋文武
@ 2020-02-29 17:21   ` Jorge P. de Morais Neto
  0 siblings, 0 replies; 3+ messages in thread
From: Jorge P. de Morais Neto @ 2020-02-29 17:21 UTC (permalink / raw)
  To: 宋文武; +Cc: help-guix

Em [2020-02-24 seg 12:49:32+0800], 宋文武 escreveu:

> Hello, I'd say it's not a solved problem in general.

Sad to hear.

For now, I continue to set GUIX environment variables (including
sourcing "${GUIX_PROFILE}/etc/profile") from ~/.profile.  To avoid the
GIO_EXTRA_MODULES problem, I have moved Gnucash from my default profile
to a separate Guix profile.  This way my default
"${GUIX_PROFILE}/etc/profile" does not export GIO_EXTRA_MODULES.  Then
to launch Gnucash I created an executable Bash script in ~/bin/gnucash
with the following contents:

--8<---------------cut here---------------start------------->8---
#!/usr/bin/env bash

GIO_PROFILE=~/".guix-extra-profiles/GIO_EXTRA_MODULES/GIO_EXTRA_MODULES"
eval $(guix package -p "${GIO_PROFILE}" --search-paths)
gnucash
--8<---------------cut here---------------end--------------->8---

I also copied
~/.guix-extra-profiles/GIO_EXTRA_MODULES/GIO_EXTRA_MODULES/share/applications/gnucash.desktop
into ~/.local/share/applications/gnucash.desktop and changed the Exec
line to

Exec=/home/jorge/bin/gnucash %f

It seems to be working, but I have tested it only lightly.

Regards

-- 
- <https://jorgemorais.gitlab.io/justice-for-rms/>
- I am Brazilian.  I hope my English is correct and I welcome feedback.
- <https://www.defectivebydesign.org/>
- <https://www.gnu.org/>

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

end of thread, other threads:[~2020-02-29 17:22 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-02-23 21:24 Environment variables on GNOME on foreign distro (Debian) Jorge
2020-02-24  4:49 ` 宋文武
2020-02-29 17:21   ` Jorge P. de Morais Neto

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/guix.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.