nixpkgs/pkgs/tools/inputmethods/fcitx5/fcitx5-rime.nix
Vonfry 6031ae21f6
fcitx5-rime: add an environment variable for shared data dir passing librime.
The original RIME_DATA_DIR is fixed at build time which is set to the package
dir under nix store. A such dir is read only for users so if some one want to
add a shared data, he has to override fcitx5-rime or librime, which isn't
user-friendly.

On other distributions, RIME_DATA_DIR may be under /usr/local/share/fcitx5 which
is not existed on NixOS. If we set its to /run/current-system/sw/share/..., this
will break for non-NixOS user.

Therefore, we patch it with a special environment variable to let user to load
it dynamically.

Co-Authored-by: Lan Tian <xuyh0120@outlook.com>
2022-04-25 08:50:14 +08:00

48 lines
864 B
Nix

{ lib, stdenv
, fetchFromGitHub
, pkg-config
, cmake
, extra-cmake-modules
, gettext
, fcitx5
, librime
}:
stdenv.mkDerivation rec {
pname = "fcitx5-rime";
version = "5.0.12";
src = fetchFromGitHub {
owner = "fcitx";
repo = pname;
rev = version;
sha256 = "sha256-8ETSRBTznd4AKzYbSW/zIMZXV+yuHXLhfTJV3DJ2ahc=";
};
cmakeFlags = [
"-DRIME_DATA_DIR=${placeholder "out"}/share/rime-data"
];
nativeBuildInputs = [
cmake
extra-cmake-modules
pkg-config
gettext
];
buildInputs = [
fcitx5
librime
];
patches = [ ./fcitx5-rime-with-nix-env-variable.patch ];
meta = with lib; {
description = "RIME support for Fcitx5";
homepage = "https://github.com/fcitx/fcitx5-rime";
license = licenses.lgpl21Plus;
maintainers = with maintainers; [ poscat ];
platforms = platforms.linux;
};
}