Use nix-community Cachix cache for emacs-overlay

Hello,
I’m using the emacs-overlay since months but every time I run sudo nixos-rebuild switch Emacs get compiled from scratch, so now I would like to try out the nix-community binary cache and save time.
Consider that I’m using Nixos 20.09 (channel nixos-20.09) and I installed Cachix declaratively putting in my configuration.nix's imports the cachix.nix file that cachix generates when I launch cachix use nix-community, however I think that this part is ok because I don’t have errors and in my log I can read things like

copying path '[...]' from 'https://nix-community.cachix.org'...

The emacs-overlay is installed putting this in my configuration.nix:

nixpkgs.overlays = with sources; [
  (import emacs-overlay)
];

where

sources = {
  emacs-overlay = "${builtins.fetchTarball https://github.com/nix-community/emacs-overlay/archive/master.tar.gz}";
}

Then if I put e.g. emacsGit in my environment.systemPackages when I run sudo nixos-rebuild switch I get

[...]
  /nix/store/pnm2s6q1wv51cfmcasr5iykbk63qff4s-source
copying path '/nix/store/pnm2s6q1wv51cfmcasr5iykbk63qff4s-source' from 'https://nix-community.cachix.org'...
building '/nix/store/0341rymrv7fbfk2dz8msyhh5jjr2yz7m-emacs-git-20210227.0.drv'...
unpacking sources
unpacking source archive /nix/store/pnm2s6q1wv51cfmcasr5iykbk63qff4s-source
[...]

and then the build starts. I think that only the Emacs source code derivation is downloaded from the cache.

Note that I simplified my configuration, actually I’m installing Emacs as service (specifying the package I want to use) and using a custom emacsWithPackagesFromUsePackage that uses emacsPgtkGcc. However I tried excluding what I don’t think is the cause of the problem for simplicity, I still can’t get Emacs from the cache, even with the simplification used here.

If you want you can find my complete configuration here.

Thanks all.

Are you installing from the nixos-unstable channel?

No, should I?
Actually I’m on nixos-20.09.

I’m having the same problem. I’m using home-manager with WSL2 Ubuntu. I’ve set up cachix with cachix use nix-community, and I believe I’ve seen it work with other packages. But every time I run home-manager switch, it wants to rebuild emacs.

The upstream issue seems fixed now.

Just a note:
Today I tried to use emacs-overlay to get native comp
To NixOS 21.05 by flake

Added “nix-community” to cachix, but emacsGcc missed the cache

Then tried to use emacsPgtkGcc and it was fully fetched from the cache

2 Likes