fork
Configure Feed
Select the types of activity you want to include in your feed.
nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
fork
Configure Feed
Select the types of activity you want to include in your feed.
1{ lib, stdenv
2, substituteAll
3, fetchFromGitHub
4, fetchpatch
5, autoreconfHook
6, gettext
7, makeWrapper
8, pkg-config
9, vala
10, wrapGAppsHook
11, dbus
12, systemd
13, dconf ? null
14, glib
15, gdk-pixbuf
16, gobject-introspection
17, gtk2
18, gtk3
19, gtk4
20, gtk-doc
21, runCommand
22, isocodes
23, cldr-annotations
24, unicode-character-database
25, unicode-emoji
26, python3
27, json-glib
28, libnotify ? null
29, enableUI ? true
30, withWayland ? false
31, libxkbcommon
32, wayland
33, buildPackages
34, runtimeShell
35, nixosTests
36}:
37
38let
39 python3Runtime = python3.withPackages (ps: with ps; [ pygobject3 ]);
40 python3BuildEnv = python3.buildEnv.override {
41 # ImportError: No module named site
42 postBuild = ''
43 makeWrapper ${glib.dev}/bin/gdbus-codegen $out/bin/gdbus-codegen --unset PYTHONPATH
44 makeWrapper ${glib.dev}/bin/glib-genmarshal $out/bin/glib-genmarshal --unset PYTHONPATH
45 makeWrapper ${glib.dev}/bin/glib-mkenums $out/bin/glib-mkenums --unset PYTHONPATH
46 '';
47 };
48 # make-dconf-override-db.sh needs to execute dbus-launch in the sandbox,
49 # it will fail to read /etc/dbus-1/session.conf unless we add this flag
50 dbus-launch = runCommand "sandbox-dbus-launch" {
51 nativeBuildInputs = [ makeWrapper ];
52 } ''
53 makeWrapper ${dbus}/bin/dbus-launch $out/bin/dbus-launch \
54 --add-flags --config-file=${dbus}/share/dbus-1/session.conf
55 '';
56in
57
58stdenv.mkDerivation rec {
59 pname = "ibus";
60 version = "1.5.28";
61
62 src = fetchFromGitHub {
63 owner = "ibus";
64 repo = "ibus";
65 rev = version;
66 sha256 = "sha256-zjV+QkhVkrHFs9Vt1FpbvmS4nRHxwKaKU3mQkSgyLaQ=";
67 };
68
69 patches = [
70 (substituteAll {
71 src = ./fix-paths.patch;
72 pythonInterpreter = python3Runtime.interpreter;
73 pythonSitePackages = python3.sitePackages;
74 })
75 ./build-without-dbus-launch.patch
76 # unicode and emoji input are broken before 1.5.29
77 # https://github.com/NixOS/nixpkgs/issues/226526
78 (fetchpatch {
79 url = "https://github.com/ibus/ibus/commit/7c8abbe89403c2fcb08e3fda42049a97187e53ab.patch";
80 hash = "sha256-59HzAdLq8ahrF7K+tFGLjTodwIiTkJGEkFe8quqIkhU=";
81 })
82 # fix SIGABRT in X11 https://github.com/ibus/ibus/issues/2484
83 (fetchpatch {
84 url = "https://github.com/ibus/ibus/commit/8f706d160631f1ffdbfa16543a38b9d5f91c16ad.patch";
85 hash = "sha256-YzS9TmUWW0OmheDeCeU00kFK2U2QEmKYMSRJAbu14ec=";
86 })
87 ];
88
89 outputs = [ "out" "dev" "installedTests" ];
90
91 postPatch = ''
92 patchShebangs --build data/dconf/make-dconf-override-db.sh
93 cp ${buildPackages.gtk-doc}/share/gtk-doc/data/gtk-doc.make .
94 substituteInPlace bus/services/org.freedesktop.IBus.session.GNOME.service.in --replace "ExecStart=sh" "ExecStart=${runtimeShell}"
95 substituteInPlace bus/services/org.freedesktop.IBus.session.generic.service.in --replace "ExecStart=sh" "ExecStart=${runtimeShell}"
96 '';
97
98 preAutoreconf = "touch ChangeLog";
99
100 configureFlags = [
101 "--disable-memconf"
102 (lib.enableFeature (dconf != null) "dconf")
103 (lib.enableFeature (libnotify != null) "libnotify")
104 (lib.enableFeature withWayland "wayland")
105 (lib.enableFeature enableUI "ui")
106 "--enable-gtk4"
107 "--enable-install-tests"
108 "--with-unicode-emoji-dir=${unicode-emoji}/share/unicode/emoji"
109 "--with-emoji-annotation-dir=${cldr-annotations}/share/unicode/cldr/common/annotations"
110 "--with-ucd-dir=${unicode-character-database}/share/unicode"
111 ];
112
113 # missing make dependency
114 # https://github.com/NixOS/nixpkgs/pull/218120#issuecomment-1514027173
115 preBuild = ''
116 make -C src ibusenumtypes.h
117 '';
118
119 makeFlags = [
120 "test_execsdir=${placeholder "installedTests"}/libexec/installed-tests/ibus"
121 "test_sourcesdir=${placeholder "installedTests"}/share/installed-tests/ibus"
122 ];
123
124 nativeBuildInputs = [
125 autoreconfHook
126 gtk-doc
127 gettext
128 makeWrapper
129 pkg-config
130 python3BuildEnv
131 vala
132 wrapGAppsHook
133 dbus-launch
134 gobject-introspection
135 ];
136
137 propagatedBuildInputs = [
138 glib
139 ];
140
141 buildInputs = [
142 dbus
143 systemd
144 dconf
145 gdk-pixbuf
146 python3.pkgs.pygobject3 # for pygobject overrides
147 gtk2
148 gtk3
149 gtk4
150 isocodes
151 json-glib
152 libnotify
153 ] ++ lib.optionals withWayland [
154 libxkbcommon
155 wayland
156 ];
157
158 enableParallelBuilding = true;
159
160 doCheck = false; # requires X11 daemon
161 doInstallCheck = true;
162 installCheckPhase = ''
163 $out/bin/ibus version
164 '';
165
166 postInstall = ''
167 # It has some hardcoded FHS paths and also we do not use it
168 # since we set up the environment in NixOS tests anyway.
169 moveToOutput "bin/ibus-desktop-testing-runner" "$installedTests"
170 '';
171
172 postFixup = ''
173 # set necessary environment also for tests
174 for f in $installedTests/libexec/installed-tests/ibus/*; do
175 wrapGApp $f
176 done
177 '';
178
179 passthru = {
180 tests = {
181 installed-tests = nixosTests.installed-tests.ibus;
182 };
183 };
184
185 meta = with lib; {
186 homepage = "https://github.com/ibus/ibus";
187 description = "Intelligent Input Bus, input method framework";
188 license = licenses.lgpl21Plus;
189 platforms = platforms.linux;
190 maintainers = with maintainers; [ ttuegel yana ];
191 };
192}