Writing derivation for a plugin to evolution-data-server

Hi !

I鈥檓 trying to write a derivation for DecSync - it鈥檚 a plugin to evolution-data-server which enables a calendar/contacts/etc sync.

I managed to get all the dependencies resolved and the project builds - but I have some trouble figuring out how to install it - would appreciate any input here :slight_smile:

Here鈥檚 my current almost-working derivation:

with import <nixpkgs> {};

stdenv.mkDerivation rec {
    name = "evolution-decsync";
    version = "1.0.1";
    src = fetchFromGitHub {
        owner = "39aldo39";
        repo = "Evolution-DecSync";
        rev = "v1.0.1";
        sha256 = "0cq5cvc9ywcbwrhj5nm9azjmjwc8hxfbw3r7bjqkjd0bwfnxk3g6";
        fetchSubmodules = true;
    };

    buildInputs = [ libgee json-glib gnome3.evolution-data-server gnome3.evolution gtk3 webkitgtk glib libsecret libsoup];
    nativeBuildInputs = [ meson ninja vala pkg-config ];
    configurePhase = "meson build --prefix=$out";
    buildPhase = "ninja -C build";
    installPhase = "ninja -C build install";
}

Running build fails on install:

$ nix-build default.nix
[..]
PermissionError: [Errno 13] Permission denied: '/nix/store/fl6wrf5h4awkprk7ibbvkfan51fp77rd-evolution-data-server-3.30.5/lib/evolution-data-server/addressbook-backends/libebookbackenddecsync.so'
Installing src/backends/addressbook/libebookbackenddecsync.so to /nix/store/fl6wrf5h4awkprk7ibbvkfan51fp77rd-evolution-data-server-3.30.5/lib/evolution-data-server/addressbook-backends
FAILED: meson-install
/nix/store/0mz0dr57n65fdrzlxjm8sjl7acjf9kzh-meson-0.49.1/bin/meson install --no-rebuild
ninja: build stopped: subcommand failed.
builder for '/nix/store/4cnrb00cil678axn323szd2nzik6gk3k-evolution-decsync.drv' failed with exit code 1
error: build of '/nix/store/4cnrb00cil678axn323szd2nzik6gk3k-evolution-decsync.drv' failed

My understanding is that DecSync installer tries to detect already existing installation of evolution-data-server and put the compiled libraries there and this results in permission denied error.

What would be the NixOS way do approaching this ? Changing the derivation for evolution-data-server to know about this optional plugin ? If so - could you give me a hint on how to do that ? If not - what would be the best course of action here ?

Thanks so much !

You might want to take a look at evolution-ews missing, needed for exchange support 路 Issue #12847 路 NixOS/nixpkgs 路 GitHub, which is for the evolutions-ews plugin. @bjornfor and I hacked around on it a couple years back, but never got to the point of anything that worked. :-/

It probably gets the installation location from e-d-s始s pkg-config file. You can override the path using environment variable (see man pkg-config).

Small correction: GitHub - bjornfor/nixpkgs at evolution-ews3 did work in the end. It built evolution-data-server and ews in one derivation. Ugly, but it worked. (But yeah, it didn鈥檛 work as in didn鈥檛 become integrated into nixpkgs.)

Installing the plugin to a separate directory is possible, but there is currently no way to tell e-d-s where to find external plugins. We must patch e-d-s for that: Re: [Evolution] Making EDS find external EWS plugin

Interesting ! Thanks so much everyone that chimed in :slight_smile: Having eds look for plugin someplace else seems like a thing I could try - not sure when I鈥檒l have a bit of time to do that but will ping you here when done :slight_smile: