unofficial mirror of help-guix@gnu.org 
 help / color / mirror / Atom feed
* How to set global environment variables in Guix System
@ 2020-12-27 13:35 Lo Peter
  2020-12-27 14:07 ` Michael Rohleder
  2020-12-27 14:39 ` Tobias Geerinckx-Rice
  0 siblings, 2 replies; 5+ messages in thread
From: Lo Peter @ 2020-12-27 13:35 UTC (permalink / raw)
  To: help-guix

Dear All,

I am trying to setup ibus-rime for Chinese input in guix system 1.2.0,
after a lot of googling and trial and error, I found that I cannot set
the needed environment variables:

export GTK_IM_MODULE="ibus"
export QT_IM_MODULE="ibus"
export XMODIFIERS="@im=ibus"

I have tried putting them in ~/.profile, ~/.pam_environment, ~/.xprofile
and it seems they have no effects.

If I am not mistaken, guix system now uses gdm as display manager, but
I also cannot find a way to set environment variable for gdm sessions.

Any help is greatly appreciated. Also, I think a way to let user
customize /etc/environment through the system config will be useful,
but I do not find a way to do so.

Thanks.

Regards,
Peter


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

* Re: How to set global environment variables in Guix System
  2020-12-27 13:35 How to set global environment variables in Guix System Lo Peter
@ 2020-12-27 14:07 ` Michael Rohleder
  2020-12-27 14:39   ` Tobias Geerinckx-Rice via
  2020-12-27 14:39 ` Tobias Geerinckx-Rice
  1 sibling, 1 reply; 5+ messages in thread
From: Michael Rohleder @ 2020-12-27 14:07 UTC (permalink / raw)
  To: Lo Peter; +Cc: help-guix

[-- Attachment #1: Type: text/plain, Size: 545 bytes --]

Lo Peter <peterloleungyau@gmail.com> writes:
> Any help is greatly appreciated. Also, I think a way to let user
> customize /etc/environment through the system config will be useful,
> but I do not find a way to do so.

Try adding something like this to your system services:

(simple-service 'my-ibus-ch-env session-environment-service-type
                  '(("GTK_IM_MODULE" . "ibus")
                    ("QT_IM_MODULE" . "ibus")))
                    
-- 
Das Lernen vieler Dinge lehrt nicht Verständnis.
     Heraklit, B40

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 511 bytes --]

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

* Re: How to set global environment variables in Guix System
  2020-12-27 13:35 How to set global environment variables in Guix System Lo Peter
  2020-12-27 14:07 ` Michael Rohleder
@ 2020-12-27 14:39 ` Tobias Geerinckx-Rice
  1 sibling, 0 replies; 5+ messages in thread
From: Tobias Geerinckx-Rice @ 2020-12-27 14:39 UTC (permalink / raw)
  To: Lo Peter; +Cc: help-guix

[-- Attachment #1: Type: text/plain, Size: 1289 bytes --]

Peter!

Lo Peter 写道:
> ~/.pam_environment

I don't think we configure PAM to look at this by default.  I'm 
not sure why GDM doesn't load ~/.profile (it may be right not to 
-- most of these files are abused).  I'd never heard of 
~/.xprofile.

> Any help is greatly appreciated. Also, I think a way to let user
> customize /etc/environment through the system config will be 
> useful,
> but I do not find a way to do so.

That already exists, but it seems to be wholly undocumented(?). 
Boo.

Also, IIRC blindly plonking

  (session-environment-service-type '(("FOO" . "bar")))

into your services would only get you the ‘duplicate service’ 
error.  It's meant to be extended.

First, define this in your system.scm (above your 
operating-system):

  (define environment-service-type
    (service-type (name 'environment)
                  (default-value '())
                  (extensions
                   (list (service-extension
                          session-environment-service-type
                          identity)))))

Then use it in your services field:

  (service environment-service-type
           '(("GTK_IM_MODULE" . "ibus")
             ("QT_IM_MODULE" . "ibus")
             ...))

I hope that helps,

T G-R

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 247 bytes --]

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

* Re: How to set global environment variables in Guix System
  2020-12-27 14:07 ` Michael Rohleder
@ 2020-12-27 14:39   ` Tobias Geerinckx-Rice via
  2020-12-27 16:22     ` Lo Peter
  0 siblings, 1 reply; 5+ messages in thread
From: Tobias Geerinckx-Rice via @ 2020-12-27 14:39 UTC (permalink / raw)
  To: Michael Rohleder; +Cc: help-guix, Lo Peter

[-- Attachment #1: Type: text/plain, Size: 252 bytes --]

Michael Rohleder 写道:
> (simple-service 'my-ibus-ch-env session-environment-service-type
>                   '(("GTK_IM_MODULE" . "ibus")
>                     ("QT_IM_MODULE" . "ibus")))

...much simpler.  Thanks!

Kind regards,

T G-R

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 247 bytes --]

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

* Re: How to set global environment variables in Guix System
  2020-12-27 14:39   ` Tobias Geerinckx-Rice via
@ 2020-12-27 16:22     ` Lo Peter
  0 siblings, 0 replies; 5+ messages in thread
From: Lo Peter @ 2020-12-27 16:22 UTC (permalink / raw)
  To: Tobias Geerinckx-Rice; +Cc: help-guix

Thanks both for the replies.
If I understand correctly, custom environment variables could be added
through some kind of session-environment-service-type, I will try it
out to learn more.
Just for the record, I currently use a custom ~/.xsession script as a
hack to source ~/.xprofile to set the needed environment variables and
also start ibus-daemon, because I really only need i3 (and xfce as a
fallback).

Thanks.

Regards,
Peter

On Sun, Dec 27, 2020 at 10:39 PM Tobias Geerinckx-Rice <me@tobias.gr> wrote:
>
> Michael Rohleder 写道:
> > (simple-service 'my-ibus-ch-env session-environment-service-type
> >                   '(("GTK_IM_MODULE" . "ibus")
> >                     ("QT_IM_MODULE" . "ibus")))
>
> ...much simpler.  Thanks!
>
> Kind regards,
>
> T G-R


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

end of thread, other threads:[~2020-12-27 16:21 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-12-27 13:35 How to set global environment variables in Guix System Lo Peter
2020-12-27 14:07 ` Michael Rohleder
2020-12-27 14:39   ` Tobias Geerinckx-Rice via
2020-12-27 16:22     ` Lo Peter
2020-12-27 14:39 ` Tobias Geerinckx-Rice

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