all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Federico Beffa <beffa@ieee.org>
To: "Ludovic Courtès" <ludo@gnu.org>
Cc: guix-devel@gnu.org
Subject: Re: wrap-program
Date: Fri, 26 Sep 2014 22:09:15 +0200	[thread overview]
Message-ID: <CAKrPhPNcoo3p0+LJiM=C47EFfrkKUTqwfrLoAB1nx1z3JBAu6g@mail.gmail.com> (raw)
In-Reply-To: <87egv15w7s.fsf_-_@gnu.org>

ludo@gnu.org (Ludovic Courtès) writes:

> Mark H Weaver <mhw@netris.org> skribis:
>
>> This 'wrap-program' strategy of setting environment variables before
>> running a program has problems.  In this case, it means that every
>> program run within Emacs will inherit that GSETTINGS_SCHEMA_DIR value.
>>
>> Along the same lines, I've noticed that when running WindowMaker, all of
>> the programs within my X session include a WindowMaker-specific
>> directory at the front of PATH.
>>
>> It would be good to find another solution.
>
> I think whether using ‘wrap-program’ is a good strategy has to be
> evaluated on a case-by-case basis.
>
> In some cases it’s OK, in others (like wmaker), it’s not so nice.
>
> In cases like wmaker, another solution would be to patch the source code
> to execute directly the right binaries, without changing PATH.  The
> downside is that it’s often less convenient to do.

I've looked some more into the problems I've found with the emacs
package:

1. GSettings schemas: More than schemas compilation, the problem is that
the schemas are by default expected to be in $datadir/glib-2.0/schemas
(with $datadir usually being /usr/share).  In spite of this, other
directories can be specified with the help of the environment variable
$XDG_DATA_DIRS.  Since at glib-2.0 compiled time we can't know the path
of future application installations, we may want to define

XDG_DATA_DIRS="$HOME/.guix-profile/share/:$XDG_DATA_DIRS".

If the variable $XDG_DATA_DIRS is not specified, it defaults to
/usr/local/share/:/usr/share/.

https://developer.gnome.org/gio/stable/ch32s06.html
http://standards.freedesktop.org/basedir-spec/basedir-spec-latest.html

2. gtk-3.0 modules: gtk+ looks for modules (like libcanberra.so) in
locations specified by

   a. $GTK_PATH,

   b. $libdir/gtk-3.0/modules, with $libdir being the one specified at
   gtk+-3.0 ./configure time OR $GTK_EXE_PREFIX/lib.

Option a. is inconvenient because that variable is used by both,
gtk+-2.0 and gtk+-3.0, easily leading applications compiled with one
version to find incompatible libraries.

Option b. is more attractive.  Again, at compile time we do not know the
location of future modules installations: Take emacs: it looks in the
gtk+-3.0 directory $libdir/gtk-3.0/modules.  However, it is looking for
a module installed by libcanberra which is not even an input to the
emacs package.  For this reason we should probably define

GTK_EXE_PREFIX="$HOME/.guix-profile"

https://developer.gnome.org/gtk3/3.10/gtk-running.html
Note: the documentation at this site mentions the directory .gtk-3.0 in
$HOME.  However, strace on emacs and the README in the gtk-3.10.1 source
says that this path is no longer used.

Setting the above two variables eliminates both problems (libcanberra
and schemas not found) in the emacs package.  We could probably define
the above variables with 'wrap-program'.  In "guix on distro"
installations this would avoid having guix libraries interfere with a
non guix program.  On the other side, in a guix program launched from
within another guix program, this should be harmless.

We may just want to check that: (i) paths defined in environment
variables are not duplicated by 'wrap-program' definitions (wrap
launched by wrap) and (ii) if the variable is already defined (for "non
guix" reasons), we may want to append the existing value.

The only problem I see right now is if a program is launched by a user
which does not have $HOME/.guix-profile (like a service).  In that case
there could be a default profile.  This could also serve the second
purpose of providing initial default applications (like guix itself!) to
all users on "guix on distro" systems.  And on the gnu system, well,
there are system installed programs.

Regards,
Fede

  reply	other threads:[~2014-09-26 20:09 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-09-13 13:13 emacs package Federico Beffa
2014-09-15  7:55 ` Ludovic Courtès
2014-09-16  7:38   ` Federico Beffa
2014-09-16 20:04     ` Federico Beffa
2014-09-17  9:11       ` Ludovic Courtès
2014-09-17 16:57         ` Federico Beffa
2014-09-18 12:01           ` Ludovic Courtès
2014-09-18 18:37             ` Federico Beffa
2014-09-19  7:54               ` Ludovic Courtès
2014-09-19  8:07                 ` Andreas Enge
2014-09-19 17:13                 ` Federico Beffa
2014-09-19 17:32                   ` Andreas Enge
2014-09-20 13:20                   ` Ludovic Courtès
2014-09-20 19:57                     ` Federico Beffa
2014-09-20 20:28                       ` Ludovic Courtès
2014-09-20 22:02                         ` Federico Beffa
2014-09-22  7:38                           ` GSettings schemas Ludovic Courtès
2014-09-23 18:39                             ` Mark H Weaver
2014-09-24  7:11                               ` wrap-program Ludovic Courtès
2014-09-26 20:09                                 ` Federico Beffa [this message]
2014-09-26 22:17                                   ` wrap-program Federico Beffa
2014-09-27  9:20                                   ` wrap-program Ludovic Courtès
2014-09-27 14:53                                     ` wrap-program Federico Beffa
2014-10-02  7:09                                       ` wrap-program Andreas Enge
2014-10-02  8:41                                         ` wrap-program Ludovic Courtès
2014-09-21 13:28                     ` emacs package Ludovic Courtès
2014-09-21 19:40                       ` Federico Beffa

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

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

  git send-email \
    --in-reply-to='CAKrPhPNcoo3p0+LJiM=C47EFfrkKUTqwfrLoAB1nx1z3JBAu6g@mail.gmail.com' \
    --to=beffa@ieee.org \
    --cc=guix-devel@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 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.