as an overlay

# ~/.config/nixpkgs/overlays/emacs27.nix
self: super:
{
  emacs27 = super.emacs.overrideAttrs (attrs: rec {
    pname = "emacs27";
    # srcRepo = true;
    name = "emacs27-${version}";
    version = "27.0.90";
    src = super.fetchFromGitHub {
      owner = "emacs-mirror";
      repo = "emacs";
      rev = "6057d79a4eb4b95037068a1e9335a2418b2da5ec";
      hash = "sha256:11111111111111111111111111111111111111111111111111111";
      #hash = "sha256:0dyb08afrkfic765zkwy27nnj0h8ays5likgfbdhwhbpdnmrgv8x";
    };
    patches = [];
    preConfigure = ''
      ./autogen.sh
    '' + ''
      substituteInPlace lisp/international/mule-cmds.el \
        --replace /usr/share/locale ${super.gettext}/share/locale
  
      for makefile_in in $(find . -name Makefile.in -print); do
          substituteInPlace $makefile_in --replace /bin/pwd pwd
      done
    '';
    nativeBuildInputs = [ super.pkgconfig ]
      ++ [ super.autoconf super.automake super.texinfo ];
    buildInputs = super.emacs.buildInputs
        ++ [ super.autoconf super.automake super.texinfo ]
	++ [ AppKit Carbon Cocoa IOKit OSAKit Quartz QuartzCore WebKit ImageCaptureCore GSS ImageIO ];
    inherit (super.darwin.apple_sdk.frameworks)
        AppKit Carbon Cocoa IOKit OSAKit Quartz QuartzCore WebKit
        ImageCaptureCore GSS ImageIO;
  });
}