Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set aspell's data-dir through ASPELL_CONF in a wrapper #24425

Merged
merged 1 commit into from
Apr 19, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 21 additions & 6 deletions pkgs/development/libraries/aspell/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,27 @@ stdenv.mkDerivation rec {
);
'';

# Note: Users should define the `ASPELL_CONF' environment variable to
# `data-dir $HOME/.nix-profile/lib/aspell/' so that they can access
# dictionaries installed in their profile.
#
# We can't use `$out/etc/aspell.conf' for that purpose since Aspell
# doesn't expand environment variables such as `$HOME'.
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";
Expand Down