Skip to content

Commit 20e1833

Browse files
committedSep 17, 2017
aspellWithDicts: use a single env
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)
1 parent b94ee1a commit 20e1833

File tree

1 file changed

+17
-20
lines changed

1 file changed

+17
-20
lines changed
 

Diff for: ‎pkgs/development/libraries/aspell/aspell-with-dicts.nix

+17-20
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,7 @@
44
{ aspell
55
, aspellDicts
66
, makeWrapper
7-
, symlinkJoin
8-
, runCommand
7+
, buildEnv
98
}:
109

1110
f:
@@ -14,22 +13,20 @@ let
1413
# Dictionaries we want
1514
dicts = f aspellDicts;
1615

17-
# A tree containing the dictionaries
18-
dictEnv = symlinkJoin {
19-
name = "aspell-dicts";
20-
paths = dicts;
21-
};
22-
23-
in runCommand "aspell-env" {
16+
in buildEnv {
17+
name = "aspell-env";
2418
buildInputs = [ makeWrapper ];
25-
} ''
26-
# Construct wrappers in /bin
27-
mkdir -p $out/bin
28-
pushd "${aspell}/bin"
29-
for prg in *; do
30-
if [ -f "$prg" ]; then
31-
makeWrapper "${aspell}/bin/$prg" "$out/bin/$prg" --set ASPELL_CONF "dict-dir ${dictEnv}/lib/aspell"
32-
fi
33-
done
34-
popd
35-
''
19+
paths = [ aspell ] ++ dicts;
20+
postBuild = ''
21+
# Construct wrappers in /bin
22+
unlink "$out/bin"
23+
mkdir -p "$out/bin"
24+
pushd "${aspell}/bin"
25+
for prg in *; do
26+
if [ -f "$prg" ]; then
27+
makeWrapper "${aspell}/bin/$prg" "$out/bin/$prg" --set ASPELL_CONF "dict-dir $out/lib/aspell"
28+
fi
29+
done
30+
popd
31+
'';
32+
}

0 commit comments

Comments
 (0)
Please sign in to comment.