nixpkgs/pkgs/development/libraries/aspell/aspell-with-dicts.nix
Frederik Rietdijk 91f7042aa0 aspellWithDicts: use a single env
In c0cf19608f the function
`aspellWithDicts` was introduced, that allows to build a derivation
consisting of aspell and specified dictionaries. In
96457d26dd a fix was included to properly
find the dictionaries.

Issue #29429 describes that, while the current method works for the
aspell binary, it does not in case of the API.

This commit rewrites the wrapper into a single derivation, create a
single tree of symbolic references to both the binary and the
dictionaries so that its possible to find the dictionaries with the API.
Furthermore, the binary is wrapped so it can still find the dictionaries
as well.
2017-09-16 13:06:26 +02:00

32 lines
636 B
Nix

# 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
'';
}