Merge pull request #24425 from lpenz/aspellconf
Set aspell's data-dir through ASPELL_CONF in a wrapper
This commit is contained in:
commit
792135a218
|
@ -23,12 +23,27 @@ stdenv.mkDerivation rec {
|
||||||
);
|
);
|
||||||
'';
|
'';
|
||||||
|
|
||||||
# Note: Users should define the `ASPELL_CONF' environment variable to
|
postInstall = ''
|
||||||
# `data-dir $HOME/.nix-profile/lib/aspell/' so that they can access
|
local prog="$out/bin/aspell"
|
||||||
# dictionaries installed in their profile.
|
local hidden="$out/bin/.aspell-wrapped"
|
||||||
#
|
mv "$prog" "$hidden"
|
||||||
# We can't use `$out/etc/aspell.conf' for that purpose since Aspell
|
cat > "$prog" <<END
|
||||||
# doesn't expand environment variables such as `$HOME'.
|
#! $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 = {
|
meta = {
|
||||||
description = "Spell checker for many languages";
|
description = "Spell checker for many languages";
|
||||||
|
|
Loading…
Reference in New Issue