diff --git a/pkgs/development/libraries/aspell/aspell-with-dicts.nix b/pkgs/development/libraries/aspell/aspell-with-dicts.nix new file mode 100644 index 00000000000..eb96070f4fd --- /dev/null +++ b/pkgs/development/libraries/aspell/aspell-with-dicts.nix @@ -0,0 +1,35 @@ +# Create a derivation that contains aspell and selected dictionaries. +# Composition is done using `pkgs.buildEnv`. + +{ aspell +, aspellDicts +, makeWrapper +, symlinkJoin +, runCommand +}: + +f: + +let + # Dictionaries we want + dicts = f aspellDicts; + + # A tree containing the dictionaries + dictEnv = symlinkJoin { + name = "aspell-dicts"; + paths = dicts; + }; + +in runCommand "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 "data-dir ${dictEnv}/lib/aspell" + fi + done + popd +'' diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 3d09b8893b4..149f99504a7 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -7393,6 +7393,8 @@ with pkgs; aspellDicts = recurseIntoAttrs (callPackages ../development/libraries/aspell/dictionaries.nix {}); + aspellWithDicts = callPackage ../development/libraries/aspell/aspell-with-dicts.nix { }; + attica = callPackage ../development/libraries/attica { }; attr = callPackage ../development/libraries/attr { };