Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP: Evolution with plugins #92775

Closed
wants to merge 1 commit into from
Closed

Conversation

dasj19
Copy link
Contributor

@dasj19 dasj19 commented Jul 9, 2020

Motivation for this change

WIP wrapper for evolution to incorporate plugins like evolution-ews.

Things done
  • Tested using sandboxing (nix.useSandbox on NixOS, or option sandbox in nix.conf on non-NixOS linux)
  • Built on platform(s)
    • NixOS
    • macOS
    • other Linux distributions
  • Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Determined the impact on package closure size (by running nix path-info -S before and after)
  • Ensured that relevant documentation is up to date
  • Fits CONTRIBUTING.md.

@dasj19 dasj19 mentioned this pull request Jul 9, 2020
10 tasks
@ofborg ofborg bot added 6.topic: GNOME GNOME desktop environment and its underlying platform 2.status: merge conflict labels Jul 9, 2020

postBuild = ''
wrapProgram $out/bin/evolution \
--set LD_LIBRARY_PATH "$out/lib"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, cool trick. That circumvents the nested patching issue. But we will need to make sure there are no side effects to child processes.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also this still does not deal with the fact that the desktop file points to the unwrapped evolution in pkgs.evolution.

@@ -156,8 +156,6 @@ lib.makeScope pkgs.newScope (self: with self; {

cheese = callPackage ./apps/cheese { };

evolution = callPackage ./apps/evolution { };
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You should also delete the old file.

And add alias to the bottom of this one.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That file was moved to pkgs/applications/networking/mailreaders/evolution/evolution/default.nix .

It does not show on my system anymore.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

];

buildInputs = [
adwaita-icon-theme
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You will need to use these as gnome3.adwaita-icon-theme, otherwise overriding the canonical location of adwaita in overlays will not have an effect on evolution.

@nixos-discourse
Copy link

This pull request has been mentioned on NixOS Discourse. There might be relevant details there:

https://discourse.nixos.org/t/running-evolution-without-gnome-is-it-sane-possible/8328/2

@symphorien
Copy link
Member

I tried running evolution-with-plugins but it does not seem to load the plugin at all. I don't see the option to add an EWS server.

@dasj19
Copy link
Contributor Author

dasj19 commented Aug 4, 2020

@symphorien I was struggling to get evolution to "see" the evolution-ews plugin as well, unfortunately without much luck

@jtojnar
Copy link
Contributor

jtojnar commented Aug 4, 2020

To recapitulate, evolution-data-server looks for plug-ins in path that is hardcoded in its code so we either need to change the strings to a predefined value like /run/current-system/sw/lib/evolution-data-server or change it to a new store path where we install the plug-ins.

The former has an advantage that it can be done in advance during the initial build and there is no need to rebuild programs that depend on e-d-s (e.g. geary or gnome-shell) but it also requires a global location to install plug-ins.

The latter will allow us to have self-contained evolution-with-plugins but we will need to rebuild/replace all things that depend on evolution-data-server with a new derivation that combines e-d-s tree and plug-in trees and replaces all references to the original trees with the new $out. (We cannot just place it in different derivation since that would introduce a dependency cycle.)

And we cannot forget that evolution-ews installs to extension points for evolution in addition to e-d-s, so we would need to repeat these steps there too.

So I think the easiest way forward would be patching e-d-s and evolution to use /run/current-system/sw or some environment variable in addition to original paths as suggested in the ML but it will be tedious with so many supported extension points.

@symphorien
Copy link
Member

I can get the plugin to load this way:

diff --git a/pkgs/applications/networking/mailreaders/evolution/evolution-ews/default.nix b/pkgs/applications/networking/mailreaders/evolution/evolution-ews/default.nix
index ebad920d895..e4d5bbda2ef 100644
--- a/pkgs/applications/networking/mailreaders/evolution/evolution-ews/default.nix
+++ b/pkgs/applications/networking/mailreaders/evolution/evolution-ews/default.nix
@@ -3,11 +3,11 @@
 
 stdenv.mkDerivation rec {
   pname = "evolution-ews";
-  version = "3.36.5";
+  version = "3.36.4";
 
   src = fetchurl {
     url = "mirror://gnome/sources/${pname}/${stdenv.lib.versions.majorMinor version}/${pname}-${version}.tar.xz";
-    sha256 = "0h1wz4hxsasihdvvsaxnmzka4afjw7603gn0qcw8rxpw114ib1bl";
+    sha256 = "0zfq02h3r1qbxak04i49564q4s2ykvkgcyc3krjgndan9lq3kvvn";
   };
 
   nativeBuildInputs = [ cmake gettext intltool pkg-config ];
diff --git a/pkgs/applications/networking/mailreaders/evolution/evolution/default.nix b/pkgs/applications/networking/mailreaders/evolution/evolution/default.nix
index 819ab97ec34..d2d420fa78a 100644
--- a/pkgs/applications/networking/mailreaders/evolution/evolution/default.nix
+++ b/pkgs/applications/networking/mailreaders/evolution/evolution/default.nix
@@ -48,6 +48,10 @@ stdenv.mkDerivation rec {
     sha256 = "0vgd3i5zrs4r0i0700hhl89c66j41bgdzg9j8wdf0w8irlqj5xv2";
   };
 
+  patches = [
+    ./moduledir_from_env.patch
+  ];
+
   nativeBuildInputs = [
     cmake
     intltool
diff --git a/pkgs/applications/networking/mailreaders/evolution/evolution/moduledir_from_env.patch b/pkgs/applications/networking/mailreaders/evolution/evolution/moduledir_from_env.patch
new file mode 100644
index 00000000000..36b3bbacc1c
--- /dev/null
+++ b/pkgs/applications/networking/mailreaders/evolution/evolution/moduledir_from_env.patch
@@ -0,0 +1,21 @@
+diff --git a/src/shell/main.c b/src/shell/main.c
+index 5d089225ca..030908d684 100644
+--- a/src/shell/main.c
++++ b/src/shell/main.c
+@@ -407,7 +407,15 @@ create_default_shell (void)
+ 	}
+ 
+ 	/* Load all shared library modules. */
+-	module_types = e_module_load_all_in_directory (EVOLUTION_MODULEDIR);
++	const gchar *modules_directory = EVOLUTION_MODULEDIR;
++	const gchar *modules_directory_env;
++
++	modules_directory_env = g_getenv ("EVOLUTION_MODULEDIR");
++	if (modules_directory_env &&
++	    g_file_test (modules_directory_env, G_FILE_TEST_IS_DIR))
++		modules_directory = g_strdup (modules_directory_env);
++
++	module_types = e_module_load_all_in_directory (modules_directory);
+ 	g_list_free_full (module_types, (GDestroyNotify) g_type_module_unuse);
+ 
+ 	flags = G_APPLICATION_HANDLES_OPEN |
diff --git a/pkgs/applications/networking/mailreaders/evolution/evolution/wrapper.nix b/pkgs/applications/networking/mailreaders/evolution/evolution/wrapper.nix
index 1a0fdab7092..091f7b6ae2a 100644
--- a/pkgs/applications/networking/mailreaders/evolution/evolution/wrapper.nix
+++ b/pkgs/applications/networking/mailreaders/evolution/evolution/wrapper.nix
@@ -8,7 +8,12 @@ symlinkJoin {
 
   postBuild = ''
     wrapProgram $out/bin/evolution \
-      --set LD_LIBRARY_PATH "$out/lib"
+      --set LD_LIBRARY_PATH "$out/lib" \
+      --set EDS_ADDRESS_BOOK_MODULES "$out/lib/evolution-data-server/addressbook-backends/" \
+      --set EDS_CALENDAR_MODULES "$out/lib/evolution-data-server/calendar-backends/" \
+      --set EDS_CAMEL_PROVIDER_DIR "$out/lib/evolution-data-server/camel-providers/" \
+      --set EDS_REGISTRY_MODULES "$out/lib/evolution-data-server/registry-modules/" \
+      --set EVOLUTION_MODULEDIR "$out/lib/evolution/modules"
 
     LIBRARIES=$(ls -d ${lib.makeLibraryPath [evolution-ews]}/*)
     for library in $LIBRARIES; do

But I currently have no access to an ews account to test beyond "the option to add an ews account is offered to me"

@dasj19
Copy link
Contributor Author

dasj19 commented Aug 29, 2020

@symphorien thanks, that is huge progress, I am building with your changes right now... and I have an exchange email address to test.
I'll be back after testing.

@dasj19
Copy link
Contributor Author

dasj19 commented Aug 30, 2020

@symphorien I tested and I am unable to add an exchange account.
The "Exchange Webservices" option does appear in the "Receiving email" dialog, but when I finish adding all the required information and save nothing happens, after pressing the final "Done" button the app displays the same as before trying to add an exchange email. Namely no email account is added to the list of accounts.

The terminal does not reveal anything disturbing either...

@symphorien
Copy link
Member

maybe retry with G_MESSAGES_DEBUG=all ?

@dasj19
Copy link
Contributor Author

dasj19 commented Aug 30, 2020

Thanks for the advice. I have applied that flag but I still can't see anything out of the ordinary. You can take a look here: https://pastebin.com/8DVFcK82

@symphorien
Copy link
Member

Looking at the environment of the various evolution-* processes it seems that they don't have the environment variable. Are they started by dbus ?

@symphorien
Copy link
Member

So I got it to work by also changing the module as well 92eda380bb3a61fe66ffd924ba84b708849c0fad . It's very hacky, I think the API of the module must be changed.

But you have to be very careful to not have anything depending on an old version of evolution-data-server in the system (I had installed gnome-calendar with home-manager) otherwise for a reason I cannot fathom, dbus starts the old (unwrapped) version of the evolution-data-server helpers.

So if it does not work for you, check with htop and lsof that the right helpers are launched.

@dasj19 dasj19 force-pushed the evolution-with-plugins branch 2 times, most recently from 84ddfd0 to cfb247a Compare September 1, 2020 16:51
@dasj19
Copy link
Contributor Author

dasj19 commented Sep 1, 2020

Thanks a lot @symphorien ... I have tried with version 3.36.4 and 3.36.5 for evolution, evolution-data-server and evolution-ews and initially I could not get it working but apparently it needed a reboot.

So I pushed your changes in my branch and rebased to master. We finally have a working prototype for evolution-with-plugins.
We may be needing some more tests and code grooming.

@ryantm ryantm marked this pull request as draft October 23, 2020 02:59
@symphorien
Copy link
Member

I reworked the evolution data server module to install evolution plugins in 09f09facbd0

@symphorien
Copy link
Member

I reopened this properly as #103135

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants