summary refs log tree commit diff
path: root/pkgs/applications/editors/retext/default.nix
blob: 7752313b2a7ed62d6c0d6b52e66e6dc8276f66b2 (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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
{ stdenv, 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";
  python = let
    packageOverrides = self: super: {
      markdown = super.markdown.overridePythonAttrs(old: {
        src = super.fetchPypi {
          version = "3.0.1";
          pname = "Markdown";
          sha256 = "d02e0f9b04c500cde6637c11ad7c72671f359b87b9fe924b2383649d8841db7c";
        };
      });

      chardet = super.chardet.overridePythonAttrs(old: {
        src = super.fetchPypi {
          version = "2.3.0";
          pname = "chardet";
          sha256 = "e53e38b3a4afe6d1132de62b7400a4ac363452dc5dfcf8d88e8e0cce663c68aa";
        };
        patches = [];
      });
    };
    in python3.override { inherit packageOverrides; };
  pythonEnv = python.withPackages (ps: with ps; [
    pyqt5 docutils pyenchant Markups markdown pygments chardet
  ]);
in python.pkgs.buildPythonApplication {
  inherit version;
  pname = "retext";

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

  doCheck = false;

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

  postInstall = ''
    wrapQtApp "$out/bin/retext" \
      --set ASPELL_CONF "dict-dir ${buildEnv {
        name = "aspell-all-dicts";
        paths = map (path: "${path}/lib/aspell") enchantAspellDicts;
      }}"
  '';

  meta = with stdenv.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;
  };
}