diff options
author | Aleksana <me@aleksana.moe> | 2024-05-07 10:10:40 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-05-07 10:10:40 +0800 |
commit | 51a38149cf04bebf0f4c2092eb83e1b3970e2212 (patch) | |
tree | c11bf8144ca54d66fa1d0a739794a100f5601ffc | |
parent | f969f5fa62b5c745ad473d04cab7c74b51dc5a4a (diff) | |
parent | ca30363956b0317592b82330aa7d1009bae02489 (diff) |
Merge pull request #309031 from Aleksanaa/apostrophe
apostrophe: 2.6.3 -> 3.0
-rw-r--r-- | pkgs/applications/editors/apostrophe/default.nix | 59 | ||||
-rw-r--r-- | pkgs/by-name/ap/apostrophe/package.nix | 118 | ||||
-rw-r--r-- | pkgs/top-level/all-packages.nix | 4 |
3 files changed, 118 insertions, 63 deletions
diff --git a/pkgs/applications/editors/apostrophe/default.nix b/pkgs/applications/editors/apostrophe/default.nix deleted file mode 100644 index 768402f4e5a7c..0000000000000 --- a/pkgs/applications/editors/apostrophe/default.nix +++ /dev/null @@ -1,59 +0,0 @@ -{ 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"; - }; -} diff --git a/pkgs/by-name/ap/apostrophe/package.nix b/pkgs/by-name/ap/apostrophe/package.nix new file mode 100644 index 0000000000000..503e4ff2f1946 --- /dev/null +++ b/pkgs/by-name/ap/apostrophe/package.nix @@ -0,0 +1,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.0"; + + src = fetchFromGitLab { + owner = "World"; + repo = "apostrophe"; + domain = "gitlab.gnome.org"; + rev = "v${version}"; + sha256 = "sha256-wKxRCU00nSk7F8IZNWoLRtGs3m6ol3UBnArtppUOz/g="; + }; + + # 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 = "A distraction free Markdown editor for GNU/Linux"; + license = lib.licenses.gpl3Plus; + platforms = lib.platforms.linux; + maintainers = with lib.maintainers; [ + sternenseemann + aleksana + ]; + mainProgram = "apostrophe"; + }; +} diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 445ae11207075..c526f939d01d4 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -29712,10 +29712,6 @@ with pkgs; appgate-sdp = callPackage ../applications/networking/appgate-sdp { }; - apostrophe = callPackage ../applications/editors/apostrophe { - pythonPackages = python3Packages; - }; - ardour = callPackage ../applications/audio/ardour { }; ardour_7 = callPackage ../applications/audio/ardour/7.nix { }; |