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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
|
{
lib,
fetchFromGitLab,
gtksourceview5,
libspelling,
fetchFromGitHub,
python3Packages,
meson,
ninja,
pkg-config,
wrapGAppsHook4,
desktop-file-utils,
gobject-introspection,
libadwaita,
webkitgtk_6_0,
texliveMedium,
shared-mime-info,
}:
let
version = "3.1";
src = fetchFromGitLab {
owner = "World";
repo = "apostrophe";
domain = "gitlab.gnome.org";
rev = "v${version}";
sha256 = "sha256-rXaz0EtLuKOBJLF81K/4qoTZtG6B8Wn+KwSiqYvxAVc=";
};
# Patches are required by upstream. Without the patches
# typing `- aaa`, newline, `- bbb` the program crashes
gtksourceview5-patched = gtksourceview5.overrideAttrs (prev: {
patches = (prev.patches or [ ]) ++ [ "${src}/build-aux/flatpak/sourceview_text_commits.patch" ];
});
libspelling-patched =
(libspelling.override { gtksourceview5 = gtksourceview5-patched; }).overrideAttrs
(prev: {
patches = (prev.patches or [ ]) ++ [ "${src}/build-aux/flatpak/libspelling_text_commits.patch" ];
});
reveal-js = fetchFromGitHub {
owner = "hakimel";
repo = "reveal.js";
# keep in sync with upstream shipped version
# in build-aux/flatpak/org.gnome.gitlab.somas.Apostrophe.json
rev = "4.6.0";
hash = "sha256-a+J+GasFmRvu5cJ1GLXscoJ+owzFXsLhCbeDbYChkyQ=";
};
in
python3Packages.buildPythonApplication rec {
inherit version src;
pname = "apostrophe";
pyproject = false;
postPatch =
''
substituteInPlace build-aux/meson_post_install.py \
--replace-fail 'gtk-update-icon-cache' 'gtk4-update-icon-cache'
patchShebangs --build build-aux/meson_post_install.py
''
# Should be done in postInstall, but meson checks this eagerly before build
+ ''
install -d $out/share/apostrophe/libs
cp -r ${reveal-js} $out/share/apostrophe/libs/reveal.js
'';
nativeBuildInputs = [
meson
ninja
pkg-config
wrapGAppsHook4
desktop-file-utils
gobject-introspection
];
buildInputs = [
libadwaita
gtksourceview5-patched
libspelling-patched
webkitgtk_6_0
];
propagatedBuildInputs = with python3Packages; [
pygobject3
pypandoc
chardet
];
dontWrapGApps = true;
preFixup = ''
makeWrapperArgs+=(
''${gappsWrapperArgs[@]}
--prefix PATH : "${texliveMedium}/bin"
--prefix XDG_DATA_DIRS : "${shared-mime-info}/share"
)
'';
passthru = {
inherit gtksourceview5-patched libspelling-patched reveal-js;
};
meta = {
homepage = "https://gitlab.gnome.org/World/apostrophe";
description = "Distraction free Markdown editor for GNU/Linux";
license = lib.licenses.gpl3Plus;
platforms = lib.platforms.linux;
maintainers = with lib.maintainers; [
sternenseemann
aleksana
];
mainProgram = "apostrophe";
};
}
|