about summary refs log tree commit diff
path: root/pkgs/applications/editors/apostrophe/default.nix
blob: 768402f4e5a7c5a730672bd954257fa000a99a60 (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
{ lib, stdenv, fetchFromGitLab, meson, ninja
, wrapGAppsHook3, pkg-config, desktop-file-utils
, appstream-glib, pythonPackages, glib, gobject-introspection
, gtk3, webkitgtk, glib-networking, gnome, gspell, texliveMedium
, shared-mime-info, libhandy, fira, sassc
}:

let
  pythonEnv = pythonPackages.python.withPackages(p: with p; [
    regex setuptools levenshtein pyenchant
    pygobject3 pycairo pypandoc chardet
  ]);

in stdenv.mkDerivation rec {
  pname = "apostrophe";
  version = "2.6.3";

  src = fetchFromGitLab {
    owner  = "World";
    repo   = pname;
    domain = "gitlab.gnome.org";
    rev    = "v${version}";
    sha256 = "sha256-RBrrG1TO810LidIelYGNaK7PjDq84D0cA8VcMojAW3M=";
  };

  nativeBuildInputs = [ meson ninja pkg-config desktop-file-utils
    appstream-glib wrapGAppsHook3 sassc gobject-introspection ];

  buildInputs = [ glib pythonEnv gtk3
    gnome.adwaita-icon-theme webkitgtk gspell texliveMedium
    glib-networking libhandy ];

  postPatch = ''
    substituteInPlace data/media/css/web/base.css                                        \
      --replace 'url("/app/share/fonts/FiraSans-Regular.ttf") format("ttf")'             \
                'url("${fira}/share/fonts/opentype/FiraSans-Regular.otf") format("otf")' \
      --replace 'url("/app/share/fonts/FiraMono-Regular.ttf") format("ttf")'             \
                'url("${fira}/share/fonts/opentype/FiraMono-Regular.otf") format("otf")'

    patchShebangs --build build-aux/meson_post_install.py
  '';

  preFixup = ''
    gappsWrapperArgs+=(
      --prefix PYTHONPATH : "$out/lib/python${pythonEnv.pythonVersion}/site-packages/"
      --prefix PATH : "${texliveMedium}/bin"
      --prefix XDG_DATA_DIRS : "${shared-mime-info}/share"
    )
  '';

  meta = with lib; {
    homepage = "https://gitlab.gnome.org/World/apostrophe";
    description = "A distraction free Markdown editor for GNU/Linux";
    license = licenses.gpl3;
    platforms = platforms.linux;
    maintainers = [ maintainers.sternenseemann ];
    mainProgram = "apostrophe";
  };
}