Issues packaging on NixOS

Asked by John

I'm attempting to package onboard for NixOS and I keep running into an issue when the setup.py script executes the 'symlink_extension_libraries(setup_command)' function.

I was wondering if someone could advise on what the problem might be, or at least a way I could get around the symlink issue.

I have opened up a pull request on the NixOS github https://github.com/NixOS/nixpkgs/pull/24986 with my package. The package seems to build until it complains of:

error: [Errno 2] No such file or directory: 'Onboard/pypredict/attic/test-client.py'

Question information

Language:
English Edit question
Status:
Solved
For:
Onboard Edit question
Assignee:
No assignee Edit question
Solved by:
John
Solved:
Last query:
Last reply:
Revision history for this message
marmuta (marmuta) said :
#1

This is probably DistUtilsExtra trying to make sense of the attic files and failing. I'm not sure what exactly happens, you would have to look at auto.py for that.
However the easy fix is to simply delete the offending file(s). Nothing in the attic folder is even used. We should probably remove the whole folder, just to be safe.

Revision history for this message
marmuta (marmuta) said :
#2

OK, Onboard/pypredict/attic is gone in trunk. The next release won't have it anymore.

Revision history for this message
John (johnramsden) said :
#3

Ok, removed Onboard/pypredict/attic. Now i'm getting:

running build_scripts
creating build/scripts-3.5
copying and adjusting onboard -> build/scripts-3.5
copying and adjusting onboard-settings -> build/scripts-3.5
changing mode of build/scripts-3.5/onboard from 644 to 755
changing mode of build/scripts-3.5/onboard-settings from 644 to 755
running build_i18n
intltool-update -p -g onboard
error: [Errno 2] No such file or directory: 'Onboard/pypredict/tools/model_info.py'

Revision history for this message
marmuta (marmuta) said :
#4

Your distutils-extra really wants python files to have a py extension. This isn't supposed to happen. What version is this? Mine is

apt-cache policy python3-distutils-extra
python3-distutils-extra:
  Installed: 2.40
  Candidate: 2.40

Revision history for this message
John (johnramsden) said :
#5

python3.5-distutils-extra-2.39

Would renaming them to *.py help?

Revision history for this message
marmuta (marmuta) said :
#6

Possibly, but I'd rather not. Those are self-contained command line tools, a whole bunch of them in two folders. A py extension just to appease auto.py seems silly. And this hasn't been an issue on Ubuntu, Debian, Arch, Mageia...

I think at this point we have to figure out what exactly is going on. Something must be different. Let me try to install a NixOS partition and attempt to build from source.

Is that NixOS 17.03, or do I need a development version?

Revision history for this message
John (johnramsden) said :
#7

I meant I could try to rename them in the NixOS package only and see if it builds... I'll give it a shot.

It's 17.03.

Revision history for this message
John (johnramsden) said :
#8

So I tried that, added to the prebuild:

    rm -r Onboard/pypredict/attic
    sed -i 's:/bin/bash:${bash}/bin/bash:' ./setup.py
    for file in Onboard/pypredict/tools/*; do cp $file $file.py; done
    cp onboard-settings onboard-settings.py

Now i'm getting this error:

setting SOURCE_DATE_EPOCH to timestamp 1487282339 of file onboard-1.4.1/PKG-INFO
patching sources
configuring
building
found dconf version 0.26.0
Traceback (most recent call last):
  File "nix_run_setup.py", line 8, in <module>
    exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\\r\\n', '\\n'), __file__, 'exec'))
  File "setup.py", line 440, in <module>
    'build_ext': build_ext_custom},
  File "/nix/store/ryjw95ffv0c81z51sl4p3ylpzafiw3zk-python3.5-distutils-extra-2.39/lib/python3.5/site-packages/DistUtilsExtra/auto.py", line 100, in setup
    distutils.core.setup(**attrs)
  File "/nix/store/g8h4lr486n2d9vh13rcjp1w9grakr71m-python3-3.5.3/lib/python3.5/distutils/core.py", line 108, in setup
    _setup_distribution = dist = klass(attrs)
  File "/nix/store/pnv8h734sakwk1mad1id91yv17hzvkss-python3.5-bootstrapped-pip-9.0.1/lib/python3.5/site-packages/setuptools/dist.py", line 318, in __init__
    _Distribution.__init__(self, attrs)
  File "/nix/store/g8h4lr486n2d9vh13rcjp1w9grakr71m-python3-3.5.3/lib/python3.5/distutils/dist.py", line 253, in __init__
    getattr(self.metadata, "set_" + key)(val)
  File "/nix/store/g8h4lr486n2d9vh13rcjp1w9grakr71m-python3-3.5.3/lib/python3.5/distutils/dist.py", line 1218, in set_provides
    distutils.versionpredicate.split_provision(v)
  File "/nix/store/g8h4lr486n2d9vh13rcjp1w9grakr71m-python3-3.5.3/lib/python3.5/distutils/versionpredicate.py", line 162, in split_provision
    raise ValueError("illegal provides specification: %r" % value)
ValueError: illegal provides specification: 'onboard-settings'

Revision history for this message
marmuta (marmuta) said :
#9

split_provision() rings a bell. It's been a while, but I believe this time it's trying to extract version information from onboard-settings' file name and fails. The dash threw auto.py off, IIRC.

Revision history for this message
marmuta (marmuta) said :
#10

intltool was missing from default.nix. auto.py would create temporary links of python files without extension and then error out due to missing intltool-update before it could clean them up again. That's where the initial *py naming confusion came from.

"ValueError: illegal provides specification: 'onboard-settings'" doesn't happen anymore either after that. Didn't look into it anymore.

./setup.py build runs through now, but there are more problems:

The shebangs of all executable scripts would have to be rewritten from
#!/usr/bin/python3
to
#!/usr/bin/env python3
as there are no fixed paths in NixOS. If Francesco has no objections, I'll do this in trunk. I believe shebangs are rewritten anyway during the debian package build.

And the gsettings schema file would need to be installed. Something like
cp data/org.onboard.gschema.xml /usr/share/glib-2.0/schemas/
glib-compile-schemas /usr/share/glib-2.0/schemas
in a NixOS kind of way. I haven't figured out how to do this yet.

If you want to customize onboard's default preferences you can install a gsettings schema override too. This could give the super keys a NixOS specific label for example. There is an example file in the project:

onboard-default-settings.gschema.override.example

Is goes in the same folder as the schema file, for example
cp onboard-default-settings.gschema.override.example /usr/share/glib-2.0/schemas/10_onboard-default-settings.gschema.override

Alternatively, add it's contents to an existing global NixOS override file.

Revision history for this message
marmuta (marmuta) said :
#11

My modified onboard/default.nix:

{ stdenv, fetchurl, bash, gtk3, python3, hunspell, isocodes, libcanberra_gtk3, xorg, libxkbcommon, python35Packages, libudev, gnome3, pkgconfig, intltool
}:

python35Packages.buildPythonApplication rec {
  name = "onboard-${version}";
  majorVersion = "1.4";
  version = "${majorVersion}.1";
  src = fetchurl {
    url = "https://launchpad.net/onboard/${majorVersion}/${version}/+download/${name}.tar.gz";
    sha256 = "01cae1ac5b1ef1ab985bd2d2d79ded6fc99ee04b1535cc1bb191e43a231a3865";
  };

propagatedBuildInputs = [ gtk3
                 python3
                 hunspell
                 isocodes
                 libcanberra_gtk3
                 xorg.libxkbfile
                 libxkbcommon
                 python35Packages.pycairo
                 python35Packages.dbus-python
                 python35Packages.pygobject3
                 python35Packages.systemd
                 libudev
                 python35Packages.distutils_extra
                 gnome3.dconf
                 pkgconfig
                 xorg.libXtst
                 bash
                 intltool];

   preBuild = ''
     rm -r Onboard/pypredict/attic
     sed -i 's:/bin/bash:${bash}/bin/bash:' ./setup.py
     #for file in Onboard/pypredict/tools/*; do cp $file $file.py; done
     #cp onboard-settings onboard-settings.py
   '';

  meta = {
    homepage = https://launchpad.net/onboard;
    description = "An onscreen keyboard useful for tablet PC users and for mobility impaired users.";
    license = stdenv.lib.licenses.gpl3;
  };
}

Revision history for this message
John (johnramsden) said :
#12

There are some Nix specific functions that do some of that, patching the shebangs automatically and running gsettings. I did my best to use them.

Here is my updated code that works better.

---

{ fetchurl
, gtk3
, gnome3
, libcanberra_gtk3
, libudev
, hunspell
, isocodes
, pkgconfig
, xorg
, libxkbcommon
, python3
, python35Packages
, stdenv
, bash
, intltool
, wrapGAppsHook
, glib
}:

python35Packages.buildPythonApplication rec {
  name = "onboard-${version}";
  majorVersion = "1.4";
  version = "${majorVersion}.1";
  src = fetchurl {
    url = "https://launchpad.net/onboard/${majorVersion}/${version}/+download/${name}.tar.gz";
    sha256 = "01cae1ac5b1ef1ab985bd2d2d79ded6fc99ee04b1535cc1bb191e43a231a3865";
  };

  propagatedBuildInputs = [
    gtk3
    gnome3.dconf
    libcanberra_gtk3
    libudev
    bash
    hunspell
    isocodes
    pkgconfig
    xorg.libXtst
    xorg.libxkbfile
    libxkbcommon
    intltool
    wrapGAppsHook
    python3
    python35Packages.pycairo
    python35Packages.dbus-python
    python35Packages.pygobject3
    python35Packages.systemd
    python35Packages.distutils_extra
    glib
  ];

  preBuild = ''
    rm -r Onboard/pypredict/attic
    patchShebangs .
    substituteInPlace ./setup.py --replace /bin/bash ${bash}/bin/bash
  '';

  postInstall = ''
    ${glib.dev}/bin/glib-compile-schemas $out/share/glib-2.0/schemas/
    cp onboard-default-settings.gschema.override.example $out/share/glib-2.0/schemas/10_onboard-default-settings.gschema.override
    '';

  meta = {
    homepage = https://launchpad.net/onboard;
    description = "An onscreen keyboard useful for tablet PC users and for mobility impaired users.";
    license = stdenv.lib.licenses.gpl3;
  };
}

---

It now builds completely but I am getting the following error when run.

---

Traceback (most recent call last):
  File "/nix/store/ar8sjdlrwvaq30gp4mgc3y4xz8nwsy7x-onboard-1.4.1/bin/..onboard-wrapped-wrapped", line 36, in <module>
    from Onboard.OnboardGtk import OnboardGtk as Onboard
  File "/nix/store/ar8sjdlrwvaq30gp4mgc3y4xz8nwsy7x-onboard-1.4.1/lib/python3.5/site-packages/Onboard/OnboardGtk.py", line 35, in <module>
    require_gi_versions()
  File "/nix/store/ar8sjdlrwvaq30gp4mgc3y4xz8nwsy7x-onboard-1.4.1/lib/python3.5/site-packages/Onboard/Version.py", line 24, in require_gi_versions
    gi.require_version('Gtk', '3.0')
  File "/nix/store/sgqhypg37ad4gvgsj5r9gvz1a680xzh3-python3.5-pygobject-3.22.0/lib/python3.5/site-packages/gi/__init__.py", line 118, in require_version
    raise ValueError('Namespace %s not available' % namespace)
ValueError: Namespace Gtk not available

Revision history for this message
marmuta (marmuta) said :
#13

Great, getting closer.
Is Gtk-3.0.typelib installed? On Ubuntu this is a separate package gir1.2-gtk-3.0 that contains
/usr/lib/x86_64-linux-gnu/girepository-1.0/Gdk-3.0.typelib
/usr/lib/x86_64-linux-gnu/girepository-1.0/GdkX11-3.0.typelib
/usr/lib/x86_64-linux-gnu/girepository-1.0/Gtk-3.0.typelib

Onboard uses all of these and a couple other typelibs:
grep gir debian/control
Depends: gir1.2-gdkpixbuf-2.0,
         gir1.2-glib-2.0,
         gir1.2-gtk-3.0,
         gir1.2-pango-1.0 (>= 1.29.3),
Recommends: gir1.2-appindicator3-0.1,
            gir1.2-atspi-2.0,

appindicator3 is for the status icon - optional if the desktop environment is fine with the old GtkStatusIcon. I believe KDE Plasma needs it.
Atspi is for auto-show, word suggestions and others, but not strictly required for a plain keyboard.

Revision history for this message
John (johnramsden) said :
#14

I'm still having trouble getting this packaged. I'm doing what I thought I needed to do to set the typelibs.

I've been setting:

wrapProgram "$out/bin/onboard" \
      --prefix PYTHONPATH : "$PYTHONPATH" \
      --prefix GI_TYPELIB_PATH : "$GI_TYPELIB_PATH"

But it doesn't seem to help.

I'm still getting this error:

Traceback (most recent call last):
  File "/nix/store/ar8sjdlrwvaq30gp4mgc3y4xz8nwsy7x-onboard-1.4.1/bin/..onboard-wrapped-wrapped", line 36, in <module>
    from Onboard.OnboardGtk import OnboardGtk as Onboard
  File "/nix/store/ar8sjdlrwvaq30gp4mgc3y4xz8nwsy7x-onboard-1.4.1/lib/python3.5/site-packages/Onboard/OnboardGtk.py", line 35, in <module>
    require_gi_versions()
  File "/nix/store/ar8sjdlrwvaq30gp4mgc3y4xz8nwsy7x-onboard-1.4.1/lib/python3.5/site-packages/Onboard/Version.py", line 24, in require_gi_versions
    gi.require_version('Gtk', '3.0')
  File "/nix/store/sgqhypg37ad4gvgsj5r9gvz1a680xzh3-python3.5-pygobject-3.22.0/lib/python3.5/site-packages/gi/__init__.py", line 118, in require_version
    raise ValueError('Namespace %s not available' % namespace)
ValueError: Namespace Gtk not available

Revision history for this message
John (johnramsden) said :
#15

Continued:

---

Maybe as the creator of the software you'd have a bit more insight into what might be going wrong.

The setup I'm still trying to get working, https://github.com/NixOS/nixpkgs/pull/24986 looks roughly like this:

---

{ config
, pkgs ? import <nixpkgs> {}
, fetchurl
, gtk3
, gnome3
, libcanberra_gtk3
, libudev
, hunspell
, isocodes
, pkgconfig
, xorg
, libxkbcommon
, python3
, python35Packages
, stdenv
, bash
, intltool
, glib
}:

python35Packages.buildPythonApplication rec {
  name = "onboard-${version}";
  majorVersion = "1.4";
  version = "${majorVersion}.1";
  src = fetchurl {
    url = "https://launchpad.net/onboard/${majorVersion}/${version}/+download/${name}.tar.gz";
    sha256 = "01cae1ac5b1ef1ab985bd2d2d79ded6fc99ee04b1535cc1bb191e43a231a3865";
  };

  doCheck = false;

  propagatedBuildInputs = [
    gtk3
    gnome3.dconf
    libcanberra_gtk3
    libudev
    bash
    hunspell
    isocodes
    pkgconfig
    xorg.libXtst
    xorg.libxkbfile
    libxkbcommon
    intltool
    python3
    python35Packages.pycairo
    python35Packages.dbus-python
    python35Packages.pygobject3
    python35Packages.systemd
    python35Packages.distutils_extra
    python35Packages.pyatspi
    python35Packages.pygobject3
    glib
  ];

  preBuild = ''
    rm -r Onboard/pypredict/attic
    patchShebangs .
    substituteInPlace ./setup.py --replace /bin/bash ${bash}/bin/bash
  '';

  postInstall = ''
    cp onboard-default-settings.gschema.override.example $out/share/glib-2.0/schemas/10_onboard-default-settings.gschema.override
    ${glib.dev}/bin/glib-compile-schemas $out/share/glib-2.0/schemas/

    wrapProgram $out/bin/onboard \
        --set PYTHONPATH "$PYTHONPATH" \
        --set GI_TYPELIB_PATH "$GI_TYPELIB_PATH"
    '';

  meta = {
    homepage = https://launchpad.net/onboard;
    description = "An onscreen keyboard useful for tablet PC users and for mobility impaired users.";
    license = stdenv.lib.licenses.gpl3;
  };
}

--

Revision history for this message
marmuta (marmuta) said :
#16

I had a look at how typelibs are located. libgirepository-1.0-1 does that here and there are two paths it checks:
GI_TYPELIB_PATH and GOBJECT_INTROSPECTION_LIBDIR
https://git.gnome.org/browse/gobject-introspection/tree/girepository/girepository.c#n162

Ubuntu adds a hard-coded third one "/usr/lib/girepository-1.0" but there's only old stuff in there.

I believe GI_TYPELIB_PATH should be left for users to override and not really be set by packages. AFAICT it usually doesn't even exist until a user decides he needs it. I happen to override it currently to point at a staging area that eases development in gnome-shell.

I think GOBJECT_INTROSPECTION_LIBDIR is the one you need. All the important typelibs like Gtk-3.0.typelib, are all located in
GOBJECT_INTROSPECTION_LIBDIR + "girepository-1.0"
which on my system is:
/usr/lib/x86_64-linux-gnu/girepository-1.0/

locate Gtk-3 | grep .typelib
/usr/lib/x86_64-linux-gnu/girepository-1.0/Gtk-3.0.typelib

GOBJECT_INTROSPECTION_LIBDIR comes from configure.ac of package libgirepository-1.0-1:
AS_AC_EXPAND(EXPANDED_LIBDIR, "$libdir")
GOBJECT_INTROSPECTION_LIBDIR="$EXPANDED_LIBDIR"
From the autoconf docs:
— Variable: libdir
    The directory for installing object code libraries.
https://www.gnu.org/software/autoconf/manual/autoconf-2.60/html_node/Installation-Directory-Variables.html

That's how far I came, anyway. If Gtk-3.0.typelib exists, it might just be that the girepository package is configured incorrectly, pointing to the wrong libdir.

Here's a one-liner to test available Gtk typelibs without running Onboard:
python3 -c 'import gi; r=gi.Repository.get_default(); print(r.enumerate_versions("Gtk"))'
['3.0', '2.0']

Revision history for this message
John (johnramsden) said :
#17

Okay, I finally made some progress. Adding the packages gobjectIntrospection gsettings_desktop_schemas, and wrapGAppsHook it seems to boot but now I'm getting a different error:

** (.onboard-wrapped:6052): WARNING **: Error retrieving accessibility bus address: org.freedesktop.DBus.Error.ServiceUnknown: The name org.a11y.Bus was not provided by any .service files
17:05:26.646 WARNING Onboard.Keyboard: Atspi typelib missing, at-spi key-synth unavailable
17:05:26.656 WARNING Onboard.AtspiStateTracker: Atspi typelib missing, auto-show unavailable
17:05:26.682 WARNING Config: mousetweaks GSettings schema not found, mousetweaks integration disabled.
Traceback (most recent call last):
  File "/nix/store/l8bry5j9nf10kk0vgchx9ghmpblr4qhx-onboard-1.4.1/bin/..onboard-wrapped-wrapped", line 37, in <module>
    ob = Onboard()
  File "/nix/store/l8bry5j9nf10kk0vgchx9ghmpblr4qhx-onboard-1.4.1/lib/python3.5/site-packages/Onboard/OnboardGtk.py", line 148, in __init__
    self.init()
  File "/nix/store/l8bry5j9nf10kk0vgchx9ghmpblr4qhx-onboard-1.4.1/lib/python3.5/site-packages/Onboard/OnboardGtk.py", line 178, in init
    config.init()
  File "/nix/store/l8bry5j9nf10kk0vgchx9ghmpblr4qhx-onboard-1.4.1/lib/python3.5/site-packages/Onboard/Config.py", line 370, in init
    self.install_dir = self._get_install_dir()
  File "/nix/store/l8bry5j9nf10kk0vgchx9ghmpblr4qhx-onboard-1.4.1/lib/python3.5/site-packages/Onboard/Config.py", line 1449, in _get_install_dir
    assert(result) # warn early when the installation dir wasn't found
AssertionError

Revision history for this message
marmuta (marmuta) said :
#18

Yay, almost there. That error is Onboard looking for "/usr/share/onboard" or "/usr/local/share/onboard". I thought at first we can make that more flexible, like looking for an environment variable containing the Nix store, but since it's NixOS that deviates from the Filesystem Hierarchy Standard that is probably better done by onboard/default.nix.

These two lines in Onboard/Config.py would have to be modified:
INSTALL_DIR = "/usr/share/onboard"
LOCAL_INSTALL_DIR = "/usr/local/share/onboard"

Onboard needs only one of them, the first one found to exist wins.

I came across
https://github.com/NixOS/nixpkgs/blob/master/pkgs/applications/editors/atom/default.nix
where something similar is done with
substituteInPlace $out/usr/share/applications/atom.desktop \
      --replace /usr/share/atom $out/bin

> ** (.onboard-wrapped:6052): WARNING **: Error retrieving accessibility bus address:
> org.freedesktop.DBus.Error.ServiceUnknown: The name org.a11y.Bus was not provided by any .service files
> 17:05:26.646 WARNING Onboard.Keyboard: Atspi typelib missing, at-spi key-synth unavailable
> 17:05:26.656 WARNING Onboard.AtspiStateTracker: Atspi typelib missing, auto-show unavailable
These are due to Atspi-2.0.typelib missing. It should start up anyway for now, just with reduced functionality.

 > 17:05:26.682 WARNING Config: mousetweaks GSettings schema not found, mousetweaks
mousetweaks is optional too, but the hover click button won't work without it.

Revision history for this message
John (johnramsden) said :
#19

That helps, I fixed that one but there must be a lot of hard-coded paths because I found some more. I'll have to look through and replace all of them. For now I'm getting this error:

** (.onboard-wrapped:10173): WARNING **: Error retrieving accessibility bus address: org.freedesktop.DBus.Error.ServiceUnknown: The name org.a11y.Bus was not provided by any .service files
15:01:33.962 WARNING Onboard.Keyboard: Atspi typelib missing, at-spi key-synth unavailable
15:01:33.971 WARNING Onboard.AtspiStateTracker: Atspi typelib missing, auto-show unavailable
15:01:33.998 WARNING Config: mousetweaks GSettings schema not found, mousetweaks integration disabled.

(onboard:10173): dconf-WARNING **: failed to commit changes to dconf: GDBus.Error:org.freedesktop.DBus.Error.ServiceUnknown: The name ca.desrt.dconf was not provided by any .service files

(onboard:10173): Gtk-WARNING **: Theme parsing error: gtk.css:68:35: The style property GtkButton:child-displacement-x is deprecated and shouldn't be used anymore. It will be removed in a future version

(onboard:10173): Gtk-WARNING **: Theme parsing error: gtk.css:69:35: The style property GtkButton:child-displacement-y is deprecated and shouldn't be used anymore. It will be removed in a future version

(onboard:10173): Gtk-WARNING **: Theme parsing error: gtk.css:73:46: The style property GtkScrolledWindow:scrollbars-within-bevel is deprecated and shouldn't be used anymore. It will be removed in a future version
Traceback (most recent call last):
  File "/nix/store/hfvk125qq745pr7xzvaq782aabgy4vds-onboard-1.4.1/bin/..onboard-wrapped-wrapped", line 37, in <module>
    ob = Onboard()
  File "/nix/store/hfvk125qq745pr7xzvaq782aabgy4vds-onboard-1.4.1/lib/python3.5/site-packages/Onboard/OnboardGtk.py", line 148, in __init__
    self.init()
  File "/nix/store/hfvk125qq745pr7xzvaq782aabgy4vds-onboard-1.4.1/lib/python3.5/site-packages/Onboard/OnboardGtk.py", line 189, in init
    self._init_delayed()
  File "/nix/store/hfvk125qq745pr7xzvaq782aabgy4vds-onboard-1.4.1/lib/python3.5/site-packages/Onboard/OnboardGtk.py", line 202, in _init_delayed
    self.keyboard = Keyboard(self)
  File "/nix/store/hfvk125qq745pr7xzvaq782aabgy4vds-onboard-1.4.1/lib/python3.5/site-packages/Onboard/Keyboard.py", line 663, in __init__
    WordSuggestions.__init__(self)
  File "/nix/store/hfvk125qq745pr7xzvaq782aabgy4vds-onboard-1.4.1/lib/python3.5/site-packages/Onboard/WordSuggestions.py", line 63, in __init__
    self._languagedb = LanguageDB(self)
  File "/nix/store/hfvk125qq745pr7xzvaq782aabgy4vds-onboard-1.4.1/lib/python3.5/site-packages/Onboard/LanguageSupport.py", line 73, in __init__

(onboard:10173): dconf-WARNING **: failed to commit changes to dconf: GDBus.Error:org.freedesktop.DBus.Error.ServiceUnknown: The name ca.desrt.dconf was not provided by any .service files
    self._iso_codes = ISOCodes()
  File "/nix/store/hfvk125qq745pr7xzvaq782aabgy4vds-onboard-1.4.1/lib/python3.5/site-packages/Onboard/LanguageSupport.py", line 209, in __init__
    self._read_all()
  File "/nix/store/hfvk125qq745pr7xzvaq782aabgy4vds-onboard-1.4.1/lib/python3.5/site-packages/Onboard/LanguageSupport.py", line 227, in _read_all
    self._read_languages()
  File "/nix/store/hfvk125qq745pr7xzvaq782aabgy4vds-onboard-1.4.1/lib/python3.5/site-packages/Onboard/LanguageSupport.py", line 231, in _read_languages
    with open_utf8("/usr/share/xml/iso-codes/iso_639.xml") as f:
  File "/nix/store/hfvk125qq745pr7xzvaq782aabgy4vds-onboard-1.4.1/lib/python3.5/site-packages/Onboard/utils.py", line 1204, in open_utf8
    return open(filename, mode=mode, encoding="UTF-8")
FileNotFoundError: [Errno 2] No such file or directory: '/usr/share/xml/iso-codes/iso_639.xml'

Must be a similar idea

Revision history for this message
marmuta (marmuta) said :
#20

Right, there are more. ISOCodes, the hunspell backend of SpellChecker, Indicator opening yelp... They should all probably use a common root for /usr. Then you would have to replace just one location in Config.py. I'll look into that. Could you post your latest default.nix? I might want to test that in NixOS.

Revision history for this message
John (johnramsden) said :
#21

Great news! I finally got it running! I grepped through all the different code and found all the different paths that are pointing to hardcoded locations. There were quite a few of them.

If you want to see my current code, my private repository is here: https://github.com/johnramsden/NixOS/blob/master/software/packages/onboard/default.nix

Also, the pull request, which I update a bit less often, is here: https://github.com/NixOS/nixpkgs/pull/24986

I've been updating the pull repository every so often.

---

The current code that runs on my machine is the following:

---

  { config
  , pkgs
  , fetchurl
  , gtk3
  , gnome3
  , libcanberra_gtk3
  , libudev
  , hunspell
  , isocodes
  , pkgconfig
  , xorg
  , libxkbcommon
  , python3
  , python35Packages
  , stdenv
  , bash
  , intltool
  , glib
  , gobjectIntrospection
  , gsettings_desktop_schemas
  , wrapGAppsHook
  }:

  python35Packages.buildPythonApplication rec {
    name = "onboard-${version}";
    majorVersion = "1.4";
    version = "${majorVersion}.1";
    src = fetchurl {
      url = "https://launchpad.net/onboard/${majorVersion}/${version}/+download/${name}.tar.gz";
      sha256 = "01cae1ac5b1ef1ab985bd2d2d79ded6fc99ee04b1535cc1bb191e43a231a3865";
    };

    doCheck = false;

    propagatedBuildInputs = [
      gtk3
      gnome3.dconf
      libcanberra_gtk3
      libudev
      bash
      hunspell
      isocodes
      pkgconfig
      xorg.libXtst
      xorg.libxkbfile
      libxkbcommon
      intltool
      python3
      python35Packages.pycairo
      python35Packages.dbus-python
      python35Packages.pygobject3
      python35Packages.systemd
      python35Packages.distutils_extra
      python35Packages.pyatspi
      python35Packages.pygobject3
      glib
      gobjectIntrospection
      gsettings_desktop_schemas
      wrapGAppsHook
    ];

    preBuild = ''
      rm -r Onboard/pypredict/attic
      patchShebangs .
      patchShebangs ./Onboard/
      patchShebangs ./scripts/
      patchShebangs ./Onboard/test/
      patchShebangs ./Onboard/pypredict/
      patchShebangs ./Onboard/pypredict/lm/
      patchShebangs ./Onboard/pypredict/test/
      patchShebangs ./Onboard/pypredict/tools/
      substituteInPlace ./Onboard/LanguageSupport.py --replace "/usr/share/xml/iso-codes" ${isocodes}/share/xml/iso-codes
      substituteInPlace ./Onboard/LanguageSupport.py --replace /usr/bin/yelp ${pkgs.yelp}/bin/yelp
      substituteInPlace ./Onboard/Indicator.py --replace /usr/bin/yelp ${pkgs.yelp}/bin/yelp
      substituteInPlace ./<email address hidden>/extension.js --replace /usr/bin/yelp ${pkgs.yelp}/bin/yelp
      substituteInPlace ./Onboard/SpellChecker.py --replace "/usr/share/hunspell" ${pkgs.hunspell}/bin/hunspell
      substituteInPlace ./data/org.onboard.Onboard.service --replace "/usr/bin" "out/bin"
      substituteInPlace ./Onboard/utils.py --replace "/usr/share" "out/share"
      substituteInPlace ./onboard-defaults.conf.example --replace "/usr/share" "out/share"
      substituteInPlace ./Onboard/Config.py --replace "/usr/share/onboard" "$out/share/onboard"
      substituteInPlace ./Onboard/WordSuggestions.py --replace "/usr/bin" "out/bin"
      substituteInPlace ./setup.py --replace /bin/bash ${stdenv.shell}
      substituteInPlace ./Onboard/TextDomain.py --replace /bin/bash ${stdenv.shell}
    '';

    postInstall = ''
      cp onboard-default-settings.gschema.override.example $out/share/glib-2.0/schemas/10_onboard-default-settings.gschema.override
      ${glib.dev}/bin/glib-compile-schemas $out/share/glib-2.0/schemas/
      addToSearchPath GI_TYPELIB_PATH $out/lib/girepository-1.0
      addToSearchPath XDG_DATA_DIRS $out/share
      '';

    meta = {
      homepage = https://launchpad.net/onboard;
      description = "An onscreen keyboard useful for tablet PC users and for mobility impaired users.";
      license = stdenv.lib.licenses.gpl3;
    };
  }

---

I put the error message I'm getting in the leaves commit, but I guess I'll also post it here. This is what happens when you try to access the preferences:

---

** (.onboard-wrapped:19926): WARNING **: Error retrieving accessibility bus address: org.freedesktop.DBus.Error.ServiceUnknown: The name org.a11y.Bus was not provided by any .service files
17:45:29.394 WARNING Onboard.Keyboard: Atspi typelib missing, at-spi key-synth unavailable
17:45:29.404 WARNING Onboard.AtspiStateTracker: Atspi typelib missing, auto-show unavailable
17:45:29.434 WARNING Config: mousetweaks GSettings schema not found, mousetweaks integration disabled.

(onboard:19926): dconf-WARNING **: failed to commit changes to dconf: GDBus.Error:org.freedesktop.DBus.Error.ServiceUnknown: The name ca.desrt.dconf was not provided by any .service files

(onboard:19926): Gtk-WARNING **: Theme parsing error: gtk.css:68:35: The style property GtkButton:child-displacement-x is deprecated and shouldn't be used anymore. It will be removed in a future version

(onboard:19926): Gtk-WARNING **: Theme parsing error: gtk.css:69:35: The style property GtkButton:child-displacement-y is deprecated and shouldn't be used anymore. It will be removed in a future version

(onboard:19926): Gtk-WARNING **: Theme parsing error: gtk.css:73:46: The style property GtkScrolledWindow:scrollbars-within-bevel is deprecated and shouldn't be used anymore. It will be removed in a future version

(onboard:19926): dconf-WARNING **: failed to commit changes to dconf: GDBus.Error:org.freedesktop.DBus.Error.ServiceUnknown: The name ca.desrt.dconf was not provided by any .service files
Traceback (most recent call last):
  File "/nix/store/sppr7zxhbnq6hvmf8vvw7k7jsrafqnbm-onboard-1.4.1/lib/python3.5/site-packages/Onboard/XInput.py", line 393, in _on_device_event
    callback(ev)
  File "/nix/store/sppr7zxhbnq6hvmf8vvw7k7jsrafqnbm-onboard-1.4.1/lib/python3.5/site-packages/Onboard/TouchInput.py", line 436, in _on_device_event
    self._on_button_release_event(self, event)
  File "/nix/store/sppr7zxhbnq6hvmf8vvw7k7jsrafqnbm-onboard-1.4.1/lib/python3.5/site-packages/Onboard/TouchInput.py", line 592, in _on_button_release_event
    self._input_sequence_end(sequence)
  File "/nix/store/sppr7zxhbnq6hvmf8vvw7k7jsrafqnbm-onboard-1.4.1/lib/python3.5/site-packages/Onboard/TouchInput.py", line 740, in _input_sequence_end
    self.on_input_sequence_end(sequence)
  File "/nix/store/sppr7zxhbnq6hvmf8vvw7k7jsrafqnbm-onboard-1.4.1/lib/python3.5/site-packages/Onboard/KeyboardWidget.py", line 1180, in on_input_sequence_end
    self.key_up(sequence)
  File "/nix/store/sppr7zxhbnq6hvmf8vvw7k7jsrafqnbm-onboard-1.4.1/lib/python3.5/site-packages/Onboard/KeyboardWidget.py", line 1239, in key_up
    not sequence.cancel_key_action)
  File "/nix/store/sppr7zxhbnq6hvmf8vvw7k7jsrafqnbm-onboard-1.4.1/lib/python3.5/site-packages/Onboard/Keyboard.py", line 1148, in key_up
    self._do_key_up_action(key, view, button, event_type)
  File "/nix/store/sppr7zxhbnq6hvmf8vvw7k7jsrafqnbm-onboard-1.4.1/lib/python3.5/site-packages/Onboard/Keyboard.py", line 1294, in _do_key_up_action
    self._release_non_sticky_key(key, view, button, event_type)
  File "/nix/store/sppr7zxhbnq6hvmf8vvw7k7jsrafqnbm-onboard-1.4.1/lib/python3.5/site-packages/Onboard/Keyboard.py", line 1664, in _release_non_sticky_key
    self.send_key_up(key, view, button, event_type)
  File "/nix/store/sppr7zxhbnq6hvmf8vvw7k7jsrafqnbm-onboard-1.4.1/lib/python3.5/site-packages/Onboard/Keyboard.py", line 1376, in send_key_up
    self.send_key_release(key, view, button, event_type)
  File "/nix/store/sppr7zxhbnq6hvmf8vvw7k7jsrafqnbm-onboard-1.4.1/lib/python3.5/site-packages/Onboard/Keyboard.py", line 1626, in send_key_release
    controller.release(view, button, event_type)
  File "/nix/store/sppr7zxhbnq6hvmf8vvw7k7jsrafqnbm-onboard-1.4.1/lib/python3.5/site-packages/Onboard/Keyboard.py", line 2834, in release
    run_script("sokSettings")
  File "/nix/store/sppr7zxhbnq6hvmf8vvw7k7jsrafqnbm-onboard-1.4.1/lib/python3.5/site-packages/Onboard/utils.py", line 214, in run_script
    a =__import__(script)
  File "/nix/store/sppr7zxhbnq6hvmf8vvw7k7jsrafqnbm-onboard-1.4.1/share/onboard/scripts/sokSettings.py", line 2
    export PATH=/nix/store/76rgpkm1jqgqwz4bjnk8y37z29q82zgy-python3-3.5.3/bin:/nix/store/sppr7zxhbnq6hvmf8vvw7k7jsrafqnbm-onboard-1.4.1/bin:/nix/store/63spjx86svppz695s5yy7mh2h6lbbca1-gtk+3-3.22.8-dev/bin:/nix/store/k6bmqyh6yf8pzrhnfbzkqdrb3g0hb5gj-expat-2.2.0-dev/bin:/nix/store/pmp2ysvnrmcfzdjmaqnyhda96zkf2z6f-glib-2.50.3-dev/bin:/nix/store/8xm32qg4xi1l41zng4xv752492h6wmdp-cairo-1.14.8-dev/bin:/nix/store/dg3c94l36n3zmrpq9p9qyfi6407rhv5f-freetype-2.6.5-dev/bin:/nix/store/6fc4ak60p1mnilrjfcyz0sywwmpmf45w-bzip2-1.0.6.0.1-bin/bin:/nix/store/j8japwvk2qq8wf9yddibs4fnp99hskkw-libpng-apng-1.6.28-dev/bin:/nix/store/fsqw38ydj8wfj606rzkdcb3rrmpnhb4q-fontconfig-2.12.1-bin/bin:/nix/store/3hz3ll4ikznx3b6cd3myvrm5i79kyj8y-harfbuzz-1.4.2-dev/bin:/nix/store/pr6x655sz1n1sqjhch2i64h5l8i48xrm-graphite2-1.3.6/bin:/nix/store/7wc7qlqg7vsbav3vrjmkfbjbxpp9nnpr-pango-1.40.3-bin/bin:/nix/store/mrzs48prbr7aync14ns4l2j2s489sx50-gdk-pixbuf-2.36.5-dev/bin:/nix/store/sqxw6zlqy91y5nhl4smr5smixkqhdr1k-libjpeg-turbo-1.5.1-bin/bin:/nix/store/s2hmf51bprsxb20v3bfigs8a7zsw3hjl-xz-5.2.2-bin/bin:/nix/store/i14lfjn7cgfmghak3hqczmd90dymsbaj-libtiff-4.0.7-bin/bin:/nix/store/8iavg1dpbz7w9lqgv35q0a6hdkr0gpxi-jasper-2.0.12-bin/bin:/nix/store/pj75dhcgcnnv7ws860bs2zf23hzk2bjz-gdk-pixbuf-2.36.5/bin:/nix/store/qja3mjgiz9c7ld1ddffgc7b487mv1zmh-gobject-introspection-1.50.0-dev/bin:/nix/store/6l6kkkvbz9nxc7pi8m4wcq0z60bmp74a-wayland-1.12.0/bin:/nix/store/q5l53jgm2crfih93l56lcl8mxjywygs9-cups-2.1.4-dev/bin:/nix/store/3gi4zw66q73hdal18akrca30rf02zblq-cups-2.1.4/bin:/nix/store/bx1091kbmwff89gmmxy3za426ryxg0jm-gtk+3-3.22.8/bin:/nix/store/2byhribnzhiy7zhp838fc833xdhnl5l8-dconf-0.26.0/bin:/nix/store/iwm7yk3a40wn400wlqv0rx0zhc7rk756-libcanberra-0.30/bin:/nix/store/px7a1kq4prjzw17c9pppssdmibqqdm2p-systemd-232/bin:/nix/store/fi3mbd2ml4pbgzyasrlnp0wyy6qi48fh-bash-4.4-p5/bin:/nix/store/nqini3ad62zhsknqdpsjcgcm68d1n4gl-hunspell-1.3.3-bin/bin:/nix/store/q2djjbafrmarpv3iqc6scqnsxrdlqxvb-pkg-config-0.29/bin:/nix/store/0l73r9z7q5zjyvghnkd9wm8bihf9gg2p-intltool-0.51.0/bin:/nix/store/lkdr3z34n6n17g7xiaw8plyw7hv9idsl-gettext-0.19.8/bin:/nix/store/nsa311yg8h93wfaacjk16c96a98bs09f-perl-5.22.3/bin:/nix/store/4yn2vyzz1mwl9ry9l67y9bmyasjp7jrj-python3.5-setuptools-30.2.0/bin:/nix/store/087w6yxwq3skp2zppahq8dvfa2idckv7-librsvg-2.40.16/bin${PATH:+:}$PATH
              ^
SyntaxError: invalid syntax

---

Revision history for this message
marmuta (marmuta) said :
#22

Awesome, made it!

SpellChecker.py has /usr/lib paths too, you might want to replace these as well.

I'm not sure about the error. Is this an issue with variable substitution in PATH? Does
echo $PATH
still contain the PATH variable? That shouldn't happen.

In order to get word suggestions, auto-show, etc. you may want to try setting up AT-SPI. The Debian package names are gir1.2-atspi-2.0 libgail-common libatk-adaptor qt-at-spi llibreoffice-gtk3 and for Java applications libatk-wrapper-java (often skipped due to large number of dependencies).

The goal is to get the AT-SPI registry running
ps aux | grep -i [a]t-spi
user 2455 0.0 0.0 349476 6292 ? Sl 08:02 0:00 /usr/lib/at-spi2-core/at-spi-bus-launcher -PSaunch-immediately
user 2467 0.0 0.0 45984 4912 ? S 08:02 0:02 /usr/bin/dbus-daemon --config-file=/usr/share/defaults/at-spi2/accessibility.conf --nofork --print-address 3
user 2480 0.0 0.0 218212 6832 ? Sl 08:02 0:01 /usr/lib/at-spi2-core/at-spi2-registryd --use-gnome-session

Orca needs all this too, so if accessibility is a topic in NixOS at all, the bulk of the work might have been done already.

Revision history for this message
marmuta (marmuta) said :
#23

Does
python3 -c "import scripts.sokSettings; scripts.sokSettings.run()"
open preferences?

Revision history for this message
John (johnramsden) said :
#24

I'm not really concerned with word suggestions or auto show personally, so if it includes a lot of dependencies maybe I'll leave it out for now. It can always be added later if someone requested. Orca doesn't seem to be in Nixpkgs either so I'm not sure if everything would be there for it anyway.

---

python3 -c "import scripts.sokSettings; scripts.sokSettings.run()"
Traceback (most recent call last):
  File "<string>", line 1, in <module>
ImportError: No module named 'scripts'

---

I'll replace the other paths as well, hopefully that fixes the error.

That error with the large path variable is related to the script that acts as a wrapper to run onboard. It's a script that sets up the correct environment and calls the actual filed that it's renamed to .<filename>-wrapped

---

cat /nix/store/5cwnb0da5rjm9ni4pf1fg7i2ng6k5c8j-onboard-1.4.1/share/onboard/scripts/sokSettings.py

#! /nix/store/fi3mbd2ml4pbgzyasrlnp0wyy6qi48fh-bash-4.4-p5/bin/bash -e
export PATH=/nix/store/76rgpkm1jqgqwz4bjnk8y37z29q82zgy-python3-3.5.3/bin:/nix/store/5cwnb0da5rjm9ni4pf1fg7i2ng6k5c8j-onboard-1.4.1/bin:/nix/store/63spjx86svppz695s5yy7mh2h6lbbca1-gtk+3-3.22.8-dev/bin:/nix/store/k6bmqyh6yf8pzrhnfbzkqdrb3g0hb5gj-expat-2.2.0-dev/bin:/nix/store/pmp2ysvnrmcfzdjmaqnyhda96zkf2z6f-glib-2.50.3-dev/bin:/nix/store/8xm32qg4xi1l41zng4xv752492h6wmdp-cairo-1.14.8-dev/bin:/nix/store/dg3c94l36n3zmrpq9p9qyfi6407rhv5f-freetype-2.6.5-dev/bin:/nix/store/6fc4ak60p1mnilrjfcyz0sywwmpmf45w-bzip2-1.0.6.0.1-bin/bin:/nix/store/j8japwvk2qq8wf9yddibs4fnp99hskkw-libpng-apng-1.6.28-dev/bin:/nix/store/fsqw38ydj8wfj606rzkdcb3rrmpnhb4q-fontconfig-2.12.1-bin/bin:/nix/store/3hz3ll4ikznx3b6cd3myvrm5i79kyj8y-harfbuzz-1.4.2-dev/bin:/nix/store/pr6x655sz1n1sqjhch2i64h5l8i48xrm-graphite2-1.3.6/bin:/nix/store/7wc7qlqg7vsbav3vrjmkfbjbxpp9nnpr-pango-1.40.3-bin/bin:/nix/store/mrzs48prbr7aync14ns4l2j2s489sx50-gdk-pixbuf-2.36.5-dev/bin:/nix/store/sqxw6zlqy91y5nhl4smr5smixkqhdr1k-libjpeg-turbo-1.5.1-bin/bin:/nix/store/s2hmf51bprsxb20v3bfigs8a7zsw3hjl-xz-5.2.2-bin/bin:/nix/store/i14lfjn7cgfmghak3hqczmd90dymsbaj-libtiff-4.0.7-bin/bin:/nix/store/8iavg1dpbz7w9lqgv35q0a6hdkr0gpxi-jasper-2.0.12-bin/bin:/nix/store/pj75dhcgcnnv7ws860bs2zf23hzk2bjz-gdk-pixbuf-2.36.5/bin:/nix/store/qja3mjgiz9c7ld1ddffgc7b487mv1zmh-gobject-introspection-1.50.0-dev/bin:/nix/store/6l6kkkvbz9nxc7pi8m4wcq0z60bmp74a-wayland-1.12.0/bin:/nix/store/q5l53jgm2crfih93l56lcl8mxjywygs9-cups-2.1.4-dev/bin:/nix/store/3gi4zw66q73hdal18akrca30rf02zblq-cups-2.1.4/bin:/nix/store/bx1091kbmwff89gmmxy3za426ryxg0jm-gtk+3-3.22.8/bin:/nix/store/2byhribnzhiy7zhp838fc833xdhnl5l8-dconf-0.26.0/bin:/nix/store/iwm7yk3a40wn400wlqv0rx0zhc7rk756-libcanberra-0.30/bin:/nix/store/px7a1kq4prjzw17c9pppssdmibqqdm2p-systemd-232/bin:/nix/store/fi3mbd2ml4pbgzyasrlnp0wyy6qi48fh-bash-4.4-p5/bin:/nix/store/nqini3ad62zhsknqdpsjcgcm68d1n4gl-hunspell-1.3.3-bin/bin:/nix/store/q2djjbafrmarpv3iqc6scqnsxrdlqxvb-pkg-config-0.29/bin:/nix/store/0l73r9z7q5zjyvghnkd9wm8bihf9gg2p-intltool-0.51.0/bin:/nix/store/lkdr3z34n6n17g7xiaw8plyw7hv9idsl-gettext-0.19.8/bin:/nix/store/nsa311yg8h93wfaacjk16c96a98bs09f-perl-5.22.3/bin:/nix/store/4yn2vyzz1mwl9ry9l67y9bmyasjp7jrj-python3.5-setuptools-30.2.0/bin:/nix/store/087w6yxwq3skp2zppahq8dvfa2idckv7-librsvg-2.40.16/bin${PATH:+:}$PATH
exec -a "$0" "/nix/store/5cwnb0da5rjm9ni4pf1fg7i2ng6k5c8j-onboard-1.4.1/share/onboard/scripts/.sokSettings.py-wrapped" "${extraFlagsArray[@]}" "$@"

Revision history for this message
marmuta (marmuta) said :
#25

> python3 -c "import scripts.sokSettings; scripts.sokSettings.run()"
> Traceback (most recent call last):
> File "<string>", line 1, in <module>
> ImportError: No module named 'scripts'
This will only work from the source directory, where "scripts" is a sub-directory of the current directory.

> That error with the large path variable is related to the script that acts as a wrapper to run onboard.
Ah, I see, that's explains it. sokSettings is imported by Onboard and thus is expected to be pure Python. I's not ran like a sub-process, it's a sub-module that extends Onboard. The wrapping is probably not needed. I would remove it and try again.

> I'm not really concerned with word suggestions or auto show personally
OK, though people will probably ask you how to enable it eventually ;). I'll be around.

Revision history for this message
John (johnramsden) said :
#26

Ah, that makes sense. I ran what you said. Looks like that's the issue.

---

python3 -c "import scripts.sokSettings; scripts.sokSettings.run()"
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/nix/store/5cwnb0da5rjm9ni4pf1fg7i2ng6k5c8j-onboard-1.4.1/share/onboard/scripts/sokSettings.py", line 2
    export PATH=/nix/store/76rgpkm1jqgqwz4bjnk8y37z29q82zgy-python3-3.5.3/bin:/nix/store/5cwnb0da5rjm9ni4pf1fg7i2ng6k5c8j-onboard-1.4.1/bin:/nix/store/63spjx86svppz695s5yy7mh2h6lbbca1-gtk+3-3.22.8-dev/bin:/nix/store/k6bmqyh6yf8pzrhnfbzkqdrb3g0hb5gj-expat-2.2.0-dev/bin:/nix/store/pmp2ysvnrmcfzdjmaqnyhda96zkf2z6f-glib-2.50.3-dev/bin:/nix/store/8xm32qg4xi1l41zng4xv752492h6wmdp-cairo-1.14.8-dev/bin:/nix/store/dg3c94l36n3zmrpq9p9qyfi6407rhv5f-freetype-2.6.5-dev/bin:/nix/store/6fc4ak60p1mnilrjfcyz0sywwmpmf45w-bzip2-1.0.6.0.1-bin/bin:/nix/store/j8japwvk2qq8wf9yddibs4fnp99hskkw-libpng-apng-1.6.28-dev/bin:/nix/store/fsqw38ydj8wfj606rzkdcb3rrmpnhb4q-fontconfig-2.12.1-bin/bin:/nix/store/3hz3ll4ikznx3b6cd3myvrm5i79kyj8y-harfbuzz-1.4.2-dev/bin:/nix/store/pr6x655sz1n1sqjhch2i64h5l8i48xrm-graphite2-1.3.6/bin:/nix/store/7wc7qlqg7vsbav3vrjmkfbjbxpp9nnpr-pango-1.40.3-bin/bin:/nix/store/mrzs48prbr7aync14ns4l2j2s489sx50-gdk-pixbuf-2.36.5-dev/bin:/nix/store/sqxw6zlqy91y5nhl4smr5smixkqhdr1k-libjpeg-turbo-1.5.1-bin/bin:/nix/store/s2hmf51bprsxb20v3bfigs8a7zsw3hjl-xz-5.2.2-bin/bin:/nix/store/i14lfjn7cgfmghak3hqczmd90dymsbaj-libtiff-4.0.7-bin/bin:/nix/store/8iavg1dpbz7w9lqgv35q0a6hdkr0gpxi-jasper-2.0.12-bin/bin:/nix/store/pj75dhcgcnnv7ws860bs2zf23hzk2bjz-gdk-pixbuf-2.36.5/bin:/nix/store/qja3mjgiz9c7ld1ddffgc7b487mv1zmh-gobject-introspection-1.50.0-dev/bin:/nix/store/6l6kkkvbz9nxc7pi8m4wcq0z60bmp74a-wayland-1.12.0/bin:/nix/store/q5l53jgm2crfih93l56lcl8mxjywygs9-cups-2.1.4-dev/bin:/nix/store/3gi4zw66q73hdal18akrca30rf02zblq-cups-2.1.4/bin:/nix/store/bx1091kbmwff89gmmxy3za426ryxg0jm-gtk+3-3.22.8/bin:/nix/store/2byhribnzhiy7zhp838fc833xdhnl5l8-dconf-0.26.0/bin:/nix/store/iwm7yk3a40wn400wlqv0rx0zhc7rk756-libcanberra-0.30/bin:/nix/store/px7a1kq4prjzw17c9pppssdmibqqdm2p-systemd-232/bin:/nix/store/fi3mbd2ml4pbgzyasrlnp0wyy6qi48fh-bash-4.4-p5/bin:/nix/store/nqini3ad62zhsknqdpsjcgcm68d1n4gl-hunspell-1.3.3-bin/bin:/nix/store/q2djjbafrmarpv3iqc6scqnsxrdlqxvb-pkg-config-0.29/bin:/nix/store/0l73r9z7q5zjyvghnkd9wm8bihf9gg2p-intltool-0.51.0/bin:/nix/store/lkdr3z34n6n17g7xiaw8plyw7hv9idsl-gettext-0.19.8/bin:/nix/store/nsa311yg8h93wfaacjk16c96a98bs09f-perl-5.22.3/bin:/nix/store/4yn2vyzz1mwl9ry9l67y9bmyasjp7jrj-python3.5-setuptools-30.2.0/bin:/nix/store/087w6yxwq3skp2zppahq8dvfa2idckv7-librsvg-2.40.16/bin${PATH:+:}$PATH
              ^
SyntaxError: invalid syntax

Revision history for this message
marmuta (marmuta) said :
#27

Maybe just remove the shebang from sokSettings. I'm not quite sure why it is there anyway. Probably for historical reasons. It's not needed AFAICT.
I fact I just removed it in trunk. We'll see if anything misses it, but it seems fine so far.

Revision history for this message
Launchpad Janitor (janitor) said :
#28

This question was expired because it remained in the 'Open' state without activity for the last 15 days.

Revision history for this message
John (johnramsden) said :
#29

Currently the problem is related to all files being wrapped so I can't find an easy way to not wrap that file. Hopefully the next release will work properly for me.

https://github.com/NixOS/nixpkgs/pull/24986#issuecomment-304758742

Revision history for this message
marmuta (marmuta) said :
#30

What about #27? Is sokSettings.py still being wrapped if you remove its shebang and executable permissions?

Revision history for this message
John (johnramsden) said :
#31

So I was able to get it to stop being wrapped, now when I open settings I end up with this error:

Traceback (most recent call last):
  File "<string>", line 1, in <module>
ImportError: No module named 'Onboard'

Revision history for this message
marmuta (marmuta) said :
#32

Hmm, there's no wrapping of
PYTHON_EXECUTABLE -c "from Onboard.settings import Settings\ns = Settings(False)"
of course. I suppose for this to be Nix friendly it would have to launch a wrap-able executable like onboard-settings.

In sokSettings.py, does it help if you replace the lines

    GLib.spawn_async(argv=[PYTHON_EXECUTABLE,
                           "-cfrom Onboard.settings import Settings\ns = Settings(False)"],
                     flags=GLib.SpawnFlags.SEARCH_PATH)

with

    GLib.spawn_async(argv=["onboard-settings"],
                     flags=GLib.SpawnFlags.SEARCH_PATH)

Disadvantage is probably that the first onboard-settings found in PATH is launched. So Onboard has to be properly installed and it won't just open the onboard-settings from the source directory as usual.

Revision history for this message
John (johnramsden) said :
#33

Well, now there's good news and bad news. Good news, the setting application actually runs.

When I set it as you told me to it ran, but I knew a way to get it to execute the right path so I did hardcoded it to execute the specific executable of the just built package by referencing the place in the store with '$out':

      substituteInPlace ./scripts/sokSettings.py \
        --replace "#!/usr/bin/python3" "" \
        --replace "PYTHON_EXECUTABLE," "\"$out/bin/onboard-settings\"" \
        --replace '"-cfrom Onboard.settings import Settings\ns = Settings(False)"' ""

This ends up giving us the following code:

def run():
    GLib.spawn_async(argv=["/nix/store/7qwvy80hj1spg513944lrspwjl2nsrn9-onboard-1.4.1/bin/onboard-settings"
                           ],
                     flags=GLib.SpawnFlags.SEARCH_PATH)

---

The issue is the settings application doesn't do anything. It won't change any settings. I tried it both with the store path, and with just 'onboard-settings'.

It doesn't seem to be giving any error input during the settings prompt, but this is the output I get from the run:

** (.onboard-wrapped:22376): WARNING **: Error retrieving accessibility bus address: org.freedesktop.DBus.Error.ServiceUnknown: The name org.a11y.Bus was not provided by any .service files
03:04:43.860 WARNING Onboard.Keyboard: Atspi typelib missing, at-spi key-synth unavailable
03:04:43.869 WARNING Onboard.AtspiStateTracker: Atspi typelib missing, auto-show unavailable
03:04:43.895 WARNING Config: mousetweaks GSettings schema not found, mousetweaks integration disabled.

(onboard:22376): dconf-WARNING **: failed to commit changes to dconf: GDBus.Error:org.freedesktop.DBus.Error.ServiceUnknown: The name ca.desrt.dconf was not provided by any .service files

(onboard:22376): Gtk-WARNING **: Theme parsing error: gtk.css:68:35: The style property GtkButton:child-displacement-x is deprecated and shouldn't be used anymore. It will be removed in a future version

(onboard:22376): Gtk-WARNING **: Theme parsing error: gtk.css:69:35: The style property GtkButton:child-displacement-y is deprecated and shouldn't be used anymore. It will be removed in a future version

(onboard:22376): Gtk-WARNING **: Theme parsing error: gtk.css:73:46: The style property GtkScrolledWindow:scrollbars-within-bevel is deprecated and shouldn't be used anymore. It will be removed in a future version

(onboard:22376): dconf-WARNING **: failed to commit changes to dconf: GDBus.Error:org.freedesktop.DBus.Error.ServiceUnknown: The name ca.desrt.dconf was not provided by any .service files

** (.onboard-settings-wrapped:22432): WARNING **: Error retrieving accessibility bus address: org.freedesktop.DBus.Error.ServiceUnknown: The name org.a11y.Bus was not provided by any .service files
03:04:49.921 WARNING Onboard.AtspiStateTracker: Atspi typelib missing, auto-show unavailable
03:04:49.946 WARNING Config: mousetweaks GSettings schema not found, mousetweaks integration disabled.

(.onboard-settings-wrapped:22432): dconf-WARNING **: failed to commit changes to dconf: GDBus.Error:org.freedesktop.DBus.Error.ServiceUnknown: The name ca.desrt.dconf was not provided by any .service files

(.onboard-settings-wrapped:22432): Gtk-WARNING **: Theme parsing error: gtk.css:68:35: The style property GtkButton:child-displacement-x is deprecated and shouldn't be used anymore. It will be removed in a future version

(.onboard-settings-wrapped:22432): Gtk-WARNING **: Theme parsing error: gtk.css:69:35: The style property GtkButton:child-displacement-y is deprecated and shouldn't be used anymore. It will be removed in a future version

(.onboard-settings-wrapped:22432): Gtk-WARNING **: Theme parsing error: gtk.css:73:46: The style property GtkScrolledWindow:scrollbars-within-bevel is deprecated and shouldn't be used anymore. It will be removed in a future version

(.onboard-settings-wrapped:22432): dconf-WARNING **: failed to commit changes to dconf: GDBus.Error:org.freedesktop.DBus.Error.ServiceUnknown: The name ca.desrt.dconf was not provided by any .service files
Gtk-Message: GtkDialog mapped without a transient parent. This is discouraged.

Revision history for this message
John (johnramsden) said :
#34

I'm wondering if it could be related to the fact that the store is considered read only? Is anything actually saved in the onboard install location at runtime?

Revision history for this message
marmuta (marmuta) said :
#35

No, nothing is written to the install location. The two places things are saved at are
- the dconf database (through GIO aka GSettings) for preferences
- ${XDG_DATA_HOME}/onboard or ~/local/share/onboard for larger stuff, custom layouts, language models, etc.

That list of warnings is growing, I see. I'll have to go over the Gtk deprecations again at some point. Last time I couldn't remove some due to incompatibilities with past Ubuntu releases.

Anyway, the only ominous ones are dconf warnings:
(.onboard-settings-wrapped:22432): dconf-WARNING **: failed to commit changes to dconf: GDBus.Error:org.freedesktop.DBus.Error.ServiceUnknown: The name ca.desrt.dconf was not provided by any .service files

GSettings uses dconf as its default backend to store stuff. No dconf, no reading/writing of things in onboard-settings. I suppose libdconf is installed, else Onboard wouldn't build.

 However /usr/share/dbus-1/services/ca.desrt.dconf.service needs an extra package here: dconf-service. Maybe that part is missing.

Revision history for this message
marmuta (marmuta) said :
#36

Do things like
gsettings get org.onboard layout
work?
Or try running dconf-editor for the same with a GUI tool.

Revision history for this message
John (johnramsden) said :
#37

I don't seem to have the GSettings tool. What is it that should Supply that for onboard?

Revision history for this message
marmuta (marmuta) said :
#38

gsettings is not really related to Onboard, we're just using it as a means to store preferences, as do many other (Gtk-) applications. The package for the gsettings tool seems to be "libglib2.0-bin" here and for the GUI tool "dconf-editor".

dpkg -S /usr/bin/gsettings
libglib2.0-bin: /usr/bin/gsettings

dpkg -S /usr/bin/dconf-editor
dconf-editor: /usr/bin/dconf-editor

Both are not really required for Onboard, though. They might just help testing/exploring gsettings+dconf.

You can do without: if this one-liner works, onboard-settings should as well:
python3 -c 'from gi.repository import Gio; s=Gio.Settings("org.onboard"); print(s["layout"])'

Revision history for this message
John (johnramsden) said :
#39

Do I have to do that from a certain directory? When I try it I just get:

Traceback (most recent call last):
  File "<string>", line 1, in <module>
ImportError: No module named 'gi'

Revision history for this message
marmuta (marmuta) said :
#40

Not really. Can't you somehow get a shell with the environment onboard and onboard-settings are run in? I faintly remember that being possible. Found in my notes:
git clone https://github.com/johnramsden/nixpkgs
nix-shell nixpkgs/ --attr onboard

Then I can
python3 -c 'from gi.repository import Gio; s=Gio.Settings("org.onboard"); print(s["layout"])'
(process:8740): GLib-GIO-ERROR **: Settings schema 'org.onboard' is not installed

The import from gi works, but Onboard's schema is not installed. You had solved that before, though, so it might work better for you.

Revision history for this message
John (johnramsden) said :
#41

Before it was in the 'scripts' directory, i'm not sure where I should be running it from for the new command you gave me.

I'm having trouble with the schema install. I posted an issue https://github.com/NixOS/nixpkgs/issues/26702.

Revision history for this message
John (johnramsden) said :
#42

Awesome news! https://github.com/NixOS/nixpkgs/pull/24986#issuecomment-309905055

It looks like the problem I was getting with the settings was not related to the glib schema compilation. I found out that the fix was to install gnome3.dconf system-wide. For some reason just adding it to buildInputs doesn't work.

I reverted the schema back to how it was before, which seems to be working.

The on-screen keyboard is now in a usable state. I'm now working on getting rid of the remaining warnings that show up at the start of the program.

Revision history for this message
John (johnramsden) said :
#43

Got rid of last few warnings! https://github.com/NixOS/nixpkgs/pull/24986#issuecomment-309929270

Thanks for all the help!

Revision history for this message
marmuta (marmuta) said :
#44

Excellent! You're very welcome. Ask if you need anything.

Revision history for this message
Jan Tojnar (jtojnar) said :
#45

Continuing the work on the packaging, could you explain how the spell checking is used in onboard? In particular, I am interested in how I can test it and how the backend is chosen.

We were also trying to increase the number of passing tests: See the log https://gist.github.com/jtojnar/fce8e94bc110798004aee1291dd2dad7 We cannot do anything about the dconf one since we are not running dbus in the build sandbox and we do not have dictionaries for Greek or German packaged but the rest probably should not be failing.