From e44b3c518793fcd742ed432dcfe1a700c4825716 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20=C8=98erb=C4=83nescu?= Date: Tue, 1 Sep 2020 19:35:34 +0200 Subject: [PATCH] evolution-with-plugins: added support for evolution-ews. --- .../desktops/gnome3/evolution-data-server.nix | 13 +++--- .../evolution/evolution-ews/default.nix | 4 +- .../evolution}/evolution/default.nix | 10 +++-- .../evolution/moduledir_from_env.patch | 21 ++++++++++ .../evolution/evolution/wrapper.nix | 41 +++++++++++++++++++ pkgs/desktops/gnome-3/default.nix | 2 - pkgs/top-level/all-packages.nix | 2 + 7 files changed, 78 insertions(+), 15 deletions(-) rename pkgs/{desktops/gnome-3/apps => applications/networking/mailreaders/evolution}/evolution/default.nix (95%) create mode 100644 pkgs/applications/networking/mailreaders/evolution/evolution/moduledir_from_env.patch create mode 100644 pkgs/applications/networking/mailreaders/evolution/evolution/wrapper.nix diff --git a/nixos/modules/services/desktops/gnome3/evolution-data-server.nix b/nixos/modules/services/desktops/gnome3/evolution-data-server.nix index bd62d16f61ce..b8ad7a343c9f 100644 --- a/nixos/modules/services/desktops/gnome3/evolution-data-server.nix +++ b/nixos/modules/services/desktops/gnome3/evolution-data-server.nix @@ -32,14 +32,13 @@ with lib; ###### implementation - config = mkIf config.services.gnome3.evolution-data-server.enable { + config = + let evolution-with-plugins = (import ../../../../.. {}).evolution-with-plugins; in + mkIf config.services.gnome3.evolution-data-server.enable { + environment.systemPackages = [ evolution-with-plugins ]; - environment.systemPackages = [ pkgs.gnome3.evolution-data-server ]; - - services.dbus.packages = [ pkgs.gnome3.evolution-data-server ]; - - systemd.packages = [ pkgs.gnome3.evolution-data-server ]; + services.dbus.packages = [ evolution-with-plugins ]; + systemd.packages = [ evolution-with-plugins ]; }; - } diff --git a/pkgs/applications/networking/mailreaders/evolution/evolution-ews/default.nix b/pkgs/applications/networking/mailreaders/evolution/evolution-ews/default.nix index fbd6d1d924cd..8deb7e84a2c6 100644 --- a/pkgs/applications/networking/mailreaders/evolution/evolution-ews/default.nix +++ b/pkgs/applications/networking/mailreaders/evolution/evolution-ews/default.nix @@ -1,4 +1,4 @@ -{ lib, stdenv, fetchurl, gnome3, cmake, gettext, intltool, pkg-config, evolution-data-server +{ lib, stdenv, fetchurl, gnome3, cmake, gettext, intltool, pkg-config, evolution-data-server, evolution , sqlite, gtk3, webkitgtk, libgdata, libmspack }: stdenv.mkDerivation rec { @@ -13,7 +13,7 @@ stdenv.mkDerivation rec { nativeBuildInputs = [ cmake gettext intltool pkg-config ]; buildInputs = [ - evolution-data-server gnome3.evolution + evolution-data-server evolution sqlite libgdata gtk3 webkitgtk libmspack diff --git a/pkgs/desktops/gnome-3/apps/evolution/default.nix b/pkgs/applications/networking/mailreaders/evolution/evolution/default.nix similarity index 95% rename from pkgs/desktops/gnome-3/apps/evolution/default.nix rename to pkgs/applications/networking/mailreaders/evolution/evolution/default.nix index 4bede93ebb70..c9fdbf3a9133 100644 --- a/pkgs/desktops/gnome-3/apps/evolution/default.nix +++ b/pkgs/applications/networking/mailreaders/evolution/evolution/default.nix @@ -12,8 +12,6 @@ , libnotify , gspell , evolution-data-server -, adwaita-icon-theme -, gnome-desktop , libgdata , libgweather , glib-networking @@ -61,7 +59,7 @@ stdenv.mkDerivation rec { ]; buildInputs = [ - adwaita-icon-theme + gnome3.adwaita-icon-theme bogofilter db evolution-data-server @@ -69,7 +67,7 @@ stdenv.mkDerivation rec { gdk-pixbuf glib glib-networking - gnome-desktop + gnome3.gnome-desktop gsettings-desktop-schemas gst_all_1.gst-plugins-base gst_all_1.gstreamer @@ -115,6 +113,10 @@ stdenv.mkDerivation rec { doCheck = true; + patches = [ + ./moduledir_from_env.patch + ]; + passthru = { updateScript = gnome3.updateScript { packageName = "evolution"; 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 000000000000..2a5edfb9a5a1 --- /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 new file mode 100644 index 000000000000..4f5278fce97f --- /dev/null +++ b/pkgs/applications/networking/mailreaders/evolution/evolution/wrapper.nix @@ -0,0 +1,41 @@ +{ lib, makeWrapper, symlinkJoin, evolution, evolution-ews, gnome3 }: + +symlinkJoin { + name = "evolution-with-plugins"; + paths = [ evolution evolution-ews gnome3.evolution-data-server]; + + buildInputs = [ makeWrapper ]; + + postBuild = '' + for i in $out/bin/* $out/libexec/**; do + if [ ! -d $i ]; then + echo wrapping $i + wrapProgram $i \ + --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" + fi + done + + fixSymlink () { + local link=$1 + local target=$(readlink $link); + local newtarget=$(sed "s@/nix/store/[^/]*/@$out/@" <<< "$target") + if [[ $target != $newtarget ]] && [[ -d $newtarget ]]; then + echo fixing link to point to $newtarget instead of $target + rm $link + ln -s $newtarget $link + fi + } + + fixSymlink $out/share/dbus-1/service + fixSymlink $out/lib/systemd/user + for i in $out/share/dbus-1/services/*.service $out/lib/systemd/user/*.service; do + echo fixing service file $i + sed -i "s@/nix/store/[^/]*/@$out/@" $i + done + ''; +} diff --git a/pkgs/desktops/gnome-3/default.nix b/pkgs/desktops/gnome-3/default.nix index 2bc825d81490..c4e203913bea 100644 --- a/pkgs/desktops/gnome-3/default.nix +++ b/pkgs/desktops/gnome-3/default.nix @@ -158,8 +158,6 @@ lib.makeScope pkgs.newScope (self: with self; { cheese = callPackage ./apps/cheese { }; - evolution = callPackage ./apps/evolution { }; - file-roller = callPackage ./apps/file-roller { }; gedit = callPackage ./apps/gedit { }; diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 313cfa208d7a..f130c92f3b94 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -21822,6 +21822,8 @@ in inherit (gnome3) evince; evolution-data-server = gnome3.evolution-data-server; evolution-ews = callPackage ../applications/networking/mailreaders/evolution/evolution-ews { }; + evolution = callPackage ../applications/networking/mailreaders/evolution/evolution { }; + evolution-with-plugins = callPackage ../applications/networking/mailreaders/evolution/evolution/wrapper.nix { }; keepass = callPackage ../applications/misc/keepass { };