From 10988d8adeea21aaa8485fb5eac83caec6c673cf Mon Sep 17 00:00:00 2001 From: aleksana Date: Sat, 4 May 2024 16:54:42 +0800 Subject: [PATCH 1/4] apostrophe: move to pkgs/by-name --- .../default.nix => by-name/ap/apostrophe/package.nix} | 4 ++-- pkgs/top-level/all-packages.nix | 4 ---- 2 files changed, 2 insertions(+), 6 deletions(-) rename pkgs/{applications/editors/apostrophe/default.nix => by-name/ap/apostrophe/package.nix} (93%) diff --git a/pkgs/applications/editors/apostrophe/default.nix b/pkgs/by-name/ap/apostrophe/package.nix similarity index 93% rename from pkgs/applications/editors/apostrophe/default.nix rename to pkgs/by-name/ap/apostrophe/package.nix index 768402f4e5a7..b3915a9651fb 100644 --- a/pkgs/applications/editors/apostrophe/default.nix +++ b/pkgs/by-name/ap/apostrophe/package.nix @@ -1,12 +1,12 @@ { lib, stdenv, fetchFromGitLab, meson, ninja , wrapGAppsHook3, pkg-config, desktop-file-utils -, appstream-glib, pythonPackages, glib, gobject-introspection +, appstream-glib, python3Packages, glib, gobject-introspection , gtk3, webkitgtk, glib-networking, gnome, gspell, texliveMedium , shared-mime-info, libhandy, fira, sassc }: let - pythonEnv = pythonPackages.python.withPackages(p: with p; [ + pythonEnv = python3Packages.python.withPackages(p: with p; [ regex setuptools levenshtein pyenchant pygobject3 pycairo pypandoc chardet ]); diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 012ca8aaf600..daba8bc585ea 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -29738,10 +29738,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 { }; From 83ceecf14899dabfd2c84ba95cbd25cfe2120c62 Mon Sep 17 00:00:00 2001 From: aleksana Date: Sun, 5 May 2024 22:38:25 +0800 Subject: [PATCH 2/4] apostrophe: format with nixfmt-rfc-style --- pkgs/by-name/ap/apostrophe/package.nix | 80 ++++++++++++++++++++------ 1 file changed, 61 insertions(+), 19 deletions(-) diff --git a/pkgs/by-name/ap/apostrophe/package.nix b/pkgs/by-name/ap/apostrophe/package.nix index b3915a9651fb..c335268df8a6 100644 --- a/pkgs/by-name/ap/apostrophe/package.nix +++ b/pkgs/by-name/ap/apostrophe/package.nix @@ -1,34 +1,76 @@ -{ lib, stdenv, fetchFromGitLab, meson, ninja -, wrapGAppsHook3, pkg-config, desktop-file-utils -, appstream-glib, python3Packages, glib, gobject-introspection -, gtk3, webkitgtk, glib-networking, gnome, gspell, texliveMedium -, shared-mime-info, libhandy, fira, sassc +{ + lib, + stdenv, + fetchFromGitLab, + meson, + ninja, + wrapGAppsHook3, + pkg-config, + desktop-file-utils, + appstream-glib, + python3Packages, + glib, + gobject-introspection, + gtk3, + webkitgtk, + glib-networking, + gnome, + gspell, + texliveMedium, + shared-mime-info, + libhandy, + fira, + sassc, }: let - pythonEnv = python3Packages.python.withPackages(p: with p; [ - regex setuptools levenshtein pyenchant - pygobject3 pycairo pypandoc chardet - ]); - -in stdenv.mkDerivation rec { + pythonEnv = python3Packages.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; + owner = "World"; + repo = pname; domain = "gitlab.gnome.org"; - rev = "v${version}"; + rev = "v${version}"; sha256 = "sha256-RBrrG1TO810LidIelYGNaK7PjDq84D0cA8VcMojAW3M="; }; - nativeBuildInputs = [ meson ninja pkg-config desktop-file-utils - appstream-glib wrapGAppsHook3 sassc gobject-introspection ]; + 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 ]; + buildInputs = [ + glib + pythonEnv + gtk3 + gnome.adwaita-icon-theme + webkitgtk + gspell + texliveMedium + glib-networking + libhandy + ]; postPatch = '' substituteInPlace data/media/css/web/base.css \ From 95d941d41616a9dddedbfe905df4f523dd9b09da Mon Sep 17 00:00:00 2001 From: aleksana Date: Sun, 5 May 2024 22:42:38 +0800 Subject: [PATCH 3/4] apostrophe: 2.6.3 -> 3.0 --- pkgs/by-name/ap/apostrophe/package.nix | 128 ++++++++++++++----------- 1 file changed, 71 insertions(+), 57 deletions(-) diff --git a/pkgs/by-name/ap/apostrophe/package.nix b/pkgs/by-name/ap/apostrophe/package.nix index c335268df8a6..649a763760fb 100644 --- a/pkgs/by-name/ap/apostrophe/package.nix +++ b/pkgs/by-name/ap/apostrophe/package.nix @@ -1,101 +1,115 @@ { lib, - stdenv, fetchFromGitLab, + gtksourceview5, + libspelling, + fetchFromGitHub, + python3Packages, meson, ninja, - wrapGAppsHook3, pkg-config, + wrapGAppsHook4, desktop-file-utils, - appstream-glib, - python3Packages, - glib, gobject-introspection, - gtk3, - webkitgtk, - glib-networking, - gnome, - gspell, + libadwaita, + webkitgtk_6_0, texliveMedium, shared-mime-info, - libhandy, - fira, - sassc, }: let - pythonEnv = python3Packages.python.withPackages ( - p: with p; [ - regex - setuptools - levenshtein - pyenchant - pygobject3 - pycairo - pypandoc - chardet - ] - ); -in -stdenv.mkDerivation rec { - pname = "apostrophe"; - version = "2.6.3"; + version = "3.0"; src = fetchFromGitLab { owner = "World"; - repo = pname; + repo = "apostrophe"; domain = "gitlab.gnome.org"; rev = "v${version}"; - sha256 = "sha256-RBrrG1TO810LidIelYGNaK7PjDq84D0cA8VcMojAW3M="; + 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 - appstream-glib - wrapGAppsHook3 - sassc gobject-introspection ]; buildInputs = [ - glib - pythonEnv - gtk3 - gnome.adwaita-icon-theme - webkitgtk - gspell - texliveMedium - glib-networking - libhandy + libadwaita + gtksourceview5-patched + libspelling-patched + webkitgtk_6_0 ]; - 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")' + propagatedBuildInputs = with python3Packages; [ + pygobject3 + pypandoc + chardet + ]; - patchShebangs --build build-aux/meson_post_install.py - ''; + dontWrapGApps = true; preFixup = '' - gappsWrapperArgs+=( - --prefix PYTHONPATH : "$out/lib/python${pythonEnv.pythonVersion}/site-packages/" + makeWrapperArgs+=( + ''${gappsWrapperArgs[@]} --prefix PATH : "${texliveMedium}/bin" --prefix XDG_DATA_DIRS : "${shared-mime-info}/share" ) ''; - meta = with lib; { + 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 = licenses.gpl3; - platforms = platforms.linux; - maintainers = [ maintainers.sternenseemann ]; + license = lib.licenses.gpl3Plus; + platforms = lib.platforms.linux; + maintainers = with lib.maintainers; [ sternenseemann ]; mainProgram = "apostrophe"; }; } From ca30363956b0317592b82330aa7d1009bae02489 Mon Sep 17 00:00:00 2001 From: aleksana Date: Sun, 5 May 2024 22:43:26 +0800 Subject: [PATCH 4/4] apostrophe: add aleksana as maintainers --- pkgs/by-name/ap/apostrophe/package.nix | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/pkgs/by-name/ap/apostrophe/package.nix b/pkgs/by-name/ap/apostrophe/package.nix index 649a763760fb..503e4ff2f194 100644 --- a/pkgs/by-name/ap/apostrophe/package.nix +++ b/pkgs/by-name/ap/apostrophe/package.nix @@ -109,7 +109,10 @@ python3Packages.buildPythonApplication rec { description = "A distraction free Markdown editor for GNU/Linux"; license = lib.licenses.gpl3Plus; platforms = lib.platforms.linux; - maintainers = with lib.maintainers; [ sternenseemann ]; + maintainers = with lib.maintainers; [ + sternenseemann + aleksana + ]; mainProgram = "apostrophe"; }; }