about summary refs log tree commit diff
path: root/nixpkgs/pkgs/applications/editors/retext/default.nix
blob: 19cc7bc2970816ae89b74d12f1cac7eea398ef4f (plain) (blame)
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
38
39
40
41
42
43
44
45
{ lib, python3, fetchFromGitHub, wrapQtAppsHook, buildEnv, aspellDicts
# Use `lib.collect lib.isDerivation aspellDicts;` to make all dictionaries
# available.
, enchantAspellDicts ? with aspellDicts; [ en en-computers en-science ]
}:

let
  version = "7.0.4";
  pythonEnv = python3.withPackages (ps: with ps; [
    pyqt5 docutils pyenchant Markups markdown pygments chardet
  ]);
in python3.pkgs.buildPythonApplication {
  inherit version;
  pname = "retext";

  src = fetchFromGitHub {
    owner = "retext-project";
    repo = "retext";
    rev = version;
    sha256 = "1zcapywspc9v5zf5cxqkcy019np9n41gmryqixj66zsvd544c6si";
  };

  doCheck = false;

  nativeBuildInputs = [ wrapQtAppsHook ];
  propagatedBuildInputs = [ pythonEnv ];

  postInstall = ''
    makeWrapperArgs+=("''${qtWrapperArgs[@]}")
    makeWrapperArgs+=(
      "--set" "ASPELL_CONF" "dict-dir ${buildEnv {
        name = "aspell-all-dicts";
        paths = map (path: "${path}/lib/aspell") enchantAspellDicts;
      }}"
    )
  '';

  meta = with lib; {
    homepage = "https://github.com/retext-project/retext/";
    description = "Simple but powerful editor for Markdown and reStructuredText";
    license = licenses.gpl3;
    maintainers = with maintainers; [ klntsky ];
    platforms = platforms.unix;
  };
}