about summary refs log tree commit diff
path: root/nixpkgs/pkgs/tools/inputmethods/ibus-engines/ibus-typing-booster/wrapper.nix
blob: e6505f3cc46808d4981e601236105130d3830a71 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
{ typing-booster, symlinkJoin, hunspellDicts, lib, makeWrapper
, langs ? [ "de-de" "en-us" "es-es" "it-it" "sv-se" "sv-fi" ]
}:

let

  hunspellDirs = with lib; makeSearchPath ":" (flatten (flip map langs (lang: [
    "${hunspellDicts.${lang}}/share/hunspell"
    "${hunspellDicts.${lang}}/share/myspell"
    "${hunspellDicts.${lang}}/share/myspell/dicts"
  ])));

in

symlinkJoin {
  name = "${typing-booster.name}-with-hunspell";
  paths = [ typing-booster ];
  nativeBuildInputs = [ makeWrapper ];

  postBuild = ''
    for i in bin/emoji-picker libexec/ibus-{setup,engine}-typing-booster; do
      wrapProgram "$out/$i" \
        --prefix NIX_HUNSPELL_DIRS : ${hunspellDirs}
    done

    sed -i -e "s,${typing-booster},$out," $out/share/ibus/component/typing-booster.xml
  '';

  inherit (typing-booster) meta;
}