summaryrefslogtreecommitdiff
path: root/pkgs/yalafi-shell/default.nix
blob: 907538e640dba7d52d03fe1dda9ce0396be856c2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
{
  python3,
  fetchFromGitHub,
  writeShellScriptBin,
  symlinkJoin,
  languagetool,
}: let
  yalafi = python3.pkgs.buildPythonPackage rec {
    pname = "YaLafi";
    version = "1.4.0";
    pyproject = true;

    src = fetchFromGitHub {
      owner = "torik42";
      repo = pname;
      rev = version;
      hash = "sha256-t+iVko04J4j0ULo7AJFhcf/iNVop91GGrpt/ggpQJZo=";
    };

    nativeBuildInputs = [
      python3.pkgs.setuptools-scm
    ];
  };

  python3-with-yalafi = python3.withPackages (ps: [yalafi]);
in
  symlinkJoin {
    name = "yalafi-utils";
    paths = [
      (writeShellScriptBin "yalafi-shell" ''
        ${python3-with-yalafi.interpreter} -m yalafi.shell --lt-command "${languagetool}"/bin/languagetool-commandline "$@"
      '')
      (writeShellScriptBin "yalafi-extract" ''
        ${python3-with-yalafi.interpreter} -m yalafi "$@"
      '')
    ];
  }