summary refs log tree commit diff
path: root/pkgs/development/libraries/aspell/aspell-with-dicts.nix
blob: 0739ad333df36b601d80f276b65c9a7128c91354 (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
31
32
# Create a derivation that contains aspell and selected dictionaries.
# Composition is done using `pkgs.buildEnv`.

{ aspell
, aspellDicts
, makeWrapper
, buildEnv
}:

f:

let
  # Dictionaries we want
  dicts = f aspellDicts;

in buildEnv {
  name = "aspell-env";
  buildInputs = [ makeWrapper ];
  paths = [ aspell ] ++ dicts;
  postBuild = ''
    # Construct wrappers in /bin
    unlink "$out/bin"
    mkdir -p "$out/bin"
    pushd "${aspell}/bin"
    for prg in *; do
      if [ -f "$prg" ]; then
        makeWrapper "${aspell}/bin/$prg" "$out/bin/$prg" --set ASPELL_CONF "dict-dir $out/lib/aspell"
      fi
    done
    popd
  '';
}