python3Packages.nltk.dataDir: init

Add helper function to install NLTK data packages like `wordnet` and `punkt-tab`.
Should be used in conjunction with `makeWrapperArgs`,
e.g. `makeWrapperArgs = [ "--set" "NLTK_DATA" "${nltk.dataDir(d: [ d.wordnet d.punkt-tab ])}" ];`
This commit is contained in:
Benjamin Sparks
2025-05-24 18:01:01 +02:00
parent 9562488efb
commit aee430ee47
2 changed files with 16 additions and 0 deletions
@@ -0,0 +1,15 @@
{
lib,
pkgs,
python3Packages,
}:
lib.makeOverridable (
{ ... }@nltkDataPkgs:
f:
pkgs.symlinkJoin {
inherit (python3Packages.nltk) meta;
name = "nltk-data-dir";
paths = f nltkDataPkgs;
}
) python3Packages.nltk.data
@@ -41,6 +41,7 @@ buildPythonPackage rec {
passthru = {
data = pkgs.nltk-data;
dataDir = pkgs.callPackage ./data-dir.nix { };
};
meta = with lib; {