Re: Setting environment variables in Gnome session

2019-08-28 Thread Jonathan Frederickson




On Wed, Aug 28, 2019 at 9:15 PM, Timothy Sample  
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!





Re: Setting environment variables in Gnome session

2019-08-28 Thread Jesse Gibbons
On Wed, 2019-08-28 at 20:50 -0400, Jonathan Frederickson wrote:
> On Wed, Aug 28, 2019 at 8:40 PM, Timothy Sample  
> 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?



Re: Setting environment variables in Gnome session

2019-08-28 Thread Timothy Sample
Hi Jonathan,

Jonathan Frederickson  writes:

> On Wed, Aug 28, 2019 at 8:40 PM, Timothy Sample 
> 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



Re: Setting environment variables in Gnome session

2019-08-28 Thread Jonathan Frederickson



On Wed, Aug 28, 2019 at 8:40 PM, Timothy Sample  
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.)






Re: Setting environment variables in Gnome session

2019-08-28 Thread Timothy Sample
Hi Jonathan,

Jonathan Frederickson  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



Re: Setting environment variables in Gnome session

2019-08-28 Thread Jonathan Frederickson
On Wed, 28 Aug 2019 15:53:48 -0400
Jonathan Frederickson  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.



Setting environment variables in Gnome session

2019-08-28 Thread Jonathan Frederickson
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?