git.iko.soy/typeable/nixpkgs
on master help sign in
Merge pull request #24425 from lpenz/aspellconf

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

commit792135a218de53d3d3cc32347f5cbf12d1df2721 authorBenno Fünfstück <benno.fuenfstueck@gmail.com> dateWed 19 Apr 2017, 17:11 (10 years ago) parent6bbc025ce6b5b8
1 file changed+21−6
pkgs/development/libraries/aspell/default.nix+21−6
pkgs/development/libraries/aspell/default.nix+21−6
@@ -23,12 +23,27 @@ stdenv.mkDerivation rec {
2323 );
2424 '';
2525
26− # Note: Users should define the `ASPELL_CONF' environment variable to
27− # `data-dir $HOME/.nix-profile/lib/aspell/' so that they can access
28− # dictionaries installed in their profile.
29− #
30− # We can't use `$out/etc/aspell.conf' for that purpose since Aspell
31− # doesn't expand environment variables such as `$HOME'.
26+ postInstall = ''
27+ local prog="$out/bin/aspell"
28+ local hidden="$out/bin/.aspell-wrapped"
29+ mv "$prog" "$hidden"
30+ cat > "$prog" <<END
31+ #! $SHELL -e
32+ if [ -z "\$ASPELL_CONF" ]; then
33+ for p in \$NIX_PROFILES; do
34+ if [ -d "\$p/lib/aspell" ]; then
35+ ASPELL_CONF="data-dir \$p/lib/aspell"
36+ fi
37+ done
38+ if [ -z "\$ASPELL_CONF" ] && [ -d "\$HOME/.nix-profile/lib/aspell" ]; then
39+ ASPELL_CONF="data-dir \$HOME/.nix-profile/lib/aspell"
40+ fi
41+ export ASPELL_CONF
42+ fi
43+ exec "$hidden" "\$@"
44+ END
45+ chmod +x "$prog"
46+ '';
3247
3348 meta = {
3449 description = "Spell checker for many languages";