Change:
GNOME Characters does not launch when opened via GNOME Shell (i.e. the overview). It does however launch via the command line () overview to launch gnome characters it will not launch (no window pops up). From the journal: However, if you launch it via the terminal it will work: terminal emulator , press enter Notice how it has launched successfully. System: NixOS 17.09.1880. (Hummingbird) Nix version: nix-env (Nix) 1.11.15 Nixpkgs version: "17.09.1880." Sandboxing enabled: yes
The problem is caused by the DBus service file linking to . The simplest solution is changing the key like we have done but there is also which is not available in . We can wrap the files in but then, it does not work because GJS to load data based on filename. It is possible to override the program name retrieval function in but it is ugly: Optimally, we would patch gjs to return correct , which is where the gets the program name from but I cannot find where is it instantiated.
So the property is defined in cpp code: Program name originates from here: I could try and add a nix-specific patch to do a find/replace of . That might be a good spot to fix it.
I still do not understand why this happens. We run a wrapper in file containing That one executes but with the original name (from ). Should not that make it into ? I have constructed a pair of simple programs that demonstrate this issue: I would expect demo to be printed but this is not the case: What is worse, this behaviour is expected, according to : We should probably take a look at Polari where it somehow works. Maybe, using hardcoded program name for loading the gresource file?
If you look at python scripts; they are wrapped and have a line like the following at the top: So you can that they have to change ; just like we could patch gjs to do. For me, Polari exhibits the same bug. Is that what you are referring to?
Sorry for the last comment; I think I now know what is going on (please correct me if I'm wrong): Moving on, I think I have a patch. I fix the in with the following patch: I then also ensure that wrapGAppsHook is run for the package: I think this works. I've tested by running the dbus service files myself. I don't know how to test with gnome-shell. Gnome-shell seems to require the package to be installed system wide; probably because dbus is a system wide thing (relying tje files the system environment). I'd be interested in opinions for this approach.
That is correct. The crash is caused by schemas not being found. Wrapping the file fixes the schema lookup but instead breaks gresource lookup (which is based on entry point name). That would work for fixing the second issue but it is not really upstreamable. Yes, this will be needed, though you should prevent double-wrapping, see my . Are you sure? Polari places the executable to so it is patched correctly; it works fine for me. I thought Polari previously used directory like does but apparently not, had to be some other app.
Hmm, it was polari after all, I had to modify wrapGAppsHook for it (). is how they fixed it, maybe we can convince GNOME Characters to do the same.
Opened an upstream issue:

Discussion:
<del> { stdenv, fetchurl, meson, ninja, pkgconfig, gettext, gnome3, glib, gtk3, pango, wrapGAppsHook, python3 , gobject-introspection, gjs, libunistring, gsettings-desktop-schemas, adwaita-icon-theme, gnome-desktop }: </del> <ins> { stdenv , fetchurl , meson , ninja , pkgconfig , gettext , gnome3 , glib , gtk3 , pango , wrapGAppsHook , python3 , gobject-introspection , gjs , libunistring , gsettings-desktop-schemas , adwaita-icon-theme , gnome-desktop }: </ins> stdenv.mkDerivation rec { <del> name = "gnome-characters-${version}"; </del> <ins> pname = "gnome-characters"; </ins> version = "3.32.1"; src = fetchurl { <del> url = "mirror://gnome/sources/gnome-characters/${stdenv.lib.versions.majorMinor version}/${name}.tar.xz"; </del> <ins> url = "mirror://gnome/sources/gnome-characters/${stdenv.lib.versions.majorMinor version}/${pname}-${version}.tar.xz"; </ins> sha256 = "1mpg125x9k879ryg8xgbm9w1amx6b3iq9sqv7xfii7kzaanjb4js"; }; <ins> nativeBuildInputs = [ gettext gobject-introspection meson ninja pkgconfig python3 wrapGAppsHook ]; buildInputs = [ adwaita-icon-theme gjs glib gnome-desktop # for typelib gsettings-desktop-schemas gtk3 libunistring pango ]; </ins> postPatch = '' chmod +x meson_post_install.py # patchShebangs requires executable file patchShebangs meson_post_install.py ''; <ins> dontWrapGApps = true; # Fixes https://github.com/NixOS/nixpkgs/issues/31168 postFixup = '' for file in $out/share/org.gnome.Characters/org.gnome.Characters  $out/share/org.gnome.Characters/org.gnome.Characters.BackgroundService do sed -e $"2iimports.package._findEffectiveEntryPointName = () => '$(basename $file)' "  -i $file wrapProgram $file "''${gappsWrapperArgs[@]}" done ''; </ins> passthru = { updateScript = gnome3.updateScript { <del> packageName = "gnome-characters"; attrPath = "gnome3.gnome-characters"; </del> <ins> packageName = pname; attrPath = "gnome3.${pname}"; </ins> }; }; <del> nativeBuildInputs = [ meson ninja pkgconfig gettext wrapGAppsHook python3 gobject-introspection ]; buildInputs = [ glib gtk3 gjs pango gsettings-desktop-schemas adwaita-icon-theme libunistring # typelib gnome-desktop ]; mesonFlags = [ "-Ddbus_service_dir=${placeholder "out"}/share/dbus-1/services" ]; </del> meta = with stdenv.lib; { homepage = https://wiki.gnome.org/Design/Apps/CharacterMap; description = "Simple utility application to find and insert unusual characters";