From 967259e6b495c19aa367d598e8d20d73475d2cfc Mon Sep 17 00:00:00 2001 From: adisbladis Date: Fri, 21 Aug 2020 00:54:00 +0200 Subject: [PATCH] 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;