nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 lib,
3 stdenv,
4 fetchFromGitHub,
5 cargo,
6 cmake,
7 pkg-config,
8 rustPlatform,
9 rustc,
10 wrapQtAppsHook,
11 fcitx5,
12 ibus,
13 qtbase,
14 zstd,
15 fetchpatch,
16 withFcitx5Support ? false,
17 withIbusSupport ? false,
18}:
19
20stdenv.mkDerivation rec {
21 pname = "openbangla-keyboard";
22 version = "unstable-2023-07-21";
23
24 src = fetchFromGitHub {
25 owner = "openbangla";
26 repo = "openbangla-keyboard";
27 # no upstream release in 3 years
28 # fcitx5 support was added over a year after the last release
29 rev = "780bd40eed16116222faff044bfeb61a07af158f";
30 hash = "sha256-4CR4lgHB51UvS/RLc0AEfIKJ7dyTCOfDrQdGLf9de8E=";
31 fetchSubmodules = true;
32 };
33
34 patches = [
35 # prevents runtime crash when fcitx5-based IM attempts to look in /usr
36 (fetchpatch {
37 name = "use-CMAKE_INSTALL_PREFIX-for-loading-data.patch";
38 url = "https://github.com/OpenBangla/OpenBangla-Keyboard/commit/f402472780c29eaa6b4cc841a70289adf171462b.diff";
39 hash = "sha256-YahvtyOxe8F40Wfe+31C6fdmm197QN26/Q67oinOplk=";
40 })
41 ];
42
43 nativeBuildInputs = [
44 cmake
45 pkg-config
46 cargo
47 rustc
48 rustPlatform.cargoSetupHook
49 wrapQtAppsHook
50 ];
51
52 buildInputs =
53 lib.optionals withFcitx5Support [
54 fcitx5
55 ]
56 ++ lib.optionals withIbusSupport [
57 ibus
58 ]
59 ++ [
60 qtbase
61 zstd
62 ];
63
64 cargoDeps = rustPlatform.fetchCargoVendor {
65 inherit src cargoRoot postPatch;
66 hash = "sha256-qZMTZi7eqEp5kSmVx7qdS7eDKOzSv9fMjWT0h/MGyeY=";
67 };
68
69 cmakeFlags =
70 lib.optionals withFcitx5Support [
71 "-DENABLE_FCITX=YES"
72 ]
73 ++ lib.optionals withIbusSupport [
74 "-DENABLE_IBUS=YES"
75 ];
76
77 cargoRoot = "src/engine/riti";
78 postPatch = ''
79 cp ${./Cargo.lock} ${cargoRoot}/Cargo.lock
80 '';
81
82 meta = {
83 isIbusEngine = withIbusSupport;
84 description = "OpenSource, Unicode compliant Bengali Input Method";
85 mainProgram = "openbangla-gui";
86 homepage = "https://openbangla.github.io/";
87 license = lib.licenses.gpl3Plus;
88 maintainers = with lib.maintainers; [ hqurve ];
89 platforms = lib.platforms.linux;
90 # never built on aarch64-linux since first introduction in nixpkgs
91 broken = stdenv.hostPlatform.isLinux && stdenv.hostPlatform.isAarch64;
92 };
93}