summary refs log tree commit diff
path: root/pkgs/development/libraries/aspell
diff options
context:
space:
mode:
authorFrederik Rietdijk <fridh@fridh.nl>2017-09-16 13:06:26 +0200
committerFrederik Rietdijk <fridh@fridh.nl>2017-09-16 13:06:26 +0200
commit91f7042aa09eb7488267a01a68c46bab05d8515e (patch)
treed1ebf362b4b6c4622d213da640f1498a850bd3e0 /pkgs/development/libraries/aspell
parent03fa6965ad7738bec6bb606deebf3a337f6ab291 (diff)
downloadnixpkgs-91f7042aa09eb7488267a01a68c46bab05d8515e.tar
nixpkgs-91f7042aa09eb7488267a01a68c46bab05d8515e.tar.gz
nixpkgs-91f7042aa09eb7488267a01a68c46bab05d8515e.tar.bz2
nixpkgs-91f7042aa09eb7488267a01a68c46bab05d8515e.tar.lz
nixpkgs-91f7042aa09eb7488267a01a68c46bab05d8515e.tar.xz
nixpkgs-91f7042aa09eb7488267a01a68c46bab05d8515e.tar.zst
nixpkgs-91f7042aa09eb7488267a01a68c46bab05d8515e.zip
aspellWithDicts: use a single env
In c0cf19608faf447d4b78f77ff36a770462b19a22 the function
`aspellWithDicts` was introduced, that allows to build a derivation
consisting of aspell and specified dictionaries. In
96457d26dded05bcba8e9fbb9bf0255596654aab 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.
Diffstat (limited to 'pkgs/development/libraries/aspell')
-rw-r--r--pkgs/development/libraries/aspell/aspell-with-dicts.nix37
1 files changed, 17 insertions, 20 deletions
diff --git a/pkgs/development/libraries/aspell/aspell-with-dicts.nix b/pkgs/development/libraries/aspell/aspell-with-dicts.nix
index 96acfe6c2a8..0739ad333df 100644
--- a/pkgs/development/libraries/aspell/aspell-with-dicts.nix
+++ b/pkgs/development/libraries/aspell/aspell-with-dicts.nix
@@ -4,8 +4,7 @@
 { aspell
 , aspellDicts
 , makeWrapper
-, symlinkJoin
-, runCommand
+, buildEnv
 }:
 
 f:
@@ -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
+  '';
+}
\ No newline at end of file