Skip to content

Conversation

@dasj19
Copy link
Contributor

@dasj19 dasj19 commented Jun 25, 2020

Motivation for this change

Building evolution-ews from source. Thanks to @jtojnar for helping me along the way.

Things done

I got evolution-ews to compile in nix.
The next steps will be to make a wrapper for evolution (evolution-with-plugins) to make use of this library.

  • 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.

@ofborg ofborg bot added the 6.topic: GNOME GNOME desktop environment and its underlying platform label Jun 25, 2020
@bjornfor
Copy link
Contributor

Related: #12847 and #67281.

Semi off-topic: have you tried using Geary instead?

@aanderse
Copy link
Member

I may recall incorrectly but I think at one point this may have been on radar for @jtojnar or @worldofpeace after some other gnome work.

@hbjydev
Copy link
Contributor

hbjydev commented Jul 1, 2020

@bjornfor Geary has no Exchange Server support. Only IMAP.

Copy link
Member

@jtojnar jtojnar left a comment

Choose a reason for hiding this comment

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

Could you rebase (git rebase -i master, git push -f) the branch so that there is only the relevant commit and no useless merges?

@jtojnar
Copy link
Member

jtojnar commented Jul 1, 2020

The main issue is that evolution only looks for plug-ins in its directory tree, so we need to create evolution-with-plugins expression as described in #12847 (comment) or https://discourse.nixos.org/t/writing-derivation-for-a-plugin-to-evolution-data-server/2719

@dasj19
Copy link
Contributor Author

dasj19 commented Jul 3, 2020

I hit a roadblock:

CMake Error at src/addressbook/cmake_install.cmake:55 (file):
  file INSTALL cannot copy file
  "/build/evolution-ews-3.36.3/build/src/addressbook/libebookbackendews.so"
  to
  "/nix/store/0khik6f3gpz4gkvpjipy1g1hq7qbkknf-evolution-data-server-3.36.3/lib/evolution-data-server/addressbook-backends/libebookbackendews.so":
  Permission denied.
Call Stack (most recent call first):
  src/cmake_install.cmake:42 (include)
  cmake_install.cmake:55 (include)


make: *** [Makefile:82: install] Error 1

@jtojnar
Copy link
Member

jtojnar commented Jul 3, 2020

The paths come from here:

https://gitlab.gnome.org/GNOME/evolution-ews/-/blob/ad2d6373b8b6c3b83790ceb454256b6547256455/CMakeLists.txt#L206-213

You can override them using PKG_CONFIG_$PACKAGE_$VARIABLE environment variable, where $PACKAGE and $VARIABLE are uppercased names with non-alphanumeric characters replaced by underscores, for example PKG_CONFIG_CAMEL_1_2_CAMEL_PROVIDERDIR (see pkg-config (1)).

@jtojnar
Copy link
Member

jtojnar commented Jul 3, 2020

To be more precise, you can run something like nix-shell -A evolution-ews --run "pkg-config camel-1.2 --variable camel_providerdir", which will spit out something like /nix/store/7yds4g5hb0ig7zqg4nkc03ng07vhbn6a-evolution-data-server-3.36.3/lib/evolution-data-server/camel-providers so you will put PKG_CONFIG_CAMEL_1_2_CAMEL_PROVIDERDIR = "${placeholder "out"}/lib/evolution-data-server/camel-providers"; to the expression.

@dasj19
Copy link
Contributor Author

dasj19 commented Jul 3, 2020

Thanks a lot @jtojnar
I did as you asked and added the following to the .nix expression

PKG_CONFIG_EVOLUTION_SHELL_3_0_ERRORDIR = "${placeholder "out"}/share/evolution/errors";
  PKG_CONFIG_EVOLUTION_SHELL_3_0_PRIVLIBDIR = "${placeholder "out"}/lib/evolution";
  PKG_CONFIG_CAMEL_1_2_CAMEL_PROVIDERDIR = "${placeholder "out"}/lib/evolution-data-server/camel-providers";
  PKG_CONFIG_LIBEDATABOOK_1_2_BACKENDDIR = "${placeholder "out"}/lib/evolution-data-server/addressbook-backends";
  PKG_CONFIG_LIBEDATACAL_2_0_BACKENDDIR = "${placeholder "out"}/lib/evolution-data-server/calendar-backends";
  PKG_CONFIG_LIBEBACKEND_1_2_MODULEDIR = "${placeholder "out"}/lib/evolution-data-server/registry-modules";
  PKG_CONFIG_EVOLUTION_SHELL_3_0_MODULEDIR = "${placeholder "out"}/lib/evolution/modules";
  PKG_CONFIG_EVOLUTION_DATA_SERVER_1_2_PRIVDATADIR = "${placeholder "out"}/share/evolution-data-server";

The thing is it does not help on that error at all. Maybe because there is an earlier error which says:

-   Found camel-1.2, version 3.36.3
Package libpcre was not found in the pkg-config search path.
Perhaps you should add the directory containing `libpcre.pc'
to the PKG_CONFIG_PATH environment variable
Package 'libpcre', required by 'glib-2.0', not found

Sorry to bother that much but I don't have much clues nor experience to go further from here...

@dasj19
Copy link
Contributor Author

dasj19 commented Jul 3, 2020

There is some sparse documentation here as well: https://wiki.gnome.org/Apps/Evolution/Building#Build_evolution-ews

@jtojnar
Copy link
Member

jtojnar commented Jul 3, 2020

The pcre thing should just be a warning. If it still fails, the error is probably elsewhere.

@jtojnar
Copy link
Member

jtojnar commented Jul 4, 2020

Looks like you missed some underscores:

--- a/pkgs/applications/networking/mailreaders/evolution-ews/default.nix
+++ b/pkgs/applications/networking/mailreaders/evolution-ews/default.nix
@@ -13,8 +13,8 @@ stdenv.mkDerivation rec {
   PKG_CONFIG_EVOLUTION_SHELL_3_0_ERRORDIR = "${placeholder "out"}/share/evolution/errors";
   PKG_CONFIG_EVOLUTION_SHELL_3_0_PRIVLIBDIR = "${placeholder "out"}/lib/evolution";
   PKG_CONFIG_CAMEL_1_2_CAMEL_PROVIDERDIR = "${placeholder "out"}/lib/evolution-data-server/camel-providers";
-  PKG_CONFIG_LIBEDATABOOK_1_2_BACKENDDIR = "${placeholder "out"}/lib/evolution-data-server/addressbook-backends";
-  PKG_CONFIG_LIBEDATACAL_2_0_BACKENDDIR = "${placeholder "out"}/lib/evolution-data-server/calendar-backends";
+  PKG_CONFIG_LIBEDATA_BOOK_1_2_BACKENDDIR = "${placeholder "out"}/lib/evolution-data-server/addressbook-backends";
+  PKG_CONFIG_LIBEDATA_CAL_2_0_BACKENDDIR = "${placeholder "out"}/lib/evolution-data-server/calendar-backends";
   PKG_CONFIG_LIBEBACKEND_1_2_MODULEDIR = "${placeholder "out"}/lib/evolution-data-server/registry-modules";
   PKG_CONFIG_EVOLUTION_SHELL_3_0_MODULEDIR = "${placeholder "out"}/lib/evolution/modules";
   PKG_CONFIG_EVOLUTION_DATA_SERVER_1_2_PRIVDATADIR = "${placeholder "out"}/share/evolution-data-server";

@dasj19
Copy link
Contributor Author

dasj19 commented Jul 4, 2020

Looks like you missed some underscores:

Nice found. Now it compiles, and I need to look into letting evolution read from the install path of evolution-ews.

@jtojnar
Copy link
Member

jtojnar commented Jul 4, 2020

Also you should add yourself to maintainers/maintainer-list.nix such that there are two commits:

  • maintainers: add dasj19
  • evolution-ews: init at 3.36.4

This should fix the CI error.

@ofborg ofborg bot added 8.has: package (new) This PR adds a new package 10.rebuild-darwin: 0 This PR does not cause any packages to rebuild on Darwin. 10.rebuild-linux: 1-10 This PR causes between 1 and 10 packages to rebuild on Linux. 10.rebuild-linux: 1 This PR causes 1 package to rebuild on Linux. and removed 6.topic: GNOME GNOME desktop environment and its underlying platform labels Jul 5, 2020
@dasj19 dasj19 force-pushed the evolution-ews branch 2 times, most recently from 0d03384 to 87dcab6 Compare July 6, 2020 15:24
@ofborg ofborg bot added the 11.by: package-maintainer This PR was created by a maintainer of all the package it changes. label Jul 6, 2020
@jtojnar jtojnar merged commit c57c936 into NixOS:master Jul 8, 2020
@jtojnar
Copy link
Member

jtojnar commented Jul 8, 2020

Thank you.

@aanderse
Copy link
Member

aanderse commented Jul 8, 2020

Great news! If I'm on a plasma desktop running what steps do I take to try this out? Thank you all for your hard work! 🎉

@jtojnar
Copy link
Member

jtojnar commented Jul 8, 2020

We still need to patch evolution to allow loading plug-ins. Maybe joining the two derivations into a single one by recursive copying and fixing all the paths would be easiest for now.

@aanderse
Copy link
Member

aanderse commented Jul 8, 2020

Great. Anything which allows me to stop using web mail 😄

@dasj19
Copy link
Contributor Author

dasj19 commented Jul 9, 2020

I have tried to make a wrapper this morning and just making symlinks to the .so files in the /lib folder is not enough. Some other magic is needed. I'll continue reading through nix pills & the manual to get some more knowledge. I have to admit... there are not that many "with-plugins" packages one can get some inspiration from.

@dasj19
Copy link
Contributor Author

dasj19 commented Jul 9, 2020

I started up the work at #92775

@jtojnar
Copy link
Member

jtojnar commented Jul 9, 2020

Yeah, programs typically have hardcoded path to their libdir in the code so you would need to install the plug-ins to that path. That is not possible since store paths are immutable. One way to achieve that is to patch the source code to accept some writeable path like /run/current-system/sw/lib/evolution-data-server, or an environment variable that can be passed at runtime. (Example patches: ofono, nautilus, dleyna-core, gsignond; example postprocessing: thunar, gsignond, zathura). But that might be too much work since there are like ten different plug-in directories, so maybe approach I mentioned above will be easier.

Actually, this is further complicated by the fact that they need to be installed to e-d-s tree, not evolution.

@dasj19
Copy link
Contributor Author

dasj19 commented Jul 9, 2020

Thanks for examples @jtojnar ... have you submitted any of those patches upstream? They seem to be nice features.

@jtojnar
Copy link
Member

jtojnar commented Jul 9, 2020

Some of them, yes. With mixed results. dleyna-core is inactive, GDM succeeded, with generic variable in the end. I also recall discussing xdg-dektop-portal and evolution with their respective authors (probably on IRC as I cannot find it) and I did not manage to convince them. Not sure I would even convince myself – environment variables are terrible mechanism. But unfortunately we do not have much options.

@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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

8.has: package (new) This PR adds a new package 10.rebuild-darwin: 0 This PR does not cause any packages to rebuild on Darwin. 10.rebuild-linux: 1-10 This PR causes between 1 and 10 packages to rebuild on Linux. 10.rebuild-linux: 1 This PR causes 1 package to rebuild on Linux. 11.by: package-maintainer This PR was created by a maintainer of all the package it changes.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants