python3Packages.orjson: Disable failing tests on 32 bit
[NixPkgs.git] / pkgs / applications / misc / onboard / default.nix
blobfba1c0b0f5f812d17246322a8b2d883d77f7b73c
1 { fetchurl
2 , lib
3 , substituteAll
4 , aspellWithDicts
5 , at-spi2-core ? null
6 , atspiSupport ? true
7 , bash
8 , glib
9 , dconf
10 , gobject-introspection
11 , gsettings-desktop-schemas
12 , gtk3
13 , hunspell
14 , hunspellDicts
15 , hunspellWithDicts
16 , intltool
17 , isocodes
18 , libappindicator-gtk3
19 , libcanberra-gtk3
20 , mousetweaks
21 , udev
22 , libxkbcommon
23 , pkg-config
24 , procps
25 , python3
26 , wrapGAppsHook
27 , xorg
28 , yelp
31 let
33   customHunspell = hunspellWithDicts [
34     hunspellDicts.en-us
35   ];
37   majorVersion = "1.4";
41 python3.pkgs.buildPythonApplication rec {
42   pname = "onboard";
43   version = "${majorVersion}.1";
45   src = fetchurl {
46     url = "https://launchpad.net/onboard/${majorVersion}/${version}/+download/${pname}-${version}.tar.gz";
47     sha256 = "0r9q38ikmr4in4dwqd8m9gh9xjbgxnfxglnjbfcapw8ybfnf3jh1";
48   };
50   patches = [
51     (substituteAll {
52       src = ./fix-paths.patch;
53       inherit mousetweaks;
54     })
55     # Allow loading hunspell dictionaries installed in NixOS system path
56     ./hunspell-use-xdg-datadirs.patch
57   ];
59   nativeBuildInputs = [
60     gobject-introspection
61     intltool
62     pkg-config
63     wrapGAppsHook
64   ];
66   buildInputs = [
67     bash
68     glib
69     dconf
70     gsettings-desktop-schemas
71     gtk3
72     hunspell
73     isocodes
74     libappindicator-gtk3
75     libcanberra-gtk3
76     libxkbcommon
77     mousetweaks
78     udev
79     xorg.libXtst
80     xorg.libxkbfile
81   ] ++ lib.optional atspiSupport at-spi2-core;
83   pythonPath = with python3.pkgs; [
84     dbus-python
85     distutils_extra
86     pyatspi
87     pycairo
88     pygobject3
89     systemd
90   ];
92   propagatedUserEnvPkgs = [
93     dconf
94   ];
96   checkInputs = [
97     # for Onboard.SpellChecker.aspell_cmd doctests
98     (aspellWithDicts (dicts: with dicts; [ en ]))
100     # for Onboard.SpellChecker.hunspell_cmd doctests
101     customHunspell
103     # for Onboard.SpellChecker.hunspell doctests
104     hunspellDicts.en-us
105     hunspellDicts.es-es
106     hunspellDicts.it-it
108     python3.pkgs.nose
109   ];
111   # Temporary fix, see https://github.com/NixOS/nixpkgs/issues/56943
112   strictDeps = false;
114   doCheck = false;
116   preBuild = ''
117     # Unnecessary file, has been removed upstream
118     # https://github.com/NixOS/nixpkgs/pull/24986#issuecomment-296114062
119     rm -r Onboard/pypredict/attic
121     substituteInPlace  ./scripts/sokSettings.py \
122       --replace "#!/usr/bin/python3" "" \
123       --replace "PYTHON_EXECUTABLE," "\"$out/bin/onboard-settings\"" \
124       --replace '"-cfrom Onboard.settings import Settings\ns = Settings(False)"' ""
126     chmod -x ./scripts/sokSettings.py
128     patchShebangs .
130     substituteInPlace setup.py \
131       --replace "/etc" "$out/etc"
133     substituteInPlace  ./Onboard/LanguageSupport.py \
134       --replace "/usr/share/xml/iso-codes" "${isocodes}/share/xml/iso-codes"
136     substituteInPlace  ./Onboard/Indicator.py \
137       --replace   "/usr/bin/yelp" "${yelp}/bin/yelp"
139     substituteInPlace  ./gnome/Onboard_Indicator@onboard.org/extension.js \
140       --replace "/usr/bin/yelp" "${yelp}/bin/yelp"
142     substituteInPlace  ./Onboard/SpellChecker.py \
143       --replace "/usr/lib" "$out/lib"
145     substituteInPlace  ./data/org.onboard.Onboard.service  \
146       --replace "/usr/bin" "$out/bin"
148     substituteInPlace  ./Onboard/utils.py \
149       --replace "/usr/share" "$out/share"
150     substituteInPlace  ./onboard-defaults.conf.example \
151       --replace "/usr/share" "$out/share"
152     substituteInPlace  ./Onboard/Config.py \
153       --replace "/usr/share/onboard" "$out/share/onboard"
155     substituteInPlace  ./Onboard/WordSuggestions.py \
156       --replace "/usr/bin" "$out/bin"
158     # killall is dangerous on non-gnu platforms. Use pkill instead.
159     substituteInPlace  ./setup.py \
160       --replace '"killall",' '"${procps}/bin/pkill", "-x",'
161   '';
163   installPhase = ''
164     ${python3.interpreter} setup.py install --prefix="$out"
166     cp onboard-default-settings.gschema.override.example $out/share/glib-2.0/schemas/10_onboard-default-settings.gschema.override
167     glib-compile-schemas $out/share/glib-2.0/schemas/
168   '';
170   # Remove ubuntu icons.
171   postFixup = ''
172     rm -rf  $out/share/icons/ubuntu-mono-*
173   '';
175   meta = with lib; {
176     homepage = "https://launchpad.net/onboard";
177     description = "Onscreen keyboard useful for tablet PC users and for mobility impaired users";
178     maintainers = with maintainers; [ johnramsden ];
179     license = licenses.gpl3;
180   };