about summary refs log tree commit diff
path: root/nixpkgs/pkgs/development/libraries/aspell/aspell-with-dicts.nix
diff options
context:
space:
mode:
Diffstat (limited to 'nixpkgs/pkgs/development/libraries/aspell/aspell-with-dicts.nix')
-rw-r--r--nixpkgs/pkgs/development/libraries/aspell/aspell-with-dicts.nix36
1 files changed, 36 insertions, 0 deletions
diff --git a/nixpkgs/pkgs/development/libraries/aspell/aspell-with-dicts.nix b/nixpkgs/pkgs/development/libraries/aspell/aspell-with-dicts.nix
new file mode 100644
index 000000000000..88b1302271fb
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/aspell/aspell-with-dicts.nix
@@ -0,0 +1,36 @@
+# Create a derivation that contains aspell and selected dictionaries.
+# Composition is done using `pkgs.buildEnv`.
+# Beware of that `ASPELL_CONF` used by this derivation is not always
+# respected by libaspell (#28815) and in some cases, when used as
+# dependency by another derivation, the passed dictionaries will be
+# missing. However, invoking aspell directly should be fine.
+
+{ aspell
+, aspellDicts
+, makeWrapper
+, buildEnv
+}:
+
+f:
+
+let
+  # Dictionaries we want
+  dicts = f aspellDicts;
+
+in buildEnv {
+  name = "aspell-env";
+  buildInputs = [ makeWrapper ];
+  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
+  '';
+}