Skip to content

Commit

Permalink
aspellWithDicts: use a single env
Browse files Browse the repository at this point in the history
In c0cf196 the function
`aspellWithDicts` was introduced, that allows to build a derivation
consisting of aspell and specified dictionaries. In
96457d2 a fix was included to properly
find the dictionaries.

Issue #29429 describes that, while the current method works for the
aspell binary, it does not in case of the API.

This commit rewrites the wrapper into a single derivation, create a
single tree of symbolic references to both the binary and the
dictionaries so that its possible to find the dictionaries with the API.
Furthermore, the binary is wrapped so it can still find the dictionaries
as well.

(cherry picked from commit 91f7042)
  • Loading branch information
FRidh committed Sep 17, 2017
1 parent b94ee1a commit 20e1833
Showing 1 changed file with 17 additions and 20 deletions.
37 changes: 17 additions & 20 deletions pkgs/development/libraries/aspell/aspell-with-dicts.nix
Expand Up @@ -4,8 +4,7 @@
{ aspell
, aspellDicts
, makeWrapper
, symlinkJoin
, runCommand
, buildEnv
}:

f:
Expand All @@ -14,22 +13,20 @@ let
# Dictionaries we want
dicts = f aspellDicts;

# A tree containing the dictionaries
dictEnv = symlinkJoin {
name = "aspell-dicts";
paths = dicts;
};

in runCommand "aspell-env" {
in buildEnv {
name = "aspell-env";
buildInputs = [ makeWrapper ];
} ''
# Construct wrappers in /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 ${dictEnv}/lib/aspell"
fi
done
popd
''
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
'';
}

0 comments on commit 20e1833

Please sign in to comment.