1{ lib
2, stdenv
3, fetchurl
4, fetchFromGitHub
5, cmake
6, extra-cmake-modules
7, boost
8, python3
9, fcitx5
10, zstd
11}:
12
13let
14 table = fetchurl {
15 url = "https://download.fcitx-im.org/data/table.tar.gz";
16 sha256 = "1dw7mgbaidv3vqy0sh8dbfv8631d2zwv5mlb7npf69a1f8y0b5k1";
17 };
18 arpaVer = "20230712";
19 arpa = fetchurl {
20 url = "https://download.fcitx-im.org/data/lm_sc.arpa-${arpaVer}.tar.xz";
21 hash = "sha256-ut1iwWxjc3h6D9qPCc1FLRL2DVhohW9lHO7PGge6ujI=";
22 };
23 dictVer = "20230412";
24 dict = fetchurl {
25 url = "https://download.fcitx-im.org/data/dict-${dictVer}.tar.xz";
26 hash = "sha256-8F/Mr/loeQCqw9mtWoGyCIi1cyAUA/vNm7x5B9npdQc=";
27 };
28in
29stdenv.mkDerivation rec {
30 pname = "libime";
31 version = "1.1.3";
32
33 src = fetchFromGitHub {
34 owner = "fcitx";
35 repo = "libime";
36 rev = version;
37 sha256 = "sha256-C34hcea0htc9ayytjqy/t08yA2xMC18sAkDc9PK/Hhc=";
38 fetchSubmodules = true;
39 };
40
41 prePatch = ''
42 ln -s ${table} data/$(stripHash ${table})
43 ln -s ${arpa} data/$(stripHash ${arpa})
44 ln -s ${dict} data/$(stripHash ${dict})
45 '';
46
47 nativeBuildInputs = [
48 cmake
49 extra-cmake-modules
50 python3
51 ];
52
53 buildInputs = [
54 zstd
55 boost
56 fcitx5
57 ];
58
59 meta = with lib; {
60 description = "A library to support generic input method implementation";
61 homepage = "https://github.com/fcitx/libime";
62 license = licenses.lgpl21Plus;
63 maintainers = with maintainers; [ poscat ];
64 platforms = platforms.linux;
65 };
66}