2017-06-16 14:52:46 +01:00
|
|
|
# Create a derivation that contains aspell and selected dictionaries.
|
|
|
|
# Composition is done using `pkgs.buildEnv`.
|
2017-10-08 20:42:22 +01:00
|
|
|
# Beware of that `ASPELL_CONF` used by this derivation is not always
|
|
|
|
# respected by libaspell (#28815) and in some cases, when used as
|
|
|
|
# dependency by another derivation, the passed dictionaries will be
|
|
|
|
# missing. However, invoking aspell directly should be fine.
|
2017-06-16 14:52:46 +01:00
|
|
|
|
|
|
|
{ aspell
|
|
|
|
, aspellDicts
|
|
|
|
, makeWrapper
|
2017-09-16 12:06:26 +01:00
|
|
|
, buildEnv
|
2017-06-16 14:52:46 +01:00
|
|
|
}:
|
|
|
|
|
|
|
|
f:
|
|
|
|
|
|
|
|
let
|
|
|
|
# Dictionaries we want
|
|
|
|
dicts = f aspellDicts;
|
|
|
|
|
2017-09-16 12:06:26 +01:00
|
|
|
in buildEnv {
|
|
|
|
name = "aspell-env";
|
2017-06-16 14:52:46 +01:00
|
|
|
buildInputs = [ makeWrapper ];
|
2017-09-16 12:06:26 +01:00
|
|
|
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
|
|
|
|
'';
|
2020-11-05 23:28:15 +00:00
|
|
|
}
|