about summary refs log tree commit diff
path: root/nixpkgs/pkgs/applications/editors/mindforger
diff options
context:
space:
mode:
Diffstat (limited to 'nixpkgs/pkgs/applications/editors/mindforger')
-rw-r--r--nixpkgs/pkgs/applications/editors/mindforger/default.nix69
-rw-r--r--nixpkgs/pkgs/applications/editors/mindforger/paths.patch42
2 files changed, 111 insertions, 0 deletions
diff --git a/nixpkgs/pkgs/applications/editors/mindforger/default.nix b/nixpkgs/pkgs/applications/editors/mindforger/default.nix
new file mode 100644
index 000000000000..de304cd6208a
--- /dev/null
+++ b/nixpkgs/pkgs/applications/editors/mindforger/default.nix
@@ -0,0 +1,69 @@
+{ lib
+, stdenv
+, cmark-gfm
+, fetchurl
+, fetchpatch
+, qmake
+, qtbase
+, qtwebengine
+, wrapGAppsHook
+, wrapQtAppsHook
+}:
+
+stdenv.mkDerivation rec {
+  pname = "mindforger";
+  version = "1.52.0";
+
+  src = fetchurl {
+    url = "https://github.com/dvorka/mindforger/releases/download/${version}/mindforger_${version}.tgz";
+    sha256 = "1pghsw8kwvjhg3jpmjs0n892h2l0pm0cs6ymi8b23fwk0kfj67rd";
+  };
+
+  nativeBuildInputs = [ qmake wrapGAppsHook wrapQtAppsHook ];
+  buildInputs = [ qtbase qtwebengine cmark-gfm ];
+
+  doCheck = true;
+
+  patches = [
+    # this makes the package relocatable - removes hardcoded references to /usr
+    ./paths.patch
+    #  this fixes compilation with QtWebEngine - referencing a commit trying to upstream the change - see https://github.com/dvorka/mindforger/pull/1357
+    (fetchpatch {
+      url = "https://github.com/dvorka/mindforger/commit/d28e2bade0278af1b5249953202810540969026a.diff";
+      sha256 = "sha256-qHKQQNGSc3F9seaOHV0gzBQFFqcTXk91LpKrojjpAUw=";
+    })
+  ];
+
+  postPatch = ''
+    substituteInPlace lib/src/install/installer.cpp --replace /usr "$out"
+    substituteInPlace app/resources/gnome-shell/mindforger.desktop --replace /usr "$out"
+    for f in app/app.pro lib/lib.pro; do
+      substituteInPlace "$f" --replace "QMAKE_CXX = g++" ""
+    done
+  '';
+
+  qmakeFlags = [
+    "-r"
+    "mindforger.pro"
+    "CONFIG+=mfnoccache"
+    "CONFIG+=mfwebengine"
+  ];
+
+  postInstall = lib.optionalString stdenv.isDarwin ''
+    mkdir "$out"/Applications
+    mv app/mindforger.app "$out"/Applications/
+  '';
+
+  meta = with lib; {
+    description = "Thinking Notebook & Markdown IDE";
+    longDescription = ''
+     MindForger is actually more than an editor or IDE - it's human
+     mind inspired personal knowledge management tool
+    '';
+    homepage = "https://www.mindforger.com";
+    license = licenses.gpl2Plus;
+    platforms = platforms.all;
+    maintainers = with maintainers; [ cyplo ];
+    mainProgram = "mindforger";
+  };
+}
diff --git a/nixpkgs/pkgs/applications/editors/mindforger/paths.patch b/nixpkgs/pkgs/applications/editors/mindforger/paths.patch
new file mode 100644
index 000000000000..e9b9244f8dbd
--- /dev/null
+++ b/nixpkgs/pkgs/applications/editors/mindforger/paths.patch
@@ -0,0 +1,42 @@
+diff --git a/app/app.pro b/app/app.pro
+index 29f9d9e..15fd2ff 100644
+--- a/app/app.pro
++++ b/app/app.pro
+@@ -370,7 +370,7 @@ RESOURCES += \
+ # See http://doc.qt.io/qt-5/qmake-advanced-usage.html
+ 
+ binfile.files += mindforger
+-binfile.path = /usr/bin/
++binfile.path = $$PREFIX/bin/
+ INSTALLS += binfile
+ 
+ # ########################################
+diff --git a/mindforger.pro b/mindforger.pro
+index bd4f21d..6bb2dbc 100644
+--- a/mindforger.pro
++++ b/mindforger.pro
+@@ -43,20 +43,20 @@ app.depends = lib
+ #IMPORTANT: binfile MUST be specified in app/app.pro (project next to/that builds binary)
+ 
+ docfiles.files += doc/*
+-docfiles.path = /usr/share/doc/mindforger/
++docfiles.path = $$PREFIX/share/doc/mindforger/
+ INSTALLS += docfiles
+ 
+ manfiles.files += man/*
+-manfiles.path = /usr/share/man/man1/
++manfiles.path = $$PREFIX/share/man/man1/
+ INSTALLS += manfiles
+ 
+ iconfiles.files += app/resources/icons/*
+-iconfiles.path = /usr/share/icons/mindforger/
++iconfiles.path = $$PREFIX/share/icons/mindforger/
+ INSTALLS += iconfiles
+ 
+ # experiment w/ file
+ shortcutfiles.files += app/resources/gnome-shell/mindforger.desktop
+-shortcutfiles.path = /usr/share/applications/
++shortcutfiles.path = $$PREFIX/share/applications/
+ INSTALLS += shortcutfiles
+ 
+ # eof