From 13276abce97fae047ff42604646c0fca58338de9 Mon Sep 17 00:00:00 2001 From: adisbladis Date: Fri, 21 Aug 2020 00:21:02 +0200 Subject: [PATCH 1/5] emacs25: Drop outdated version --- pkgs/applications/editors/emacs/25.nix | 146 ------------------ pkgs/development/compilers/mozart/default.nix | 3 +- pkgs/top-level/aliases.nix | 1 - pkgs/top-level/all-packages.nix | 24 +-- pkgs/top-level/release-small.nix | 2 +- 5 files changed, 5 insertions(+), 171 deletions(-) delete mode 100644 pkgs/applications/editors/emacs/25.nix diff --git a/pkgs/applications/editors/emacs/25.nix b/pkgs/applications/editors/emacs/25.nix deleted file mode 100644 index 5bc29a046bc5..000000000000 --- a/pkgs/applications/editors/emacs/25.nix +++ /dev/null @@ -1,146 +0,0 @@ -{ stdenv, lib, fetchurl, ncurses, xlibsWrapper, libXaw, libXpm, Xaw3d, fetchpatch -, pkgconfig, gettext, libXft, dbus, libpng, libjpeg, libungif -, libtiff, librsvg, gconf, libxml2, imagemagick, gnutls, libselinux -, alsaLib, cairo, acl, gpm, AppKit, GSS, ImageIO -, withX ? !stdenv.isDarwin -, withGTK2 ? false, gtk2 ? null -, withGTK3 ? true, gtk3 ? null, gsettings-desktop-schemas ? null -, withXwidgets ? false, webkitgtk, wrapGAppsHook ? null, glib-networking ? null -, withCsrc ? true -, autoconf ? null, automake ? null, texinfo ? null -}: - -assert (libXft != null) -> libpng != null; # probably a bug -assert stdenv.isDarwin -> libXaw != null; # fails to link otherwise -assert withGTK2 -> withX || stdenv.isDarwin; -assert withGTK3 -> withX || stdenv.isDarwin; -assert withGTK2 -> !withGTK3 && gtk2 != null; -assert withGTK3 -> !withGTK2 && gtk3 != null; -assert withXwidgets -> withGTK3 && webkitgtk != null; - -let - toolkit = - if withGTK2 then "gtk2" - else if withGTK3 then "gtk3" - else "lucid"; -in -stdenv.mkDerivation rec { - name = "emacs-${version}${versionModifier}"; - version = "25.3"; - versionModifier = ""; - - src = fetchurl { - url = "mirror://gnu/emacs/${name}.tar.xz"; - sha256 = "02y00y9q42g1iqgz5qhmsja75hwxd88yrn9zp14lanay0zkwafi5"; - }; - - enableParallelBuilding = true; - - patches = lib.optionals stdenv.isDarwin [ - ./at-fdcwd.patch - - # Backport of the fix to - # https://lists.gnu.org/archive/html/bug-gnu-emacs/2017-04/msg00201.html - # Should be removed when switching to Emacs 26.1 - (fetchurl { - url = "https://gist.githubusercontent.com/aaronjensen/f45894ddf431ecbff78b1bcf533d3e6b/raw/6a5cd7f57341aba673234348d8b0d2e776f86719/Emacs-25-OS-X-use-vfork.patch"; - sha256 = "1nlsxiaynswqhy99jf4mw9x0sndhwcrwy8713kq1l3xqv9dbrzgj"; - }) - ] ++ [ - # Backport patches so we can use webkitgtk with xwidgets. - (fetchpatch { - name = "0001-Omit-unnecessary-includes-from-xwidget-c.patch"; - url = "https://github.com/emacs-mirror/emacs/commit/a36ed9b5e95afea5716256bac24d883263aefbaf.patch"; - sha256 = "1j34c0vkj87il87xy1px23yk6bw73adpr7wqa79ncj89i4lc8qkb"; - }) - (fetchpatch { - name = "0002-xwidget-Use-WebKit2-API.patch"; - url = "https://github.com/emacs-mirror/emacs/commit/d781662873f228b110a128f7a2b6583a4d5e0a3a.patch"; - sha256 = "1lld56zi4cw2hmjxhhdcc0f07k8lbj32h10wcq4ml3asdwa31ryr"; - }) - ]; - - nativeBuildInputs = [ pkgconfig autoconf automake texinfo ] - ++ lib.optional (withX && (withGTK3 || withXwidgets)) wrapGAppsHook; - - buildInputs = - [ ncurses gconf libxml2 gnutls alsaLib acl gpm gettext ] - ++ lib.optionals stdenv.isLinux [ dbus libselinux ] - ++ lib.optionals withX - [ xlibsWrapper libXaw Xaw3d libXpm libpng libjpeg libungif libtiff librsvg libXft - imagemagick gconf ] - ++ lib.optional (withX && withGTK2) gtk2 - ++ lib.optionals (withX && withGTK3) [ gtk3 gsettings-desktop-schemas ] - ++ lib.optional (stdenv.isDarwin && withX) cairo - ++ lib.optionals (withX && withXwidgets) [ webkitgtk glib-networking ] - ++ lib.optionals stdenv.isDarwin [ AppKit GSS ImageIO ]; - - hardeningDisable = [ "format" ]; - - configureFlags = [ "--with-modules" ] ++ - (if stdenv.isDarwin - then [ "--with-ns" "--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" - "--with-gif=no" "--with-tiff=no" ]) - ++ lib.optional withXwidgets "--with-xwidgets"; - - preConfigure = '' - ./autogen.sh - '' + '' - substituteInPlace lisp/international/mule-cmds.el \ - --replace /usr/share/locale ${gettext}/share/locale - - for makefile_in in $(find . -name Makefile.in -print); do - substituteInPlace $makefile_in --replace /bin/pwd pwd - done - ''; - - installTargets = [ "tags" "install" ]; - - postInstall = '' - mkdir -p $out/share/emacs/site-lisp - cp ${./site-start.el} $out/share/emacs/site-lisp/site-start.el - $out/bin/emacs --batch -f batch-byte-compile $out/share/emacs/site-lisp/site-start.el - - rm -rf $out/var - rm -rf $out/share/emacs/${version}/site-lisp - '' + lib.optionalString withCsrc '' - for srcdir in src lisp lwlib ; do - dstdir=$out/share/emacs/${version}/$srcdir - mkdir -p $dstdir - find $srcdir -name "*.[chm]" -exec cp {} $dstdir \; - 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 - ''; - - meta = with stdenv.lib; { - description = "The extensible, customizable GNU text editor"; - homepage = "https://www.gnu.org/software/emacs/"; - license = licenses.gpl3Plus; - maintainers = with maintainers; [ lovek323 peti jwiegley ]; - platforms = platforms.all; - - longDescription = '' - GNU Emacs is an extensible, customizable text editor—and more. At its - core is an interpreter for Emacs Lisp, a dialect of the Lisp - programming language with extensions to support text editing. - - The features of GNU Emacs include: content-sensitive editing modes, - including syntax coloring, for a wide variety of file types including - plain text, source code, and HTML; complete built-in documentation, - including a tutorial for new users; full Unicode support for nearly all - human languages and their scripts; highly customizable, using Emacs - Lisp code or a graphical interface; a large number of extensions that - add other functionality, including a project planner, mail and news - reader, debugger interface, calendar, and more. Many of these - extensions are distributed with GNU Emacs; others are available - separately. - ''; - }; -} diff --git a/pkgs/development/compilers/mozart/default.nix b/pkgs/development/compilers/mozart/default.nix index b8951c8c8004..d2c2d98e4115 100644 --- a/pkgs/development/compilers/mozart/default.nix +++ b/pkgs/development/compilers/mozart/default.nix @@ -9,7 +9,6 @@ , llvmPackages_5 , gmp , emacs -, emacs25-nox , jre_headless , tcl , tk @@ -73,7 +72,7 @@ in stdenv.mkDerivation rec { llvmPackages_5.clang llvmPackages_5.clang-unwrapped gmp - emacs25-nox + emacs jre_headless tcl tk diff --git a/pkgs/top-level/aliases.nix b/pkgs/top-level/aliases.nix index d1eb331c5bb6..9f959c8d16e3 100644 --- a/pkgs/top-level/aliases.nix +++ b/pkgs/top-level/aliases.nix @@ -114,7 +114,6 @@ mapAliases ({ docker_compose = docker-compose; # 2018-11-10 draftsight = throw "draftsight has been removed, no longer available as freeware"; # added 2020-08-14 dwarf_fortress = dwarf-fortress; # added 2016-01-23 - emacsMelpa = emacs25Packages; # for backward compatibility emacsPackagesGen = emacsPackagesFor; # added 2018-08-18 emacsPackagesNgGen = emacsPackagesFor; # added 2018-08-18 emacsPackagesNgFor = emacsPackagesFor; # added 2019-08-07 diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index bede1b52fdff..e3fee57f252b 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -9305,7 +9305,9 @@ in mosml = callPackage ../development/compilers/mosml { }; - mozart2 = callPackage ../development/compilers/mozart { }; + mozart2 = callPackage ../development/compilers/mozart { + emacs = emacs-nox; + }; mozart2-binary = callPackage ../development/compilers/mozart/binary.nix { }; @@ -19899,24 +19901,6 @@ in withGTK3 = false; })); - emacs25 = callPackage ../applications/editors/emacs/25.nix { - # use override to enable additional features - libXaw = xorg.libXaw; - Xaw3d = null; - gconf = null; - alsaLib = null; - imagemagick = null; - acl = null; - gpm = null; - inherit (darwin.apple_sdk.frameworks) AppKit GSS ImageIO; - }; - - emacs25-nox = lowPrio (appendToName "nox" (emacs25.override { - withX = false; - withGTK2 = false; - withGTK3 = false; - })); - emacsMacport = callPackage ../applications/editors/emacs/macport.nix { inherit (darwin.apple_sdk.frameworks) AppKit Carbon Cocoa IOKit OSAKit Quartz QuartzCore WebKit @@ -19948,10 +19932,8 @@ in }; }; - emacs25Packages = dontRecurseIntoAttrs (emacsPackagesFor emacs25); emacs26Packages = dontRecurseIntoAttrs (emacsPackagesFor emacs26); - emacs25WithPackages = emacs25Packages.emacsWithPackages; emacs26WithPackages = emacs26Packages.emacsWithPackages; emacsWithPackages = emacsPackages.emacsWithPackages; diff --git a/pkgs/top-level/release-small.nix b/pkgs/top-level/release-small.nix index 031acba4d23a..7f84f02f006a 100644 --- a/pkgs/top-level/release-small.nix +++ b/pkgs/top-level/release-small.nix @@ -38,7 +38,7 @@ with import ./release-lib.nix { inherit supportedSystems; }; dhcp = linux; diffutils = all; e2fsprogs = linux; - emacs25 = linux; + emacs = linux; enscript = all; file = all; findutils = all; From d339f8379d14e25e29206b945787ec010047f08d Mon Sep 17 00:00:00 2001 From: adisbladis Date: Fri, 21 Aug 2020 00:22:18 +0200 Subject: [PATCH 2/5] emacs: emacs26 -> emacs27 The attribute names were wrong --- .../editors/emacs-modes/updater-emacs.nix | 2 +- pkgs/top-level/all-packages.nix | 14 +++++++------- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/pkgs/applications/editors/emacs-modes/updater-emacs.nix b/pkgs/applications/editors/emacs-modes/updater-emacs.nix index 518ee67e4512..b5de993eaa76 100644 --- a/pkgs/applications/editors/emacs-modes/updater-emacs.nix +++ b/pkgs/applications/editors/emacs-modes/updater-emacs.nix @@ -1,7 +1,7 @@ let pkgs = import ../../../.. {}; - emacsEnv = (pkgs.emacsPackagesFor pkgs.emacs26).emacsWithPackages (epkgs: let + emacsEnv = (pkgs.emacsPackagesFor pkgs.emacs).emacsWithPackages (epkgs: let promise = epkgs.trivialBuild { pname = "promise"; diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index e3fee57f252b..2b1f8345caf5 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -19878,11 +19878,11 @@ in elvis = callPackage ../applications/editors/elvis { }; - emacs = emacs26; - emacsPackages = emacs26Packages; - emacs-nox = emacs26-nox; + emacs = emacs27; + emacsPackages = emacs27Packages; + emacs-nox = emacs27-nox; - emacs26 = callPackage ../applications/editors/emacs { + emacs27 = callPackage ../applications/editors/emacs { # use override to enable additional features libXaw = xorg.libXaw; Xaw3d = null; @@ -19894,7 +19894,7 @@ in inherit (darwin.apple_sdk.frameworks) AppKit GSS ImageIO; }; - emacs26-nox = lowPrio (appendToName "nox" (emacs26.override { + emacs27-nox = lowPrio (appendToName "nox" (emacs27.override { withX = false; withNS = false; withGTK2 = false; @@ -19932,9 +19932,9 @@ in }; }; - emacs26Packages = dontRecurseIntoAttrs (emacsPackagesFor emacs26); + emacs27Packages = dontRecurseIntoAttrs (emacsPackagesFor emacs27); - emacs26WithPackages = emacs26Packages.emacsWithPackages; + emacs27WithPackages = emacs27Packages.emacsWithPackages; emacsWithPackages = emacsPackages.emacsWithPackages; inherit (gnome3) empathy; From d1fdc67c539e9e69bcd54470e0576a28a8d9ff10 Mon Sep 17 00:00:00 2001 From: adisbladis Date: Fri, 21 Aug 2020 00:34:15 +0200 Subject: [PATCH 3/5] nixos/editors: Remove any explicit mention of Emacs 25 --- nixos/modules/services/editors/emacs.xml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/nixos/modules/services/editors/emacs.xml b/nixos/modules/services/editors/emacs.xml index 74c60014dcea..05f87df43bcd 100644 --- a/nixos/modules/services/editors/emacs.xml +++ b/nixos/modules/services/editors/emacs.xml @@ -53,11 +53,11 @@ emacs - emacs25 + emacs - The latest stable version of Emacs 25 using the + The latest stable version of Emacs using the GTK 2 widget toolkit. @@ -66,11 +66,11 @@ - emacs25-nox + emacs-nox - Emacs 25 built without any dependency on X11 libraries. + Emacs built without any dependency on X11 libraries. @@ -79,11 +79,11 @@ emacsMacport - emacs25Macport + emacsMacport - Emacs 25 with the "Mac port" patches, providing a more native look and + Emacs with the "Mac port" patches, providing a more native look and feel under macOS. From 967259e6b495c19aa367d598e8d20d73475d2cfc Mon Sep 17 00:00:00 2001 From: adisbladis Date: Fri, 21 Aug 2020 00:54:00 +0200 Subject: [PATCH 4/5] emacs: Factor out expression to a generic build --- pkgs/applications/editors/emacs/27.nix | 8 ++++++++ .../emacs/{default.nix => generic.nix} | 20 +++++++++---------- pkgs/top-level/all-packages.nix | 2 +- 3 files changed, 19 insertions(+), 11 deletions(-) create mode 100644 pkgs/applications/editors/emacs/27.nix rename pkgs/applications/editors/emacs/{default.nix => generic.nix} (96%) diff --git a/pkgs/applications/editors/emacs/27.nix b/pkgs/applications/editors/emacs/27.nix new file mode 100644 index 000000000000..1037c0cd91dc --- /dev/null +++ b/pkgs/applications/editors/emacs/27.nix @@ -0,0 +1,8 @@ +import ./generic.nix (rec { + version = "27.1"; + sha256 = "0h9f2wpmp6rb5rfwvqwv1ia1nw86h74p7hnz3vb3gjazj67i4k2a"; + patches = [ + ./clean-env.patch + ./tramp-detect-wrapped-gvfsd.patch + ]; +}) diff --git a/pkgs/applications/editors/emacs/default.nix b/pkgs/applications/editors/emacs/generic.nix similarity index 96% rename from pkgs/applications/editors/emacs/default.nix rename to pkgs/applications/editors/emacs/generic.nix index dfa917ac572d..69bb51e10f20 100644 --- a/pkgs/applications/editors/emacs/default.nix +++ b/pkgs/applications/editors/emacs/generic.nix @@ -1,3 +1,11 @@ +{ + version + , sha256 + , versionModifier ? "" + , pname ? "emacs" + , name ? "emacs-${version}${versionModifier}" + , patches ? [ ] +}: { stdenv, lib, fetchurl, fetchpatch, ncurses, xlibsWrapper, libXaw, libXpm , Xaw3d, libXcursor, pkgconfig, gettext, libXft, dbus, libpng, libjpeg, libungif , libtiff, librsvg, gconf, libxml2, imagemagick, gnutls, libselinux @@ -32,25 +40,17 @@ assert withXwidgets -> withGTK3 && webkitgtk != null; let - version = "27.1"; - versionModifier = ""; - name = "emacs-${version}${versionModifier}"; in stdenv.mkDerivation { - inherit name version; + inherit pname version; src = fetchurl { url = "mirror://gnu/emacs/${name}.tar.xz"; - sha256 = "0h9f2wpmp6rb5rfwvqwv1ia1nw86h74p7hnz3vb3gjazj67i4k2a"; + inherit sha256; }; enableParallelBuilding = true; - patches = [ - ./clean-env.patch - ./tramp-detect-wrapped-gvfsd.patch - ]; - postPatch = lib.concatStringsSep "\n" [ (lib.optionalString srcRepo '' rm -fr .git diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 2b1f8345caf5..aad9a4fe13c4 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -19882,7 +19882,7 @@ in emacsPackages = emacs27Packages; emacs-nox = emacs27-nox; - emacs27 = callPackage ../applications/editors/emacs { + emacs27 = callPackage ../applications/editors/emacs/27.nix { # use override to enable additional features libXaw = xorg.libXaw; Xaw3d = null; From edd6216a00437161ddbb658f6d9c9271daa70942 Mon Sep 17 00:00:00 2001 From: adisbladis Date: Fri, 21 Aug 2020 00:58:17 +0200 Subject: [PATCH 5/5] emacs26: Add back at version 26.3 --- pkgs/applications/editors/emacs/26.nix | 8 +++++++ .../editors/emacs/clean-env-26.patch | 15 ++++++++++++ .../emacs/tramp-detect-wrapped-gvfsd-26.patch | 14 +++++++++++ pkgs/top-level/all-packages.nix | 24 +++++++++++++++++-- 4 files changed, 59 insertions(+), 2 deletions(-) create mode 100644 pkgs/applications/editors/emacs/26.nix create mode 100644 pkgs/applications/editors/emacs/clean-env-26.patch create mode 100644 pkgs/applications/editors/emacs/tramp-detect-wrapped-gvfsd-26.patch diff --git a/pkgs/applications/editors/emacs/26.nix b/pkgs/applications/editors/emacs/26.nix new file mode 100644 index 000000000000..a151006a995d --- /dev/null +++ b/pkgs/applications/editors/emacs/26.nix @@ -0,0 +1,8 @@ +import ./generic.nix (rec { + version = "26.3"; + sha256 = "119ldpk7sgn9jlpyngv5y4z3i7bb8q3xp4p0qqi7i5nq39syd42d"; + patches = [ + ./clean-env-26.patch + ./tramp-detect-wrapped-gvfsd-26.patch + ]; +}) diff --git a/pkgs/applications/editors/emacs/clean-env-26.patch b/pkgs/applications/editors/emacs/clean-env-26.patch new file mode 100644 index 000000000000..88befda899a7 --- /dev/null +++ b/pkgs/applications/editors/emacs/clean-env-26.patch @@ -0,0 +1,15 @@ +Dump temacs in an empty environment to prevent -dev paths from ending +up in the dumped image. + +diff --git a/src/Makefile.in b/src/Makefile.in +--- a/src/Makefile.in ++++ b/src/Makefile.in +@@ -535,7 +535,7 @@ ifeq ($(CANNOT_DUMP),yes) + ln -f temacs$(EXEEXT) $@ + else + unset EMACS_HEAP_EXEC; \ +- LC_ALL=C $(RUN_TEMACS) -batch $(BUILD_DETAILS) -l loadup dump ++ env -i LC_ALL=C $(RUN_TEMACS) -batch $(BUILD_DETAILS) -l loadup dump + ifneq ($(PAXCTL_dumped),) + $(PAXCTL_dumped) $@ + endif diff --git a/pkgs/applications/editors/emacs/tramp-detect-wrapped-gvfsd-26.patch b/pkgs/applications/editors/emacs/tramp-detect-wrapped-gvfsd-26.patch new file mode 100644 index 000000000000..5d16194fd202 --- /dev/null +++ b/pkgs/applications/editors/emacs/tramp-detect-wrapped-gvfsd-26.patch @@ -0,0 +1,14 @@ +diff --git a/lisp/net/tramp-gvfs.el b/lisp/net/tramp-gvfs.el +index f370abba31..f2806263a9 100644 +--- a/lisp/net/tramp-gvfs.el ++++ b/lisp/net/tramp-gvfs.el +@@ -164,7 +164,8 @@ tramp-gvfs-enabled + (and (featurep 'dbusbind) + (tramp-compat-funcall 'dbus-get-unique-name :system) + (tramp-compat-funcall 'dbus-get-unique-name :session) +- (or (tramp-compat-process-running-p "gvfs-fuse-daemon") ++ (or (tramp-compat-process-running-p ".gvfsd-fuse-wrapped") ++ (tramp-compat-process-running-p "gvfs-fuse-daemon") + (tramp-compat-process-running-p "gvfsd-fuse")))) + "Non-nil when GVFS is available.") + diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index aad9a4fe13c4..500d023829f0 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -19881,6 +19881,7 @@ in emacs = emacs27; emacsPackages = emacs27Packages; emacs-nox = emacs27-nox; + emacsWithPackages = emacsPackages.emacsWithPackages; emacs27 = callPackage ../applications/editors/emacs/27.nix { # use override to enable additional features @@ -19901,6 +19902,25 @@ in withGTK3 = false; })); + emacs26 = callPackage ../applications/editors/emacs/26.nix { + # use override to enable additional features + libXaw = xorg.libXaw; + Xaw3d = null; + gconf = null; + alsaLib = null; + imagemagick = null; + acl = null; + gpm = null; + inherit (darwin.apple_sdk.frameworks) AppKit GSS ImageIO; + }; + + emacs26-nox = lowPrio (appendToName "nox" (emacs26.override { + withX = false; + withNS = false; + withGTK2 = false; + withGTK3 = false; + })); + emacsMacport = callPackage ../applications/editors/emacs/macport.nix { inherit (darwin.apple_sdk.frameworks) AppKit Carbon Cocoa IOKit OSAKit Quartz QuartzCore WebKit @@ -19932,10 +19952,10 @@ in }; }; + emacs26Packages = dontRecurseIntoAttrs (emacsPackagesFor emacs26); emacs27Packages = dontRecurseIntoAttrs (emacsPackagesFor emacs27); - + emacs26WithPackages = emacs26Packages.emacsWithPackages; emacs27WithPackages = emacs27Packages.emacsWithPackages; - emacsWithPackages = emacsPackages.emacsWithPackages; inherit (gnome3) empathy;