unofficial mirror of help-guix@gnu.org 
 help / color / mirror / Atom feed
* Setting environment variables in Gnome session
@ 2019-08-28 19:53 Jonathan Frederickson
  2019-08-28 20:58 ` Jonathan Frederickson
  2019-08-29  0:40 ` Timothy Sample
  0 siblings, 2 replies; 7+ messages in thread
From: Jonathan Frederickson @ 2019-08-28 19:53 UTC (permalink / raw)
  To: help-guix

I'm trying to install some software through Flatpak alongside software
installed through Guix (on a Guix System install) and I'm running into
what feels like it should be a minor issue. On other distros (including
my desktop where I'm running Guix as a foreign package manager), I
would modify XDG_DATA_DIRS in $HOME/.profile to accomplish this.

However, my Gnome session in Guix System seems to ignore this file. 
I've tried creating a file in my home directory in /etc/profile like
so, and as far as I can tell it's never getting run:

export XDG_DATA_DIRS=$XDG_DATA_DIRS:/var/lib/flatpak/exports/share
echo "hi there!" > $HOME/test.txt

Is there a preferred way to set environment variables in a graphical
session?

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

* Re: Setting environment variables in Gnome session
  2019-08-28 19:53 Setting environment variables in Gnome session Jonathan Frederickson
@ 2019-08-28 20:58 ` Jonathan Frederickson
  2019-08-29  0:40 ` Timothy Sample
  1 sibling, 0 replies; 7+ messages in thread
From: Jonathan Frederickson @ 2019-08-28 20:58 UTC (permalink / raw)
  To: help-guix

On Wed, 28 Aug 2019 15:53:48 -0400
Jonathan Frederickson <jonathan@terracrypt.net> wrote:
> However, my Gnome session in Guix System seems to ignore this file. 
> I've tried creating a file in my home directory in /etc/profile like
> so, and as far as I can tell it's never getting run:

Whoops - to be clear, I meant $HOME/.profile when I said /etc/profile
here.

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

* Re: Setting environment variables in Gnome session
  2019-08-28 19:53 Setting environment variables in Gnome session Jonathan Frederickson
  2019-08-28 20:58 ` Jonathan Frederickson
@ 2019-08-29  0:40 ` Timothy Sample
  2019-08-29  0:50   ` Jonathan Frederickson
  1 sibling, 1 reply; 7+ messages in thread
From: Timothy Sample @ 2019-08-29  0:40 UTC (permalink / raw)
  To: Jonathan Frederickson; +Cc: help-guix

Hi Jonathan,

Jonathan Frederickson <jonathan@terracrypt.net> writes:

> I'm trying to install some software through Flatpak alongside software
> installed through Guix (on a Guix System install) and I'm running into
> what feels like it should be a minor issue. On other distros (including
> my desktop where I'm running Guix as a foreign package manager), I
> would modify XDG_DATA_DIRS in $HOME/.profile to accomplish this.
>
> However, my Gnome session in Guix System seems to ignore this file. 
> I've tried creating a file in my home directory in /etc/profile like
> so, and as far as I can tell it's never getting run:
>
> export XDG_DATA_DIRS=$XDG_DATA_DIRS:/var/lib/flatpak/exports/share
> echo "hi there!" > $HOME/test.txt
>
> Is there a preferred way to set environment variables in a graphical
> session?

If you use GDM and GNOME, and have Bash as your shell, you need to set
the variables in “~/.bash_profile” or “~/.bashrc”.  Guix System sets up
GDM to run your X session from the your login shell (which I’m assuming
is Bash).  Since Guix System provides a “~/.bash_profile” file by
default, Bash will read this and skip “~/.profile”.

So if you set the variables in a Bash-specific file it should work.


-- Tim

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

* Re: Setting environment variables in Gnome session
  2019-08-29  0:40 ` Timothy Sample
@ 2019-08-29  0:50   ` Jonathan Frederickson
  2019-08-29  1:15     ` Timothy Sample
  2019-08-29  3:03     ` Jesse Gibbons
  0 siblings, 2 replies; 7+ messages in thread
From: Jonathan Frederickson @ 2019-08-29  0:50 UTC (permalink / raw)
  To: Timothy Sample; +Cc: help-guix


On Wed, Aug 28, 2019 at 8:40 PM, Timothy Sample <samplet@ngyro.com> 
wrote:
> If you use GDM and GNOME, and have Bash as your shell, you need to set
> the variables in “~/.bash_profile” or “~/.bashrc”.  Guix 
> System sets up
> GDM to run your X session from the your login shell (which I’m 
> assuming
> is Bash).  Since Guix System provides a “~/.bash_profile” file by
> default, Bash will read this and skip “~/.profile”.
> 
> So if you set the variables in a Bash-specific file it should work.
> 
> 
> -- Tim

Thanks, but the environment variable I'm looking to set needs to apply 
to Gnome itself rather than my terminal shell. It's the search path 
that Gnome uses to find XDG application files. I believe 
~/.bash_profile is only read by bash specifically?

(I've just tried adding the relevant env var to ~/.bash_profile in any 
case, but it doesn't seem to have affected gnome-shell's environment.)


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

* Re: Setting environment variables in Gnome session
  2019-08-29  0:50   ` Jonathan Frederickson
@ 2019-08-29  1:15     ` Timothy Sample
  2019-08-29  4:06       ` Jonathan Frederickson
  2019-08-29  3:03     ` Jesse Gibbons
  1 sibling, 1 reply; 7+ messages in thread
From: Timothy Sample @ 2019-08-29  1:15 UTC (permalink / raw)
  To: Jonathan Frederickson; +Cc: help-guix

Hi Jonathan,

Jonathan Frederickson <jonathan@terracrypt.net> writes:

> On Wed, Aug 28, 2019 at 8:40 PM, Timothy Sample <samplet@ngyro.com>
> wrote:
>> If you use GDM and GNOME, and have Bash as your shell, you need to set
>> the variables in “~/.bash_profile” or “~/.bashrc”.  Guix System sets
>> up
>> GDM to run your X session from the your login shell (which I’m
>> assuming
>> is Bash).  Since Guix System provides a “~/.bash_profile” file by
>> default, Bash will read this and skip “~/.profile”.
>>
>> So if you set the variables in a Bash-specific file it should work.
>>
>>
>> -- Tim
>
> Thanks, but the environment variable I'm looking to set needs to apply
> to Gnome itself rather than my terminal shell. It's the search path
> that Gnome uses to find XDG application files. I believe
> ~/.bash_profile is only read by bash specifically?

Yes.  Because Bash is your login shell, it gets invoked as part of
spawning your X session.  Because of this, Bash-specific configuration
files affect your X session’s environment.

> (I've just tried adding the relevant env var to ~/.bash_profile in any
> case, but it doesn't seem to have affected gnome-shell's environment.)

In my “~/.bash_profile”, I wrote

    export PROFILE_MESSAGE=HI

Then, I logged out of GNOME and logged back in to GNOME.  After that, I
opened a program – not a terminal :) – from GNOME Shell and confirmed
that it sees that “PROFILE_MESSAGE” is set to “HI”.

Did you log out and in again?


-- Tim

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

* Re: Setting environment variables in Gnome session
  2019-08-29  0:50   ` Jonathan Frederickson
  2019-08-29  1:15     ` Timothy Sample
@ 2019-08-29  3:03     ` Jesse Gibbons
  1 sibling, 0 replies; 7+ messages in thread
From: Jesse Gibbons @ 2019-08-29  3:03 UTC (permalink / raw)
  To: Jonathan Frederickson, Timothy Sample; +Cc: help-guix

On Wed, 2019-08-28 at 20:50 -0400, Jonathan Frederickson wrote:
> On Wed, Aug 28, 2019 at 8:40 PM, Timothy Sample <samplet@ngyro.com> 
> wrote:
> > If you use GDM and GNOME, and have Bash as your shell, you need to
> > set
> > the variables in “~/.bash_profile” or “~/.bashrc”.  Guix 
> > System sets up
> > GDM to run your X session from the your login shell (which I’m 
> > assuming
> > is Bash).  Since Guix System provides a “~/.bash_profile” file by
> > default, Bash will read this and skip “~/.profile”.
> > 
> > So if you set the variables in a Bash-specific file it should work.
> > 
> > 
> > -- Tim
> 
> Thanks, but the environment variable I'm looking to set needs to
> apply 
> to Gnome itself rather than my terminal shell. It's the search path 
> that Gnome uses to find XDG application files. I believe 
> ~/.bash_profile is only read by bash specifically?
> 
> (I've just tried adding the relevant env var to ~/.bash_profile in
> any 
> case, but it doesn't seem to have affected gnome-shell's
> environment.)
> 
> 
IIRC .bash_profile sets variables globally in the login session when
they are exported. Unless I'm mistaken, if that was not the case,
emacs-guix wouldn't be able to recognize my development packages in
$GUIX_PACKAGE_PATH when emacs is launched by gnome. Have you made sure
the variables in question have been exported?

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

* Re: Setting environment variables in Gnome session
  2019-08-29  1:15     ` Timothy Sample
@ 2019-08-29  4:06       ` Jonathan Frederickson
  0 siblings, 0 replies; 7+ messages in thread
From: Jonathan Frederickson @ 2019-08-29  4:06 UTC (permalink / raw)
  To: Timothy Sample; +Cc: help-guix



On Wed, Aug 28, 2019 at 9:15 PM, Timothy Sample <samplet@ngyro.com> 
wrote:
> Yes.  Because Bash is your login shell, it gets invoked as part of
> spawning your X session.  Because of this, Bash-specific configuration
> files affect your X session’s environment.

Oh, interesting! You're right - I did not realize that would happen.

And that was indeed the solution, although I made a mistake at the 
time. I'd initially put that line in bashrc instead while trying 
things, then saw that bash_profile sourced bashrc so assumed it'd do 
the same. I missed, however, that bashrc returned earlier in the file 
if running in a noninteractive shell, so my additions were never 
reached while spawning the X session.

Thank you for the help, and sorry for the run-around!


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

end of thread, other threads:[~2019-08-29  4:07 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-08-28 19:53 Setting environment variables in Gnome session Jonathan Frederickson
2019-08-28 20:58 ` Jonathan Frederickson
2019-08-29  0:40 ` Timothy Sample
2019-08-29  0:50   ` Jonathan Frederickson
2019-08-29  1:15     ` Timothy Sample
2019-08-29  4:06       ` Jonathan Frederickson
2019-08-29  3:03     ` Jesse Gibbons

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