at 22.05-pre 174 lines 4.3 kB view raw
1{ lib, stdenv 2, substituteAll 3, fetchurl 4, fetchFromGitHub 5, autoreconfHook 6, gettext 7, makeWrapper 8, pkg-config 9, vala 10, wrapGAppsHook 11, dbus 12, dconf ? null 13, glib 14, gdk-pixbuf 15, gobject-introspection 16, gtk2 17, gtk3 18, gtk-doc 19, runCommand 20, isocodes 21, cldr-emoji-annotation 22, unicode-character-database 23, unicode-emoji 24, python3 25, json-glib 26, libnotify ? null 27, enablePython2Library ? false 28, enableUI ? true 29, withWayland ? false 30, libxkbcommon ? null 31, wayland ? null 32, buildPackages 33, runtimeShell 34, nixosTests 35}: 36 37assert withWayland -> wayland != null && libxkbcommon != null; 38 39with lib; 40 41let 42 python3Runtime = python3.withPackages (ps: with ps; [ pygobject3 ]); 43 python3BuildEnv = python3.buildEnv.override { 44 # ImportError: No module named site 45 postBuild = '' 46 makeWrapper ${glib.dev}/bin/gdbus-codegen $out/bin/gdbus-codegen --unset PYTHONPATH 47 makeWrapper ${glib.dev}/bin/glib-genmarshal $out/bin/glib-genmarshal --unset PYTHONPATH 48 makeWrapper ${glib.dev}/bin/glib-mkenums $out/bin/glib-mkenums --unset PYTHONPATH 49 ''; 50 }; 51 # make-dconf-override-db.sh needs to execute dbus-launch in the sandbox, 52 # it will fail to read /etc/dbus-1/session.conf unless we add this flag 53 dbus-launch = runCommand "sandbox-dbus-launch" { 54 nativeBuildInputs = [ makeWrapper ]; 55 } '' 56 makeWrapper ${dbus}/bin/dbus-launch $out/bin/dbus-launch \ 57 --add-flags --config-file=${dbus.daemon}/share/dbus-1/session.conf 58 ''; 59in 60 61stdenv.mkDerivation rec { 62 pname = "ibus"; 63 version = "1.5.24"; 64 65 src = fetchFromGitHub { 66 owner = "ibus"; 67 repo = "ibus"; 68 rev = version; 69 sha256 = "sha256-1qx06MlEUjSS067FdQG1Bdi4ZAh3hPcNjUX5PIiC3Sk="; 70 }; 71 72 patches = [ 73 (substituteAll { 74 src = ./fix-paths.patch; 75 pythonInterpreter = python3Runtime.interpreter; 76 pythonSitePackages = python3.sitePackages; 77 }) 78 ]; 79 80 outputs = [ "out" "dev" "installedTests" ]; 81 82 postPatch = '' 83 patchShebangs --build data/dconf/make-dconf-override-db.sh 84 cp ${buildPackages.gtk-doc}/share/gtk-doc/data/gtk-doc.make . 85 ''; 86 87 preAutoreconf = "touch ChangeLog"; 88 89 configureFlags = [ 90 "--disable-memconf" 91 (enableFeature (dconf != null) "dconf") 92 (enableFeature (libnotify != null) "libnotify") 93 (enableFeature withWayland "wayland") 94 (enableFeature enablePython2Library "python-library") 95 (enableFeature enablePython2Library "python2") # XXX: python2 library does not work anyway 96 (enableFeature enableUI "ui") 97 "--enable-install-tests" 98 "--with-unicode-emoji-dir=${unicode-emoji}/share/unicode/emoji" 99 "--with-emoji-annotation-dir=${cldr-emoji-annotation}/share/unicode/cldr/common/annotations" 100 "--with-ucd-dir=${unicode-character-database}/share/unicode" 101 ]; 102 103 makeFlags = [ 104 "test_execsdir=${placeholder "installedTests"}/libexec/installed-tests/ibus" 105 "test_sourcesdir=${placeholder "installedTests"}/share/installed-tests/ibus" 106 ]; 107 108 nativeBuildInputs = [ 109 autoreconfHook 110 gtk-doc 111 gettext 112 makeWrapper 113 pkg-config 114 python3BuildEnv 115 vala 116 wrapGAppsHook 117 dbus-launch 118 ]; 119 120 propagatedBuildInputs = [ 121 glib 122 ]; 123 124 buildInputs = [ 125 dbus 126 dconf 127 gdk-pixbuf 128 gobject-introspection 129 python3.pkgs.pygobject3 # for pygobject overrides 130 gtk2 131 gtk3 132 isocodes 133 json-glib 134 libnotify 135 ] ++ optionals withWayland [ 136 libxkbcommon 137 wayland 138 ]; 139 140 enableParallelBuilding = true; 141 142 doCheck = false; # requires X11 daemon 143 doInstallCheck = true; 144 installCheckPhase = '' 145 $out/bin/ibus version 146 ''; 147 148 postInstall = '' 149 # It has some hardcoded FHS paths and also we do not use it 150 # since we set up the environment in NixOS tests anyway. 151 moveToOutput "bin/ibus-desktop-testing-runner" "$installedTests" 152 ''; 153 154 postFixup = '' 155 # set necessary environment also for tests 156 for f in $installedTests/libexec/installed-tests/ibus/*; do 157 wrapGApp $f 158 done 159 ''; 160 161 passthru = { 162 tests = { 163 installed-tests = nixosTests.installed-tests.ibus; 164 }; 165 }; 166 167 meta = { 168 homepage = "https://github.com/ibus/ibus"; 169 description = "Intelligent Input Bus, input method framework"; 170 license = licenses.lgpl21Plus; 171 platforms = platforms.linux; 172 maintainers = with maintainers; [ ttuegel yegortimoshenko ]; 173 }; 174}