mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-12-05 12:02:47 +00:00
ba4cefe4ae
Aspell will search for dictionaries in all nix profiles even when used as library. Setting data-dir or dict-dir in ASPELL_CONF will disable this behavior.
36 lines
900 B
Nix
36 lines
900 B
Nix
# Create a derivation that contains aspell and selected dictionaries.
|
|
# Composition is done using `pkgs.buildEnv`.
|
|
# 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.
|
|
|
|
{ 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
|
|
'';
|
|
} |