Installing/packaging emacs-zmq

Hello,

I am trying to install emacs-zmq : GitHub - nnicandro/emacs-zmq: Emacs bindings to ØMQ .

This package is on MELPA and is easy to install, the only problem is that it depends on a custom C library, also available in the GitHub repo. When Emacs tries to lead zmq, the library helpfully suggests downloading a pre-compiled binary of the library or building it from scratch, but then it tries to do it in the Nix store and obviously fails.

Is anyone of you using emacs-zmq? How would you go about packaging/installing a MELPA package with a binary dependency, which can also be built from source?

I am looking at emacs-packages.nix in the nixpkgs repo, but any additional pointers would be very helpful.


Sergiu

P.S. I’ve seen this issue emacs-zmq binary is not installed · Issue #59774 · NixOS/nixpkgs · GitHub , but nobody seems to have answered.

If I just wanted to get this working on my machine, I’d do this:

  1. Write a derivation that builds emacs-zmq.so, and include a setupHook that sets an environment variable to its location.
  2. Add it to my Nixpkgs overlays and install it in my user environment.
  3. Add code to my init.el which runs before zmq.el is loaded and sets zmq-module-file based on the environment variable.

Thank you for your reply.

Ha, writing a separate derivation for building emacs-zmq.so is clever, didn’t think of it!

I ended up doing a fetchurl in my package draft to get the binary of the library and then using postInstall to put it in the output directory of the zmq package, and it seemed to work (zmq detected the binary and successfully ran some basic commands). However, unfortunately, emacs-jupyter kept failing, and this was why I looked at emacs-zmq in the first place. The error emacs-jupyter spit out was really not informative, so I lost my motivation and started looking at other solutions (EIN).


Sergiu

I added a fix in emacs: add zmq package by matthewbauer · Pull Request #64612 · NixOS/nixpkgs · GitHub. basically just adds a special derivation for emacs-zmq.so.

1 Like

Woow, thanks a lot, looks neat! Sorry for the late reaction, I was expecting to get notified by E-mail about answers to this thread.