nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 lib,
3 fetchFromGitLab,
4 gtksourceview5,
5 libspelling,
6 fetchFromGitHub,
7 python312Packages,
8 mathjax,
9 meson,
10 ninja,
11 pkg-config,
12 wrapGAppsHook4,
13 desktop-file-utils,
14 gobject-introspection,
15 libadwaita,
16 webkitgtk_6_0,
17 texliveMedium,
18 shared-mime-info,
19 nix-update-script,
20}:
21
22let
23 version = "3.4";
24
25 src = fetchFromGitLab {
26 owner = "World";
27 repo = "apostrophe";
28 domain = "gitlab.gnome.org";
29 tag = "v${version}";
30 hash = "sha256-Sj5Y4QPMYavdXbU+iVv76qOFNhgBjAeX9+/TvQHZzeI=";
31 };
32
33 reveal-js = fetchFromGitHub {
34 owner = "hakimel";
35 repo = "reveal.js";
36
37 # keep in sync with upstream shipped version
38 # in build-aux/flatpak/org.gnome.gitlab.somas.Apostrophe.json
39 tag = "5.1.0";
40 hash = "sha256-L6KVBw20K67lHT07Ws+ZC2DwdURahqyuyjAaK0kTgN0=";
41 };
42in
43
44# Requires telnetlib, and possibly others
45# Try to remove in subsequent updates
46python312Packages.buildPythonApplication {
47 inherit version src;
48 pname = "apostrophe";
49 pyproject = false;
50
51 postPatch = ''
52 substituteInPlace build-aux/meson_post_install.py \
53 --replace-fail 'gtk-update-icon-cache' 'gtk4-update-icon-cache'
54
55 patchShebangs --build build-aux/meson_post_install.py
56 ''
57 # Use mathjax from nixpkgs to avoid loading from CDN
58 + ''
59 substituteInPlace apostrophe/preview_converter.py \
60 --replace-fail "--mathjax" "--mathjax=file://${mathjax}/lib/node_modules/mathjax/tex-chtml-full.js"
61 '';
62
63 # Should be done in postInstall, but meson checks this eagerly before build
64 preConfigure = ''
65 install -d $out/share/apostrophe/libs
66 cp -r ${reveal-js} $out/share/apostrophe/libs/reveal.js
67 '';
68
69 nativeBuildInputs = [
70 meson
71 ninja
72 pkg-config
73 wrapGAppsHook4
74 desktop-file-utils
75 gobject-introspection
76 ];
77
78 buildInputs = [
79 libadwaita
80 gtksourceview5
81 libspelling
82 webkitgtk_6_0
83 ];
84
85 dependencies = with python312Packages; [
86 pygobject3
87 pypandoc
88 chardet
89 levenshtein
90 regex
91 ];
92
93 dontWrapGApps = true;
94
95 preFixup = ''
96 makeWrapperArgs+=(
97 ''${gappsWrapperArgs[@]}
98 --prefix PATH : "${texliveMedium}/bin"
99 --prefix XDG_DATA_DIRS : "${shared-mime-info}/share"
100 )
101 '';
102
103 passthru = {
104 inherit reveal-js;
105 updateScript = nix-update-script { };
106 };
107
108 meta = {
109 homepage = "https://gitlab.gnome.org/World/apostrophe";
110 description = "Distraction free Markdown editor for GNU/Linux";
111 license = lib.licenses.gpl3Plus;
112 platforms = lib.platforms.linux;
113 maintainers = with lib.maintainers; [
114 sternenseemann
115 ];
116 teams = [ lib.teams.gnome-circle ];
117 mainProgram = "apostrophe";
118 };
119}