A Nix overlay for Emacs 27 with the 'emacs-mac' patches

By Calum MacRae

August 12, 2020

UPDATE

The official emacs-macport package has been updated on the nixpkgs master branch, so should hit the nixpkgs-unstable channel soon!

With the recent release of Emacs 27.1, I figured I'd share a Nix overlay I'm using to build it with the 'emacs-mac' patches.

Emacs 27 comes with some great performance improvements. Including native JSON support, which makes for a really slick experience with lsp-mode. On top of that, it's really nice having Mitsuharu Yamamoto's patches to enhance the experience further on macOS, as things just play a lot nicer.

Emacs = (super.emacsMacport.overrideAttrs (o: rec {
  version = "27.1";
  macportVersion = "8.0";
  emacsName = "emacs-${version}";

  src = builtins.fetchurl {
    url = "http://mirror.koddos.net/gnu/emacs/${emacsName}.tar.xz";
    sha256 = "0h9f2wpmp6rb5rfwvqwv1ia1nw86h74p7hnz3vb3gjazj67i4k2a";
  };

  macportSrc = builtins.fetchurl {
    url = "ftp://ftp.math.s.chiba-u.ac.jp/emacs/${emacsName}-mac-${macportVersion}.tar.gz";
    sha256 = "0rjk82k9qp1g701pfd4f0q2myzvsnp9q8xzphlxwi5yzwbs91kjq";
  };

  patches = [];
  doCheck = false;
  installTargets = [ "tags" "install" ];
  buildInputs = o.buildInputs ++ [ super.jansson ];
  configureFlags = o.configureFlags ++ [ "--with-json" ];
}));

At the moment, the tests aren't passing, so we need to pass doCheck = false - but I haven't experienced any issues yet!

Posted on:
August 12, 2020
Length:
1 minute read, 176 words
Tags:
emacs nix darwin
See Also:
spacebar module in nix-darwin now generally available
yabai module in nix-darwin now generally available
Nix Generator Functions for Sway