diff --git a/nixos/modules/i18n/input-method/ibus.nix b/nixos/modules/i18n/input-method/ibus.nix index 956c521dde055..d7857976fcc03 100644 --- a/nixos/modules/i18n/input-method/ibus.nix +++ b/nixos/modules/i18n/input-method/ibus.nix @@ -53,9 +53,15 @@ in config = mkIf (config.i18n.inputMethod.enabled == "ibus") { i18n.inputMethod.package = ibusPackage; + environment.systemPackages = [ + ibusAutostart + ]; + # Without dconf enabled it is impossible to use IBus - environment.systemPackages = with pkgs; [ - dconf ibusAutostart + programs.dconf.enable = true; + + services.dbus.packages = [ + ibusAutostart ]; environment.variables = { diff --git a/nixos/tests/installed-tests/default.nix b/nixos/tests/installed-tests/default.nix index f4780bdcfc975..8e997ee4aeb9b 100644 --- a/nixos/tests/installed-tests/default.nix +++ b/nixos/tests/installed-tests/default.nix @@ -29,36 +29,51 @@ let # Extra flags to pass to gnome-desktop-testing-runner. , testRunnerFlags ? "" - }: - makeTest rec { - name = tested.name; - - meta = { - maintainers = tested.meta.maintainers; - }; - - machine = { ... }: { - imports = [ - testConfig - ] ++ optional withX11 ../common/x11.nix; - - environment.systemPackages = with pkgs; [ gnome-desktop-testing ]; - - }; - - testScript = - optionalString withX11 '' - machine.wait_for_x() - '' + - optionalString (preTestScript != "") '' - ${preTestScript} - '' + - '' - machine.succeed( - "gnome-desktop-testing-runner ${testRunnerFlags} -d '${tested.installedTests}/share'" - ) - ''; - }; + + # Extra attributes to pass to makeTest. + # They will be recursively merged into the attrset created by this function. + , ... + }@args: + makeTest + (recursiveUpdate + rec { + name = tested.name; + + meta = { + maintainers = tested.meta.maintainers; + }; + + machine = { ... }: { + imports = [ + testConfig + ] ++ optional withX11 ../common/x11.nix; + + environment.systemPackages = with pkgs; [ gnome-desktop-testing ]; + + }; + + testScript = + optionalString withX11 '' + machine.wait_for_x() + '' + + optionalString (preTestScript != "") '' + ${preTestScript} + '' + + '' + machine.succeed( + "gnome-desktop-testing-runner ${testRunnerFlags} -d '${tested.installedTests}/share'" + ) + ''; + } + + (removeAttrs args [ + "tested" + "testConfig" + "preTestScript" + "withX11" + "testRunnerFlags" + ]) + ); in @@ -73,6 +88,7 @@ in glib-networking = callInstalledTest ./glib-networking.nix {}; gnome-photos = callInstalledTest ./gnome-photos.nix {}; graphene = callInstalledTest ./graphene.nix {}; + ibus = callInstalledTest ./ibus.nix {}; libgdata = callInstalledTest ./libgdata.nix {}; libxmlb = callInstalledTest ./libxmlb.nix {}; ostree = callInstalledTest ./ostree.nix {}; diff --git a/nixos/tests/installed-tests/ibus.nix b/nixos/tests/installed-tests/ibus.nix new file mode 100644 index 0000000000000..af54b612b507b --- /dev/null +++ b/nixos/tests/installed-tests/ibus.nix @@ -0,0 +1,20 @@ +{ pkgs, makeInstalledTest, ... }: + +makeInstalledTest { + tested = pkgs.ibus; + + testConfig = { + i18n.inputMethod.enabled = "ibus"; + }; + + preTestScript = '' + # ibus has ibus-desktop-testing-runner but it tries to manage desktop session so we just spawn ibus-daemon ourselves + machine.succeed("ibus-daemon --daemonize --verbose") + ''; + + withX11 = true; + + # TODO: ibus-daemon is currently crashing or something + # maybe make ibus systemd service that auto-restarts? + meta.broken = true; +} diff --git a/pkgs/data/misc/cldr-emoji-annotation/default.nix b/pkgs/data/misc/cldr-emoji-annotation/default.nix new file mode 100644 index 0000000000000..4279cf8aec48f --- /dev/null +++ b/pkgs/data/misc/cldr-emoji-annotation/default.nix @@ -0,0 +1,27 @@ +{ stdenv +, fetchFromGitHub +, autoreconfHook +}: + +stdenv.mkDerivation rec { + pname = "cldr-emoji-annotation"; + version = "36.12.120191002_0"; + + src = fetchFromGitHub { + owner = "fujiwarat"; + repo = "cldr-emoji-annotation"; + rev = version; + sha256 = "0nxigzs3mxjgi7c8mmdaxsy5sfl7ihsc2nysaj0db198b33w9clw"; + }; + + nativeBuildInputs = [ + autoreconfHook + ]; + + meta = with stdenv.lib; { + description = "Emoji annotation files in CLDR"; + homepage = "https://www.unicode.org/"; + license = licenses.free; # https://www.unicode.org/license.html + platforms = platforms.all; + }; +} diff --git a/pkgs/data/misc/unicode-character-database/default.nix b/pkgs/data/misc/unicode-character-database/default.nix new file mode 100644 index 0000000000000..5f50049856f38 --- /dev/null +++ b/pkgs/data/misc/unicode-character-database/default.nix @@ -0,0 +1,38 @@ +{ stdenv +, fetchurl +, unzip +}: + +stdenv.mkDerivation rec { + pname = "unicode-character-database"; + version = "12.1.0"; + + src = fetchurl { + url = "https://www.unicode.org/Public/zipped/${version}/UCD.zip"; + sha256 = "19m06iw0jl7lhlggcmghi12p6jld0qrmfpksgc243yn6sjh53fi5"; + }; + + nativeBuildInputs = [ + unzip + ]; + + setSourceRoot = '' + sourceRoot=$PWD + ''; + + installPhase = '' + runHook preInstall + + mkdir -p $out/share/unicode + cp -r * $out/share/unicode + + runHook postInstall + ''; + + meta = with stdenv.lib; { + description = "Unicode Character Database"; + homepage = "https://www.unicode.org/"; + license = licenses.free; # https://www.unicode.org/license.html + platforms = platforms.all; + }; +} diff --git a/pkgs/data/misc/unicode-emoji/default.nix b/pkgs/data/misc/unicode-emoji/default.nix new file mode 100644 index 0000000000000..05472b26d88c3 --- /dev/null +++ b/pkgs/data/misc/unicode-emoji/default.nix @@ -0,0 +1,59 @@ +{ stdenv +, fetchurl +, symlinkJoin +, lib +}: + +let + version = "12.1"; + + fetchData = { file, sha256 }: fetchurl { + url = "https://www.unicode.org/Public/emoji/${version}/${file}"; + inherit sha256; + downloadToTemp = true; + recursiveHash = true; + postFetch = '' + installDir="$out/share/unicode/emoji" + mkdir -p "$installDir" + mv "$downloadedFile" "$installDir/${file}" + ''; + }; + + srcs = { + emoji-data = fetchData { + file = "emoji-data.txt"; + sha256 = "17gfm5a28lsymx36prbjy2g0b27gf3rcgggy0yxdshbxwf6zpf9k"; + }; + emoji-sequences = fetchData { + file = "emoji-sequences.txt"; + sha256 = "1fckw5hfyvz5jfp2jczzx8qcs79vf0zyq0z2942230j99arq70vc"; + }; + emoji-test = fetchData { + file = "emoji-test.txt"; + sha256 = "0w29lva7gp9g9lf7bz1i24qdalvf440bcq8npsbwr3cpp7na95kh"; + }; + emoji-variation-sequences = fetchData { + file = "emoji-variation-sequences.txt"; + sha256 = "0akpib3cinr8xcs045hda5wnpfj6qfdjlkzmq5vgdc50gyhrd2z3"; + }; + emoji-zwj-sequences = fetchData { + file = "emoji-zwj-sequences.txt"; + sha256 = "0s2mvy1nr2v1x0rr1fxlsv8ly1vyf9978rb4hwry5vnr678ls522"; + }; + }; +in + +symlinkJoin rec { + name = "unicode-emoji-${version}"; + + paths = lib.attrValues srcs; + + passthru = srcs; + + meta = with stdenv.lib; { + description = "Unicode Emoji Data Files"; + homepage = "https://home.unicode.org/emoji/"; + license = licenses.free; # https://www.unicode.org/license.html + platforms = platforms.all; + }; +} diff --git a/pkgs/data/misc/unihan-database/default.nix b/pkgs/data/misc/unihan-database/default.nix new file mode 100644 index 0000000000000..77da77242a928 --- /dev/null +++ b/pkgs/data/misc/unihan-database/default.nix @@ -0,0 +1,38 @@ +{ stdenv +, fetchurl +, unzip +}: + +stdenv.mkDerivation rec { + pname = "unihan-database"; + version = "12.1.0"; + + src = fetchurl { + url = "https://www.unicode.org/Public/zipped/${version}/Unihan.zip"; + sha256 = "1kfdhgg2gm52x3s07bijb5cxjy0jxwhd097k5lqhvzpznprm6ibf"; + }; + + nativeBuildInputs = [ + unzip + ]; + + setSourceRoot = '' + sourceRoot=$PWD + ''; + + installPhase = '' + runHook preInstall + + mkdir -p $out/share/unicode + cp -r * $out/share/unicode + + runHook postInstall + ''; + + meta = with stdenv.lib; { + description = "Unicode Han Database"; + homepage = "https://www.unicode.org/"; + license = licenses.free; # https://www.unicode.org/license.html + platforms = platforms.all; + }; +} diff --git a/pkgs/desktops/gnome-3/core/gucharmap/default.nix b/pkgs/desktops/gnome-3/core/gucharmap/default.nix index 6c291c1874f89..ce5e073ac064c 100644 --- a/pkgs/desktops/gnome-3/core/gucharmap/default.nix +++ b/pkgs/desktops/gnome-3/core/gucharmap/default.nix @@ -1,11 +1,48 @@ -{ stdenv, intltool, fetchFromGitLab, pkgconfig, gtk3, adwaita-icon-theme -, glib, desktop-file-utils, gtk-doc, autoconf, automake, libtool -, wrapGAppsHook, gnome3, itstool, libxml2, yelp-tools -, docbook_xsl, docbook_xml_dtd_412, gsettings-desktop-schemas -, callPackage, unzip, gobject-introspection }: +{ stdenv +, intltool +, fetchFromGitLab +, fetchpatch +, pkgconfig +, gtk3 +, adwaita-icon-theme +, glib +, desktop-file-utils +, gtk-doc +, autoconf +, automake +, libtool +, wrapGAppsHook +, gnome3 +, itstool +, libxml2 +, yelp-tools +, docbook_xsl +, docbook_xml_dtd_412 +, gsettings-desktop-schemas +, callPackage +, unzip +, unicode-character-database +, unihan-database +, runCommand +, symlinkJoin +, gobject-introspection +}: let - unicode-data = callPackage ./unicode-data.nix {}; + # TODO: make upstream patch allowing to use the uncompressed file, + # preferably from XDG_DATA_DIRS. + # https://gitlab.gnome.org/GNOME/gucharmap/issues/13 + unihanZip = runCommand "unihan" {} '' + mkdir -p $out/share/unicode + ln -s ${unihan-database.src} $out/share/unicode/Unihan.zip + ''; + ucd = symlinkJoin { + name = "ucd+unihan"; + paths = [ + unihanZip + unicode-character-database + ]; + }; in stdenv.mkDerivation rec { pname = "gucharmap"; version = "12.0.1"; @@ -20,16 +57,41 @@ in stdenv.mkDerivation rec { sha256 = "0si3ymyfzc5v7ly0dmcs3qgw2wp8cyasycq5hmcr8frl09lr6gkw"; }; + patches = [ + # fix build with Unicode 12.1 + (fetchpatch { + url = "https://salsa.debian.org/gnome-team/gucharmap/raw/de079ad494a15f662416257fca2f2b8db757f4ea/debian/patches/update-to-unicode-12.1.patch"; + sha256 = "093gqsxfpp3s0b88p1dgkskr4ng3hv8irmxc60l3fdrkl8am00xh"; + }) + ]; + nativeBuildInputs = [ - pkgconfig wrapGAppsHook unzip intltool itstool - autoconf automake libtool gtk-doc docbook_xsl docbook_xml_dtd_412 - yelp-tools libxml2 desktop-file-utils gobject-introspection + pkgconfig + wrapGAppsHook + unzip + intltool + itstool + autoconf + automake + libtool + gtk-doc + docbook_xsl + docbook_xml_dtd_412 + yelp-tools + libxml2 + desktop-file-utils + gobject-introspection ]; - buildInputs = [ gtk3 glib gsettings-desktop-schemas adwaita-icon-theme ]; + buildInputs = [ + gtk3 + glib + gsettings-desktop-schemas + adwaita-icon-theme + ]; configureFlags = [ - "--with-unicode-data=${unicode-data}" + "--with-unicode-data=${ucd}/share/unicode" "--enable-gtk-doc" ]; @@ -51,7 +113,7 @@ in stdenv.mkDerivation rec { meta = with stdenv.lib; { description = "GNOME Character Map, based on the Unicode Character Database"; - homepage = https://wiki.gnome.org/Apps/Gucharmap; + homepage = "https://wiki.gnome.org/Apps/Gucharmap"; license = licenses.gpl3; maintainers = gnome3.maintainers; platforms = platforms.linux; diff --git a/pkgs/desktops/gnome-3/core/gucharmap/unicode-data.nix b/pkgs/desktops/gnome-3/core/gucharmap/unicode-data.nix deleted file mode 100644 index 56104aff4840f..0000000000000 --- a/pkgs/desktops/gnome-3/core/gucharmap/unicode-data.nix +++ /dev/null @@ -1,45 +0,0 @@ -{ fetchurl, stdenv, gnome3 }: -stdenv.mkDerivation rec { - pname = "unicode-data"; - version = "12.0.0"; - srcs = [ - (fetchurl { - url = "http://www.unicode.org/Public/${version}/ucd/Blocks.txt"; - sha256 = "041sk54v6rjzb23b9x7yjdwzdp2wc7gvfz7ybavgg4gbh51wm8x1"; - }) - (fetchurl { - url = "http://www.unicode.org/Public/${version}/ucd/DerivedAge.txt"; - sha256 = "04j92xp07v273z3pxkbfmi1svmw9kmnjl9nvz9fv0g5ybk9zk7r6"; - }) - (fetchurl { - url = "http://www.unicode.org/Public/${version}/ucd/NamesList.txt"; - sha256 = "0vsq8gx7hws8mvxy3nlglpwxw7ky57q0fs09d7w9xgb2ylk7fz61"; - }) - (fetchurl { - url = "http://www.unicode.org/Public/${version}/ucd/Scripts.txt"; - sha256 = "18c63hx4y5yg408a8d0wx72d2hfnlz4l560y1fsf9lpzifxpqcmx"; - }) - (fetchurl { - url = "http://www.unicode.org/Public/${version}/ucd/UnicodeData.txt"; - sha256 = "07d1kq190kgl92ispfx6zmdkvwvhjga0ishxsngzlw8j3kdkz4ap"; - }) - (fetchurl { - url = "http://www.unicode.org/Public/${version}/ucd/Unihan.zip"; - sha256 = "1kfdhgg2gm52x3s07bijb5cxjy0jxwhd097k5lqhvzpznprm6ibf"; - }) - ]; - phases = "installPhase"; - installPhase = with stdenv.lib; '' - mkdir $out - for f in $srcs;do - cp $f $out/$(stripHash $f) - done - ''; - meta = with stdenv.lib; { - homepage = http://www.unicode.org/ucd/; - description = "Unicode Character Database"; - maintainers = gnome3.maintainers; - license = licenses.mit; - platforms = platforms.all; - }; -} diff --git a/pkgs/tools/inputmethods/ibus-engines/ibus-anthy/default.nix b/pkgs/tools/inputmethods/ibus-engines/ibus-anthy/default.nix index d2f68fd5269e9..cfdfa85ad9f6a 100644 --- a/pkgs/tools/inputmethods/ibus-engines/ibus-anthy/default.nix +++ b/pkgs/tools/inputmethods/ibus-engines/ibus-anthy/default.nix @@ -1,35 +1,57 @@ -{ stdenv, fetchurl, intltool, pkgconfig -, anthy, ibus, glib, gobject-introspection, gtk3, python3 +{ stdenv +, fetchurl +, gettext +, pkgconfig +, wrapGAppsHook +, anthy +, ibus +, glib +, gobject-introspection +, gtk3 +, python3 }: stdenv.mkDerivation rec { pname = "ibus-anthy"; version = "1.5.11"; - meta = with stdenv.lib; { - isIbusEngine = true; - description = "IBus interface to the anthy input method"; - homepage = https://github.com/fujiwarat/ibus-anthy; - license = licenses.gpl2Plus; - platforms = platforms.linux; - maintainers = with maintainers; [ gebner ericsagnes ]; + src = fetchurl { + url = "https://github.com/ibus/ibus-anthy/releases/download/${version}/${pname}-${version}.tar.gz"; + sha256 = "1zwgswpibh67sgbza8kvg03v06maxc08ihkgm5hmh333sjq9d5c0"; }; - configureFlags = [ "--with-anthy-zipcode=${anthy}/share/anthy/zipcode.t" ]; - buildInputs = [ - anthy glib gobject-introspection gtk3 ibus (python3.withPackages (ps: [ps.pygobject3])) + anthy + glib + gtk3 + ibus + (python3.withPackages (ps: [ + ps.pygobject3 + (ps.toPythonModule ibus) + ])) + ]; + + nativeBuildInputs = [ + gettext + gobject-introspection + pkgconfig + wrapGAppsHook ]; - nativeBuildInputs = [ intltool pkgconfig python3.pkgs.wrapPython ]; + configureFlags = [ + "--with-anthy-zipcode=${anthy}/share/anthy/zipcode.t" + ]; postFixup = '' - wrapPythonPrograms substituteInPlace $out/share/ibus/component/anthy.xml --replace \$\{exec_prefix\} $out ''; - src = fetchurl { - url = "https://github.com/ibus/ibus-anthy/releases/download/${version}/${pname}-${version}.tar.gz"; - sha256 = "1zwgswpibh67sgbza8kvg03v06maxc08ihkgm5hmh333sjq9d5c0"; + meta = with stdenv.lib; { + isIbusEngine = true; + description = "IBus interface to the anthy input method"; + homepage = https://github.com/fujiwarat/ibus-anthy; + license = licenses.gpl2Plus; + platforms = platforms.linux; + maintainers = with maintainers; [ gebner ericsagnes ]; }; } diff --git a/pkgs/tools/inputmethods/ibus-engines/ibus-hangul/default.nix b/pkgs/tools/inputmethods/ibus-engines/ibus-hangul/default.nix index 0a38ccfa3bd82..d5e2f50299e3a 100644 --- a/pkgs/tools/inputmethods/ibus-engines/ibus-hangul/default.nix +++ b/pkgs/tools/inputmethods/ibus-engines/ibus-hangul/default.nix @@ -1,7 +1,8 @@ { stdenv , fetchurl , substituteAll -, intltool +, appstream-glib +, gettext , pkgconfig , wrapGAppsHook , gtk3 @@ -12,11 +13,11 @@ stdenv.mkDerivation rec { pname = "ibus-hangul"; - version = "1.5.1"; + version = "1.5.3"; src = fetchurl { url = "https://github.com/choehwanjin/ibus-hangul/releases/download/${version}/${pname}-${version}.tar.gz"; - sha256 = "0gha8dfdf54rx8fv3yfikbgdg6lqq6l883lhg7q68ybvkjx9bwbs"; + sha256 = "1400ba2p34vr9q285lqvjm73f6m677cgfdymmjpiwyrjgbbiqrjy"; }; patches = [ @@ -27,9 +28,9 @@ stdenv.mkDerivation rec { ]; nativeBuildInputs = [ - intltool + appstream-glib + gettext pkgconfig - python3.pkgs.wrapPython wrapGAppsHook ]; diff --git a/pkgs/tools/inputmethods/ibus-engines/ibus-libpinyin/default.nix b/pkgs/tools/inputmethods/ibus-engines/ibus-libpinyin/default.nix index fc4677e06b06e..2c1d558f04d39 100644 --- a/pkgs/tools/inputmethods/ibus-engines/ibus-libpinyin/default.nix +++ b/pkgs/tools/inputmethods/ibus-engines/ibus-libpinyin/default.nix @@ -1,33 +1,54 @@ -{ stdenv, fetchFromGitHub, autoreconfHook -, intltool, pkgconfig, sqlite, libpinyin, db -, ibus, glib, gtk3, python3 +{ stdenv +, fetchFromGitHub +, autoreconfHook +, gettext +, pkgconfig +, wrapGAppsHook +, sqlite +, libpinyin +, db +, ibus +, glib +, gtk3 +, python3 }: stdenv.mkDerivation rec { pname = "ibus-libpinyin"; - version = "1.10.0"; + version = "1.11.1"; src = fetchFromGitHub { - owner = "libpinyin"; - repo = "ibus-libpinyin"; - rev = version; - sha256 = "0zkzz6ig74nws8phqxbsggnpf5g5f2hxi0mdyn2m3s4nm14q3ma6"; + owner = "libpinyin"; + repo = "ibus-libpinyin"; + rev = version; + sha256 = "0b8rilk9zil9gvfhlk3rphcby6ph11dw66j175wp0na6h6hjlaf2"; }; - buildInputs = [ ibus glib sqlite libpinyin python3 gtk3 db ]; - nativeBuildInputs = [ autoreconfHook intltool pkgconfig python3.pkgs.wrapPython ]; + nativeBuildInputs = [ + autoreconfHook + gettext + pkgconfig + wrapGAppsHook + ]; - postAutoreconf = '' - intltoolize - ''; - - postFixup = "wrapPythonPrograms"; + buildInputs = [ + ibus + glib + sqlite + libpinyin + (python3.withPackages (pypkgs: with pypkgs; [ + pygobject3 + (toPythonModule ibus) + ])) + gtk3 + db + ]; meta = with stdenv.lib; { isIbusEngine = true; - description = "IBus interface to the libpinyin input method"; - license = licenses.gpl2; - maintainers = with maintainers; [ ericsagnes ]; - platforms = platforms.linux; + description = "IBus interface to the libpinyin input method"; + license = licenses.gpl2; + maintainers = with maintainers; [ ericsagnes ]; + platforms = platforms.linux; }; } diff --git a/pkgs/tools/inputmethods/ibus-engines/ibus-m17n/default.nix b/pkgs/tools/inputmethods/ibus-engines/ibus-m17n/default.nix index 01b227f6f1b42..c026a9d1a8133 100644 --- a/pkgs/tools/inputmethods/ibus-engines/ibus-m17n/default.nix +++ b/pkgs/tools/inputmethods/ibus-engines/ibus-m17n/default.nix @@ -1,6 +1,14 @@ -{ stdenv, fetchFromGitHub -, autoreconfHook, pkgconfig -, ibus, m17n_lib, m17n_db, gettext, python3 +{ stdenv +, fetchFromGitHub +, autoreconfHook +, pkgconfig +, ibus +, gtk3 +, m17n_lib +, m17n_db +, gettext +, python3 +, wrapGAppsHook }: stdenv.mkDerivation rec { @@ -8,27 +16,40 @@ stdenv.mkDerivation rec { version = "1.4.1"; src = fetchFromGitHub { - owner = "ibus"; - repo = "ibus-m17n"; - rev = version; + owner = "ibus"; + repo = "ibus-m17n"; + rev = version; sha256 = "1xl7swqn46nhi43rka0zx666mpk667ykag3sz07x0zqrwi41frps"; }; - buildInputs = [ - ibus m17n_lib m17n_db gettext - python3 + nativeBuildInputs = [ + autoreconfHook + gettext + pkgconfig + wrapGAppsHook ]; - nativeBuildInputs = [ autoreconfHook pkgconfig python3.pkgs.wrapPython ]; + buildInputs = [ + ibus + gtk3 + m17n_lib + m17n_db + (python3.withPackages (ps: [ + ps.pygobject3 + (ps.toPythonModule ibus) + ])) + ]; - postFixup = "wrapPythonPrograms"; + configureFlags = [ + "--with-gtk=3.0" + ]; meta = with stdenv.lib; { isIbusEngine = true; - description = "m17n engine for ibus"; - homepage = https://github.com/ibus/ibus-m17n; - license = licenses.gpl2; - platforms = platforms.linux; - maintainers = with maintainers; [ ericsagnes ]; + description = "m17n engine for ibus"; + homepage = https://github.com/ibus/ibus-m17n; + license = licenses.gpl2; + platforms = platforms.linux; + maintainers = with maintainers; [ ericsagnes ]; }; } diff --git a/pkgs/tools/inputmethods/ibus-engines/ibus-table/default.nix b/pkgs/tools/inputmethods/ibus-engines/ibus-table/default.nix index 8e34cb860a65f..c95a9c1651c70 100644 --- a/pkgs/tools/inputmethods/ibus-engines/ibus-table/default.nix +++ b/pkgs/tools/inputmethods/ibus-engines/ibus-table/default.nix @@ -32,7 +32,6 @@ stdenv.mkDerivation rec { buildInputs = [ dconf gtk3 - gobject-introspection ibus (python3.withPackages (pypkgs: with pypkgs; [ pygobject3 @@ -44,7 +43,7 @@ stdenv.mkDerivation rec { autoreconfHook docbook2x pkgconfig - python3.pkgs.wrapPython + gobject-introspection wrapGAppsHook ]; diff --git a/pkgs/tools/inputmethods/ibus-engines/ibus-uniemoji/allow-wrapping.patch b/pkgs/tools/inputmethods/ibus-engines/ibus-uniemoji/allow-wrapping.patch new file mode 100644 index 0000000000000..434c85d3dbeaa --- /dev/null +++ b/pkgs/tools/inputmethods/ibus-engines/ibus-uniemoji/allow-wrapping.patch @@ -0,0 +1,13 @@ +diff --git a/uniemoji.xml.in b/uniemoji.xml.in +index 5fbfd0f..6fb8ad3 100644 +--- a/uniemoji.xml.in ++++ b/uniemoji.xml.in +@@ -7,7 +7,7 @@ + GPL + Lalo Martins <lalo.martins@gmail.com> + https://github.com/salty-horse/ibus-uniemoji +- @PYTHON@ @DATADIR@/ibus-uniemoji/uniemoji.py --ibus ++ @DATADIR@/ibus-uniemoji/uniemoji.py --ibus + uniemoji + + diff --git a/pkgs/tools/inputmethods/ibus-engines/ibus-uniemoji/default.nix b/pkgs/tools/inputmethods/ibus-engines/ibus-uniemoji/default.nix index 107c8c60271ed..435d1154d4ad6 100644 --- a/pkgs/tools/inputmethods/ibus-engines/ibus-uniemoji/default.nix +++ b/pkgs/tools/inputmethods/ibus-engines/ibus-uniemoji/default.nix @@ -1,8 +1,19 @@ -{ stdenv, fetchFromGitHub -, python3Packages +{ stdenv +, fetchFromGitHub +, gobject-introspection +, wrapGAppsHook +, python3 +, ibus }: -stdenv.mkDerivation rec { +let + python = python3.withPackages (ps: with ps; [ + pygobject3 + (toPythonModule ibus) + pyxdg + python-Levenshtein + ]); +in stdenv.mkDerivation rec { pname = "ibus-uniemoji"; version = "0.6.0"; @@ -13,25 +24,39 @@ stdenv.mkDerivation rec { sha256 = "121zh3q0li1k537fcvbd4ns4jgl9bbb9gm9ihy8cfxgirv38lcfa"; }; - propagatedBuildInputs = with python3Packages; [ pyxdg python-Levenshtein pygobject3 ]; + patches = [ + # Do not run wrapper script with Python, + # the wrapped script will have Python in shebang anyway. + ./allow-wrapping.patch + ]; - nativeBuildInputs = [ python3Packages.wrapPython ]; + + nativeBuildInputs = [ + wrapGAppsHook + gobject-introspection + ]; + + buildInputs = [ + python + ibus + ]; + + makeFlags = [ + "PREFIX=${placeholder ''out''}" + "SYSCONFDIR=${placeholder ''out''}/etc" + "PYTHON=${python.interpreter}" + ]; postFixup = '' - buildPythonPath $out - patchPythonScript $out/share/ibus-uniemoji/uniemoji.py + wrapGApp $out/share/ibus-uniemoji/uniemoji.py ''; - makeFlags = [ "PREFIX=$(out)" "SYSCONFDIR=$(out)/etc" - "PYTHON=${python3Packages.python.interpreter}" - ]; - meta = with stdenv.lib; { isIbusEngine = true; - description = "Input method (ibus) for entering unicode symbols and emoji by name"; - homepage = "https://github.com/salty-horse/ibus-uniemoji"; - license = with licenses; [ gpl3 mit ]; - platforms = platforms.linux; - maintainers = with maintainers; [ aske ]; + description = "Input method (ibus) for entering unicode symbols and emoji by name"; + homepage = "https://github.com/salty-horse/ibus-uniemoji"; + license = with licenses; [ gpl3 mit ]; + platforms = platforms.linux; + maintainers = with maintainers; [ aske ]; }; } diff --git a/pkgs/tools/inputmethods/ibus/default.nix b/pkgs/tools/inputmethods/ibus/default.nix index 0dc339e51c6b6..4951074bc43ae 100644 --- a/pkgs/tools/inputmethods/ibus/default.nix +++ b/pkgs/tools/inputmethods/ibus/default.nix @@ -1,74 +1,43 @@ -{ stdenv, substituteAll, fetchurl, fetchFromGitHub, autoreconfHook, gettext, makeWrapper, pkgconfig -, vala, wrapGAppsHook, dbus, dconf ? null, glib, gdk-pixbuf, gobject-introspection, gtk2 -, gtk3, gtk-doc, isocodes, python3, json-glib, libnotify ? null, enablePython2Library ? false -, enableUI ? true, withWayland ? false, libxkbcommon ? null, wayland ? null -, buildPackages, runtimeShell }: +{ stdenv +, substituteAll +, fetchurl +, fetchFromGitHub +, autoreconfHook +, gettext +, makeWrapper +, pkgconfig +, vala +, wrapGAppsHook +, dbus +, dconf ? null +, glib +, gdk-pixbuf +, gobject-introspection +, gtk2 +, gtk3 +, gtk-doc +, isocodes +, cldr-emoji-annotation +, unicode-character-database +, unicode-emoji +, python3 +, json-glib +, libnotify ? null +, enablePython2Library ? false +, enableUI ? true +, withWayland ? false +, libxkbcommon ? null +, wayland ? null +, buildPackages +, runtimeShell +, nixosTests +}: assert withWayland -> wayland != null && libxkbcommon != null; with stdenv.lib; let - emojiSrcs = { - data = fetchurl { - url = "http://unicode.org/Public/emoji/5.0/emoji-data.txt"; - sha256 = "11jfz5rrvyc2ixliqfcjgmch4cn9mfy0x96qnpfcyz5fy1jvfyxf"; - }; - sequences = fetchurl { - url = "http://unicode.org/Public/emoji/5.0/emoji-sequences.txt"; - sha256 = "09bii7f5mmladg0kl3n80fa9qaix6bv5ylm92x52j7wygzv0szb1"; - }; - variation-sequences = fetchurl { - url = "http://unicode.org/Public/emoji/5.0/emoji-variation-sequences.txt"; - sha256 = "1wlg4gbq7spmpppjfy5zdl82sj0hc836p8gljgfrjmwsjgybq286"; - }; - zwj-sequences = fetchurl { - url = "http://unicode.org/Public/emoji/5.0/emoji-zwj-sequences.txt"; - sha256 = "16gvzv76mjv9g81lm1m6cr3rpfqyn2k4hb9a62xd329252dhl25q"; - }; - test = fetchurl { - url = "http://unicode.org/Public/emoji/5.0/emoji-test.txt"; - sha256 = "031qk2v8xdnba7hfinmgrmpglc9l8ll2hds6mw885p0hngdb3dgw"; - }; - }; - emojiData = stdenv.mkDerivation { - name = "emoji-data-5.0"; - dontUnpack = true; - installPhase = '' - mkdir $out - ${builtins.toString (flip mapAttrsToList emojiSrcs (k: v: "cp ${v} $out/emoji-${k}.txt;"))} - ''; - }; - cldrEmojiAnnotation = stdenv.mkDerivation rec { - pname = "cldr-emoji-annotation"; - version = "31.90.0_1"; - src = fetchFromGitHub { - owner = "fujiwarat"; - repo = "cldr-emoji-annotation"; - rev = version; - sha256 = "1vsj32bg8ab4d80rz0fxy6sj2lv31inzyjnddjm079bnvlaf2kih"; - }; - nativeBuildInputs = [ autoreconfHook ]; - }; - ucdVersion = "12.0.0"; - ucdSrcs = { - NamesList = fetchurl { - url = "https://www.unicode.org/Public/${ucdVersion}/ucd/NamesList.txt"; - sha256 = "c17c7726f562bd9ef869096807f0297e1edef9a58fdae1fbae487378fa43586f"; - }; - Blocks = fetchurl { - url = "https://www.unicode.org/Public/${ucdVersion}/ucd/Blocks.txt"; - sha256 = "a1a3ca4381eb91f7b65afe7cb7df615cdcf67993fef4b486585f66b349993a10"; - }; - }; - ucd = stdenv.mkDerivation { - name = "ucd-${ucdVersion}"; - dontUnpack = true; - installPhase = '' - mkdir $out - ${builtins.toString (flip mapAttrsToList ucdSrcs (k: v: "cp ${v} $out/${k}.txt;"))} - ''; - }; python3Runtime = python3.withPackages (ps: with ps; [ pygobject3 ]); python3BuildEnv = python3.buildEnv.override { # ImportError: No module named site @@ -82,13 +51,13 @@ in stdenv.mkDerivation rec { pname = "ibus"; - version = "1.5.20"; + version = "1.5.21"; src = fetchFromGitHub { owner = "ibus"; repo = "ibus"; rev = version; - sha256 = "1npavb896qrp6qbqayb0va4mpsi68wybcnlbjknzgssqyw2ylh9r"; + sha256 = "0fjbqj7d2g5c8i1wdggzhz269xisxv4xb1pa9swalm5p2b2vrjlx"; }; patches = [ @@ -99,7 +68,7 @@ stdenv.mkDerivation rec { }) ]; - outputs = [ "out" "dev" ]; + outputs = [ "out" "dev" "installedTests" ]; postPatch = '' echo \#!${runtimeShell} > data/dconf/make-dconf-override-db.sh @@ -116,9 +85,15 @@ stdenv.mkDerivation rec { (enableFeature enablePython2Library "python-library") (enableFeature enablePython2Library "python2") # XXX: python2 library does not work anyway (enableFeature enableUI "ui") - "--with-unicode-emoji-dir=${emojiData}" - "--with-emoji-annotation-dir=${cldrEmojiAnnotation}/share/unicode/cldr/common/annotations" - "--with-ucd-dir=${ucd}" + "--enable-install-tests" + "--with-unicode-emoji-dir=${unicode-emoji}/share/unicode/emoji" + "--with-emoji-annotation-dir=${cldr-emoji-annotation}/share/unicode/cldr/common/annotations" + "--with-ucd-dir=${unicode-character-database}/share/unicode" + ]; + + makeFlags = [ + "test_execsdir=${placeholder ''installedTests''}/libexec/installed-tests/ibus" + "test_sourcesdir=${placeholder ''installedTests''}/share/installed-tests/ibus" ]; nativeBuildInputs = [ @@ -132,7 +107,9 @@ stdenv.mkDerivation rec { wrapGAppsHook ]; - propagatedBuildInputs = [ glib ]; + propagatedBuildInputs = [ + glib + ]; buildInputs = [ dbus @@ -154,10 +131,31 @@ stdenv.mkDerivation rec { doCheck = false; # requires X11 daemon doInstallCheck = true; - installCheckPhase = "$out/bin/ibus version"; + installCheckPhase = '' + $out/bin/ibus version + ''; + + postInstall = '' + # It has some hardcoded FHS paths and also we do not use it + # since we set up the environment in NixOS tests anyway. + moveToOutput "bin/ibus-desktop-testing-runner" "$installedTests" + ''; + + postFixup = '' + # set necessary environment also for tests + for f in $installedTests/libexec/installed-tests/ibus/*; do + wrapGApp $f + done + ''; + + passthru = { + tests = { + installed-tests = nixosTests.installed-tests.ibus; + }; + }; meta = { - homepage = https://github.com/ibus/ibus; + homepage = "https://github.com/ibus/ibus"; description = "Intelligent Input Bus, input method framework"; license = licenses.lgpl21Plus; platforms = platforms.linux; diff --git a/pkgs/tools/inputmethods/ibus/fix-paths.patch b/pkgs/tools/inputmethods/ibus/fix-paths.patch index 192aa7d6395ea..60269c6c2418a 100644 --- a/pkgs/tools/inputmethods/ibus/fix-paths.patch +++ b/pkgs/tools/inputmethods/ibus/fix-paths.patch @@ -40,6 +40,6 @@ export IBUS_DATAROOTDIR=@datarootdir@ export IBUS_LOCALEDIR=@localedir@ export IBUS_LIBEXECDIR=${libexecdir} --exec @PYTHON@ @prefix@/share/ibus/setup/main.py $@ +-exec ${PYTHON:-@PYTHON@} @prefix@/share/ibus/setup/main.py $@ +exec @pythonInterpreter@ @prefix@/share/ibus/setup/main.py $@ diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 9810986b89b8a..0f13b529e170d 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -17129,6 +17129,8 @@ in cherry = callPackage ../data/fonts/cherry { inherit (xorg) fonttosfnt mkfontdir; }; + cldr-emoji-annotation = callPackage ../data/misc/cldr-emoji-annotation { }; + clearlooks-phenix = callPackage ../data/themes/clearlooks-phenix { }; cnstrokeorder = callPackage ../data/fonts/cnstrokeorder {}; @@ -17740,6 +17742,12 @@ in uni-vga = callPackage ../data/fonts/uni-vga { }; + unicode-character-database = callPackage ../data/misc/unicode-character-database { }; + + unicode-emoji = callPackage ../data/misc/unicode-emoji { }; + + unihan-database = callPackage ../data/misc/unihan-database { }; + unifont = callPackage ../data/fonts/unifont { }; unifont_upper = callPackage ../data/fonts/unifont_upper { };