anchor.diff:      ++ lib.optionals stdenv.isLinux [ dbus libselinux systemd ]
       ++ lib.optionals withX
         [ xlibsWrapper libXaw Xaw3d libXpm libpng libjpeg libungif libtiff librsvg libXft
  -        imagemagick gconf m17n_lib libotf ]
  -    ++ lib.optional (withX && withGTK2) gtk2
  -    ++ lib.optionals (withX && withGTK3) [ gtk3 gsettings-desktop-schemas ]
  +        imagemagick gconf ]
  +    ++ lib.optionals (stdenv.isLinux && withX) [ m17n_lib libotf ]
  +    ++ lib.optional (withX && withGTK2) gtk2-x11
  +    ++ lib.optionals (withX && withGTK3) [ gtk3-x11 gsettings-desktop-schemas ]
       ++ lib.optional (stdenv.isDarwin && withX) cairo
       ++ lib.optionals (withX && withXwidgets) [ webkitgtk ];
   
  -  propagatedBuildInputs = lib.optionals stdenv.isDarwin [ AppKit GSS ImageIO ];
  +  propagatedBuildInputs = lib.optionals withNS [ AppKit GSS ImageIO ];
   
     hardeningDisable = [ "format" ];
   
     configureFlags = [ "--with-modules" ] ++
  -   (if stdenv.isDarwin
  -      then [ "--with-ns" "--disable-ns-self-contained" ]
  +    (lib.optional stdenv.isDarwin
  +      (lib.withFeature withNS "ns")) ++
  +    (if withNS
  +      then [ "--disable-ns-self-contained" ]
       else if withX
         then [ "--with-x-toolkit=${toolkit}" "--with-xft" ]
         else [ "--with-x=no" "--with-xpm=no" "--with-jpeg=no" "--with-png=no"
  
positive.code:       cp $srcdir/TAGS $dstdir
        echo '((nil . ((tags-file-name . "TAGS"))))' > $dstdir/.dir-locals.el
      done
    '' + lib.optionalString stdenv.isDarwin ''
      mkdir -p $out/Applications
      mv nextstep/Emacs.app $out/Applications
    '';
  
negative.code: , alsaLib, cairo, acl, gpm, AppKit, GSS, ImageIO, m17n_lib, libotf
  , systemd ? null
  , withX ? !stdenv.isDarwin
  , withNS ? stdenv.isDarwin
  , withGTK2 ? false, gtk2-x11 ? null
  , withGTK3 ? true, gtk3-x11 ? null, gsettings-desktop-schemas ? null
  , withXwidgets ? false, webkitgtk ? null, wrapGAppsHook ? null, glib-networking ? null
  , withCsrc ? true
  , srcRepo ? false, autoconf ? null, automake ? null, texinfo ? null
  