nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
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
29}:
30
31let
32
33 customHunspell = hunspellWithDicts [
34 hunspellDicts.en-us
35 ];
36
37 majorVersion = "1.4";
38
39in
40
41python3.pkgs.buildPythonApplication rec {
42 pname = "onboard";
43 version = "${majorVersion}.1";
44
45 src = fetchurl {
46 url = "https://launchpad.net/onboard/${majorVersion}/${version}/+download/${pname}-${version}.tar.gz";
47 sha256 = "0r9q38ikmr4in4dwqd8m9gh9xjbgxnfxglnjbfcapw8ybfnf3jh1";
48 };
49
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 ];
58
59 nativeBuildInputs = [
60 gobject-introspection
61 intltool
62 pkg-config
63 wrapGAppsHook
64 ];
65
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;
82
83 pythonPath = with python3.pkgs; [
84 dbus-python
85 distutils_extra
86 pyatspi
87 pycairo
88 pygobject3
89 systemd
90 ];
91
92 propagatedUserEnvPkgs = [
93 dconf
94 ];
95
96 nativeCheckInputs = [
97 # for Onboard.SpellChecker.aspell_cmd doctests
98 (aspellWithDicts (dicts: with dicts; [ en ]))
99
100 # for Onboard.SpellChecker.hunspell_cmd doctests
101 customHunspell
102
103 # for Onboard.SpellChecker.hunspell doctests
104 hunspellDicts.en-us
105 hunspellDicts.es-es
106 hunspellDicts.it-it
107
108 python3.pkgs.nose
109 ];
110
111 doCheck = false;
112
113 preBuild = ''
114 # Unnecessary file, has been removed upstream
115 # https://github.com/NixOS/nixpkgs/pull/24986#issuecomment-296114062
116 rm -r Onboard/pypredict/attic
117
118 substituteInPlace ./scripts/sokSettings.py \
119 --replace "#!/usr/bin/python3" "" \
120 --replace "PYTHON_EXECUTABLE," "\"$out/bin/onboard-settings\"" \
121 --replace '"-cfrom Onboard.settings import Settings\ns = Settings(False)"' ""
122
123 chmod -x ./scripts/sokSettings.py
124
125 patchShebangs .
126
127 substituteInPlace setup.py \
128 --replace "/etc" "$out/etc"
129
130 substituteInPlace ./Onboard/LanguageSupport.py \
131 --replace "/usr/share/xml/iso-codes" "${isocodes}/share/xml/iso-codes"
132
133 substituteInPlace ./Onboard/Indicator.py \
134 --replace "/usr/bin/yelp" "${yelp}/bin/yelp"
135
136 substituteInPlace ./gnome/Onboard_Indicator@onboard.org/extension.js \
137 --replace "/usr/bin/yelp" "${yelp}/bin/yelp"
138
139 substituteInPlace ./Onboard/SpellChecker.py \
140 --replace "/usr/lib" "$out/lib"
141
142 substituteInPlace ./data/org.onboard.Onboard.service \
143 --replace "/usr/bin" "$out/bin"
144
145 substituteInPlace ./Onboard/utils.py \
146 --replace "/usr/share" "$out/share"
147 substituteInPlace ./onboard-defaults.conf.example \
148 --replace "/usr/share" "$out/share"
149 substituteInPlace ./Onboard/Config.py \
150 --replace "/usr/share/onboard" "$out/share/onboard"
151
152 substituteInPlace ./Onboard/WordSuggestions.py \
153 --replace "/usr/bin" "$out/bin"
154
155 # killall is dangerous on non-gnu platforms. Use pkill instead.
156 substituteInPlace ./setup.py \
157 --replace '"killall",' '"${procps}/bin/pkill", "-x",'
158 '';
159
160 installPhase = ''
161 ${python3.interpreter} setup.py install --prefix="$out"
162
163 cp onboard-default-settings.gschema.override.example $out/share/glib-2.0/schemas/10_onboard-default-settings.gschema.override
164 glib-compile-schemas $out/share/glib-2.0/schemas/
165 '';
166
167 # Remove ubuntu icons.
168 postFixup = ''
169 rm -rf $out/share/icons/ubuntu-mono-*
170 '';
171
172 meta = with lib; {
173 homepage = "https://launchpad.net/onboard";
174 description = "Onscreen keyboard useful for tablet PC users and for mobility impaired users";
175 maintainers = with maintainers; [ johnramsden ];
176 license = licenses.gpl3;
177 };
178}