0

I use Nix on Darwin / Mac OS. The Nix Community provides and Emacs-Overlay that has the latest versions of many packages for Emacs packaged for Nix. When I apply the overlay by putting this into ~/.config/nixpkgs/overlays.nix ...

[
  (import (builtins.fetchTarball { url = "https://github.com/nix-community/emacs-overlay/archive/master.tar.gz"; })) ]; })
]

..., then, I'm able to install Emacs from master-branch with nix-env -i emacs-git. But still, I am not able to install the latest packages for Emacs with nix-env, e.g. Ement.el.

I found out, that I can install the latest version of Ement.el with this command:

nix-shell --expr 'with (import <nixpkgs> { overlays = [ (import (builtins.fetchTarball { url = "https://github.com/nix-community/emacs-overlay/archive/master.tar.gz"; })) ]; }); (emacsPackagesFor emacsGit).elpaPackages.ement'

But I would like to be able to install it conveniently with nix-env.

To achieve this, I tried to put this into my overlays.nix:

[
  (final: prev:
    (prev.lib.composeManyExtensions [
      (import (builtins.fetchTarball { url = "https://github.com/nix-community/emacs-overlay/archive/master.tar.gz"; }))
      (withBoth: withEmacsOverlay: withEmacsOverlay.emacsPackagesFor withEmacsOverlay.emacsGit)
    ] final prev)
  )
]

But it leads to this error:

$ nix-env -iA nixpkgs.elpaPackages.ement
error: infinite recursion encountered

       at /nix/store/lxyj36fz3fbjpzwxf2j852a8dim16vkv-nixpkgs/nixpkgs/pkgs/top-level/emacs-packages.nix:60:11:

           59|   pkgs ? pkgs'
           60|   , lib ? pkgs.lib
             |           ^
           61|   , elpaPackages ? mkElpaPackages { inherit pkgs lib; } self

So. How can I apply the overlay in such a way that I can install the packages for Emacs with nix-env?

Drew
  • 29,895
  • 7
  • 74
  • 104
  • "But still, I am not able to install the latest packages for Emacs with nix-env, e.g. Ement.el." What error or issues are you getting for that? – Chris Stryczynski Apr 13 '23 at 19:52
  • @ChrisStryczynski, when I have an overlays.nix like in the first snippet, and try to install `nix-env -i emacs-ement`, i get `error: selector 'emacs-ement' matches no derivations`. I also tried other selectors, like `emacsPackages.ement` and `elpaPackages.ement`. As far as I understand, the emacs-overlay does not provide any packages for Emacs, but only a function `emacsPackagesFor` (that takes an Emacs package as argument and returns a set of packages): https://github.com/nix-community/emacs-overlay/blob/fbe8bd5e0226b57911c1f30dc26e3bec57c2e1a4/overlays/package.nix#L28 – yheilanop Apr 13 '23 at 21:46
  • Try `emacs-git.pkgs.ement` – Henri Menke Apr 14 '23 at 20:56
  • @HenriMenke, the selector 'emacs-git.pkgs.ement' matches no derivations. also, `nix-env -iA nixpkgs.emacsGit.pkgs.ement` tries to install the old version of ement.el which is packaged in official nixpkgs, but not the latest version of it that is packaged in the emacs-overlay. – yheilanop Apr 20 '23 at 14:03

0 Answers0