about summary refs log tree commit diff
path: root/pkgs/applications/editors
diff options
context:
space:
mode:
authoradisbladis <adisbladis@gmail.com>2020-08-21 00:54:00 +0200
committeradisbladis <adisbladis@gmail.com>2020-08-21 00:54:00 +0200
commit967259e6b495c19aa367d598e8d20d73475d2cfc (patch)
tree1520650096d791fcb299e95e91d36442891f6bce /pkgs/applications/editors
parentd1fdc67c539e9e69bcd54470e0576a28a8d9ff10 (diff)
emacs: Factor out expression to a generic build
Diffstat (limited to 'pkgs/applications/editors')
-rw-r--r--pkgs/applications/editors/emacs/27.nix8
-rw-r--r--pkgs/applications/editors/emacs/generic.nix (renamed from pkgs/applications/editors/emacs/default.nix)20
2 files changed, 18 insertions, 10 deletions
diff --git a/pkgs/applications/editors/emacs/27.nix b/pkgs/applications/editors/emacs/27.nix
new file mode 100644
index 0000000000000..1037c0cd91dc9
--- /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
index dfa917ac572df..69bb51e10f204 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