aspell: added new patch data-dirs-from-nix-profiles.patch

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.
This commit is contained in:
Rostislav Beneš
2017-10-22 21:01:40 +02:00
parent 6d86fcb86d
commit ba4cefe4ae
4 changed files with 49 additions and 24 deletions
+4 -23
View File
@@ -1,4 +1,5 @@
{stdenv, fetchurl, perl}:
{stdenv, fetchurl, perl
, searchNixProfiles ? true}:
stdenv.mkDerivation rec {
name = "aspell-0.60.6.1";
@@ -10,6 +11,8 @@ stdenv.mkDerivation rec {
patchPhase = ''
patch interfaces/cc/aspell.h < ${./clang.patch}
'' + stdenv.lib.optionalString searchNixProfiles ''
patch -p1 < ${./data-dirs-from-nix-profiles.patch}
'';
buildInputs = [ perl ];
@@ -23,28 +26,6 @@ stdenv.mkDerivation rec {
);
'';
postInstall = ''
local prog="$out/bin/aspell"
local hidden="$out/bin/.aspell-wrapped"
mv "$prog" "$hidden"
cat > "$prog" <<END
#! $SHELL -e
if [ -z "\$ASPELL_CONF" ]; then
for p in \$NIX_PROFILES; do
if [ -d "\$p/lib/aspell" ]; then
ASPELL_CONF="data-dir \$p/lib/aspell"
fi
done
if [ -z "\$ASPELL_CONF" ] && [ -d "\$HOME/.nix-profile/lib/aspell" ]; then
ASPELL_CONF="data-dir \$HOME/.nix-profile/lib/aspell"
fi
export ASPELL_CONF
fi
exec "$hidden" "\$@"
END
chmod +x "$prog"
'';
meta = {
description = "Spell checker for many languages";
homepage = http://aspell.net/;