Skip to content

Commit

Permalink
Merge pull request #71442 from jtojnar/ibus-fixes
Browse files Browse the repository at this point in the history
Fix/clean up various ibus-engines
  • Loading branch information
jtojnar authored Dec 7, 2019
2 parents 928fdab + f6afb29 commit 36de08e
Show file tree
Hide file tree
Showing 19 changed files with 568 additions and 239 deletions.
10 changes: 8 additions & 2 deletions nixos/modules/i18n/input-method/ibus.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {
Expand Down
76 changes: 46 additions & 30 deletions nixos/tests/installed-tests/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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 {};
Expand Down
20 changes: 20 additions & 0 deletions nixos/tests/installed-tests/ibus.nix
Original file line number Diff line number Diff line change
@@ -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;
}
27 changes: 27 additions & 0 deletions pkgs/data/misc/cldr-emoji-annotation/default.nix
Original file line number Diff line number Diff line change
@@ -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;
};
}
38 changes: 38 additions & 0 deletions pkgs/data/misc/unicode-character-database/default.nix
Original file line number Diff line number Diff line change
@@ -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;
};
}
59 changes: 59 additions & 0 deletions pkgs/data/misc/unicode-emoji/default.nix
Original file line number Diff line number Diff line change
@@ -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;
};
}
38 changes: 38 additions & 0 deletions pkgs/data/misc/unihan-database/default.nix
Original file line number Diff line number Diff line change
@@ -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;
};
}
Loading

0 comments on commit 36de08e

Please sign in to comment.