For a while now I’ve been wanting to use the latest and greatest Emacs packages tracking Melpa as closely as possible.
This has been hard while using Nix to maintain my Emacs configurations since Nixpkgs is often lagging behind (for good reason).
After about a month of getting the required changes into Nixpkgs I’m announcing the semi-official Emacs overlay!
This is based on work by a number of people, notably https://github.com/ttuegel/ who created emacs2nix and https://github.com/bendlas who wrote the new emacs-lisp based Melpa updater and https://github.com/etu who worked together on the initial overlay that resulted in this.
It’s currently updated multiple times daily from all supported package repositories, see the README for more detailed information.
A side-announcement is that we now have a dedicated irc-channel on freenode called #nixos-emacs
This is great! I ran into an issue just the other day that elpy was not the latest version so I could not auto format my code with black. Look forward to trying this out
This is awesome!
Are you planning to provide a Cachix cache?
Yes that is coming soon, probably later this week.
Thank you for putting together this overlay! I’ve long felt that the Emacs packages should live in a dedicated overlay, rather than the main Nixpkgs tree.
I have some general questions about how this relates to the packages still in Nixpkgs. How does the Emacs overlay handle overrides for packages with non-Emacs dependencies? For example, in the Nixpkgs tree we have several overrides for packages that otherwise would be broken on NixOS. I also wanted to know how the package sets are composed; when a package has dependencies that are in multiple package sets, how is the version resolved?
Thanks again for all your hard work!
I have some general questions about how this relates to the packages still in Nixpkgs. How does the Emacs overlay handle overrides for packages with non-Emacs dependencies?
The overlay overrides the composition before overrides are applied.
For Melpa that means overriding the generated JSON file https://github.com/NixOS/nixpkgs/blob/2466a5bd88f7a41c05b685cc3a26ef109e68c4e6/pkgs/applications/editors/emacs-modes/melpa-packages.nix#L30, for others like Elpa we override what generated Nix code is loaded: https://github.com/NixOS/nixpkgs/blob/2466a5bd88f7a41c05b685cc3a26ef109e68c4e6/pkgs/applications/editors/emacs-modes/elpa-packages.nix#L29.
That means any override in Nixpkgs works exactly the same as before, even when the underlying package is provided by the overlay.
In fact, I would reject any PR with overrides to the overlay itself, everything like that should go in Nixpkgs.