1{
2 lib,
3 fetchFromBitbucket,
4 fetchFromSavannah,
5}:
6
7let
8 mkArgs =
9 {
10 pname,
11 version,
12 variant,
13 patches ? _: [ ],
14 rev,
15 hash,
16 meta ? { },
17 }:
18 {
19 inherit
20 pname
21 version
22 variant
23 patches
24 ;
25
26 src =
27 {
28 "mainline" = (
29 fetchFromSavannah {
30 repo = "emacs";
31 inherit rev hash;
32 }
33 );
34 "macport" = (
35 fetchFromBitbucket {
36 owner = "mituharu";
37 repo = "emacs-mac";
38 inherit rev hash;
39 }
40 );
41 }
42 .${variant};
43
44 meta = {
45 homepage =
46 {
47 "mainline" = "https://www.gnu.org/software/emacs/";
48 "macport" = "https://bitbucket.org/mituharu/emacs-mac/";
49 }
50 .${variant};
51 description =
52 "Extensible, customizable GNU text editor"
53 + lib.optionalString (variant == "macport") " - macport variant";
54 longDescription = ''
55 GNU Emacs is an extensible, customizable text editor—and more. At its core
56 is an interpreter for Emacs Lisp, a dialect of the Lisp programming
57 language with extensions to support text editing.
58
59 The features of GNU Emacs include: content-sensitive editing modes,
60 including syntax coloring, for a wide variety of file types including
61 plain text, source code, and HTML; complete built-in documentation,
62 including a tutorial for new users; full Unicode support for nearly all
63 human languages and their scripts; highly customizable, using Emacs Lisp
64 code or a graphical interface; a large number of extensions that add other
65 functionality, including a project planner, mail and news reader, debugger
66 interface, calendar, and more. Many of these extensions are distributed
67 with GNU Emacs; others are available separately.
68 ''
69 + lib.optionalString (variant == "macport") ''
70
71 This release is built from Mitsuharu Yamamoto's patched source code
72 tailored for macOS.
73 '';
74 changelog =
75 {
76 "mainline" = "https://www.gnu.org/savannah-checkouts/gnu/emacs/news/NEWS.${version}";
77 "macport" = "https://bitbucket.org/mituharu/emacs-mac/raw/${rev}/NEWS-mac";
78 }
79 .${variant};
80 license = lib.licenses.gpl3Plus;
81 maintainers =
82 {
83 "mainline" = with lib.maintainers; [
84 AndersonTorres
85 adisbladis
86 jwiegley
87 lovek323
88 matthewbauer
89 panchoh
90 ];
91 "macport" = with lib.maintainers; [ ];
92 }
93 .${variant};
94 platforms =
95 {
96 "mainline" = lib.platforms.all;
97 "macport" = lib.platforms.darwin;
98 }
99 .${variant};
100 mainProgram = "emacs";
101 }
102 // meta;
103 };
104in
105{
106 emacs30 = import ./make-emacs.nix (mkArgs {
107 pname = "emacs";
108 version = "30.1";
109 variant = "mainline";
110 rev = "30.1";
111 hash = "sha256-wBuWLuFzwB77FqAYAUuNe3CuJFutjqp0XGt5srt7jAo=";
112 patches = fetchpatch: [
113 (builtins.path {
114 name = "inhibit-lexical-cookie-warning-67916.patch";
115 path = ./inhibit-lexical-cookie-warning-67916-30.patch;
116 })
117 (fetchpatch {
118 # bug#63288 and bug#76523
119 url = "https://git.savannah.gnu.org/cgit/emacs.git/patch/?id=53a5dada413662389a17c551a00d215e51f5049f";
120 hash = "sha256-AEvsQfpdR18z6VroJkWoC3sBoApIYQQgeF/P2DprPQ8=";
121 })
122 (fetchpatch {
123 # bug#76573
124 url = "https://git.savannah.gnu.org/cgit/emacs.git/patch/?id=05ecb2b8f0216aa3f391ee661aad4d61fd6aed0e";
125 hash = "sha256-fvnHMvuqwQseVrDpVpnzSaoWfXrR5tsjIib7+lhRGII=";
126 })
127 ];
128 });
129
130 emacs29-macport = import ./make-emacs.nix (mkArgs {
131 pname = "emacs-mac";
132 version = "29.4";
133 variant = "macport";
134 rev = "emacs-29.4-mac-10.1";
135 hash = "sha256-8OQ+fon9tclbh/eUJ09uqKfMaz9M77QnLIp2R8QB6Ic=";
136 patches = fetchpatch: [
137 # CVE-2024-53920
138 (fetchpatch {
139 url = "https://gitweb.gentoo.org/proj/emacs-patches.git/plain/emacs/29.4/07_all_trusted-content.patch?id=f24370de4de0a37304958ec1569d5c50c1745b7f";
140 hash = "sha256-zUWM2HDO5MHEB5fC5TCUxzmSafMvXO5usRzCyp9Q7P4=";
141 })
142
143 # CVE-2025-1244
144 (fetchpatch {
145 url = "https://gitweb.gentoo.org/proj/emacs-patches.git/plain/emacs/29.4/06_all_man.patch?id=f24370de4de0a37304958ec1569d5c50c1745b7f";
146 hash = "sha256-Vdf6GF5YmGoHTkxiD9mdYH0hgvfovZwrqYN1NQ++U1w=";
147 })
148 ];
149
150 meta.knownVulnerabilities = [ ];
151 });
152}