2023-07-31 08:09:18 +00:00
|
|
|
{ lib
|
|
|
|
, symlinkJoin
|
2023-07-31 08:08:22 +00:00
|
|
|
, makeBinaryWrapper
|
2023-07-31 08:09:18 +00:00
|
|
|
, fcitx5
|
2023-08-14 08:52:30 +00:00
|
|
|
, withConfigtool ? true
|
2023-07-31 08:09:18 +00:00
|
|
|
, fcitx5-configtool
|
|
|
|
, fcitx5-qt
|
|
|
|
, fcitx5-gtk
|
|
|
|
, addons ? [ ]
|
|
|
|
}:
|
2022-12-08 02:55:40 +00:00
|
|
|
|
2020-12-13 03:27:15 +00:00
|
|
|
symlinkJoin {
|
|
|
|
name = "fcitx5-with-addons-${fcitx5.version}";
|
|
|
|
|
2023-08-14 08:52:30 +00:00
|
|
|
paths = [
|
|
|
|
fcitx5
|
|
|
|
fcitx5-qt
|
|
|
|
fcitx5-gtk
|
|
|
|
] ++ lib.optionals withConfigtool [
|
|
|
|
fcitx5-configtool
|
|
|
|
] ++ addons;
|
2020-12-13 03:27:15 +00:00
|
|
|
|
2023-07-31 08:08:22 +00:00
|
|
|
nativeBuildInputs = [ makeBinaryWrapper ];
|
2020-12-13 03:27:15 +00:00
|
|
|
|
|
|
|
postBuild = ''
|
|
|
|
wrapProgram $out/bin/fcitx5 \
|
|
|
|
--prefix FCITX_ADDON_DIRS : "$out/lib/fcitx5" \
|
|
|
|
--suffix XDG_DATA_DIRS : "$out/share" \
|
2022-12-08 02:55:40 +00:00
|
|
|
--suffix PATH : "$out/bin" \
|
2023-07-31 08:08:22 +00:00
|
|
|
--suffix LD_LIBRARY_PATH : "${lib.makeLibraryPath (lib.flatten (map (x: x.extraLdLibraries or []) addons))}"
|
2021-01-17 16:53:58 +00:00
|
|
|
|
2023-09-13 14:11:30 +00:00
|
|
|
${lib.optionalString withConfigtool ''
|
2023-07-31 08:09:18 +00:00
|
|
|
# Configtool call libexec/fcitx5-qt5-gui-wrapper for gui addons in FCITX_ADDON_DIRS
|
|
|
|
wrapProgram $out/bin/fcitx5-config-qt --prefix FCITX_ADDON_DIRS : "$out/lib/fcitx5"
|
|
|
|
''}
|
|
|
|
|
2021-01-17 16:53:58 +00:00
|
|
|
desktop=share/applications/org.fcitx.Fcitx5.desktop
|
|
|
|
autostart=etc/xdg/autostart/org.fcitx.Fcitx5.desktop
|
|
|
|
rm $out/$desktop
|
|
|
|
rm $out/$autostart
|
|
|
|
cp ${fcitx5}/$desktop $out/$desktop
|
|
|
|
sed -i $out/$desktop -e "s|^Exec=.*|Exec=$out/bin/fcitx5|g"
|
2021-01-18 02:20:50 +00:00
|
|
|
ln -s $out/$desktop $out/$autostart
|
2020-12-13 03:27:15 +00:00
|
|
|
'';
|
|
|
|
|
2022-12-12 10:47:21 +00:00
|
|
|
inherit (fcitx5) meta;
|
2020-12-13 03:27:15 +00:00
|
|
|
}
|