jnv: 0.4.2 -> 0.5.0 (#371655)
[NixPkgs.git] / pkgs / applications / editors / emacs / elisp-packages / elpa-common-overrides.nix
blobcc8c4e1caa21b66d992f6bac936b8b8c7b5175c3
1 pkgs: lib: buildPackages:
3 self: super:
5 let
6   libExt = pkgs.stdenv.hostPlatform.extensions.sharedLibrary;
7   inherit (import ./lib-override-helper.nix pkgs lib)
8     addPackageRequires
9     addPackageRequiresIfOlder
10     ignoreCompilationError
11     ignoreCompilationErrorIfOlder
12     mkHome
13     mkHomeIfOlder
14     ;
17   cl-lib = null; # builtin
18   cl-print = null; # builtin
19   tle = null; # builtin
20   advice = null; # builtin
22   # Compilation instructions for the Ada executables:
23   # https://www.nongnu.org/ada-mode/
24   ada-mode = super.ada-mode.overrideAttrs (
25     finalAttrs: previousAttrs: {
26       # actually unpack source of ada-mode and wisi
27       # which are both needed to compile the tools
28       # we need at runtime
29       dontUnpack = false;
30       srcs = [
31         super.ada-mode.src
32         self.wisi.src
33       ];
35       sourceRoot = "ada-mode-${finalAttrs.version}";
37       nativeBuildInputs = previousAttrs.nativeBuildInputs or [ ] ++ [
38         buildPackages.gnat
39         buildPackages.gprbuild
40         buildPackages.dos2unix
41         buildPackages.re2c
42       ];
44       buildInputs = previousAttrs.buildInputs or [ ] ++ [ pkgs.gnatPackages.gnatcoll-xref ];
46       buildPhase = ''
47         runHook preBuild
48         ./build.sh -j$NIX_BUILD_CORES
49         runHook postBuild
50       '';
52       postInstall =
53         previousAttrs.postInstall or ""
54         + "\n"
55         + ''
56           ./install.sh "$out"
57         '';
59       meta = previousAttrs.meta // {
60         maintainers = [ lib.maintainers.sternenseemann ];
61       };
62     }
63   );
65   # native-compiler-error-empty-byte in old versions
66   ada-ref-man = ignoreCompilationErrorIfOlder super.ada-ref-man "2020.1.0.20201129.190419";
68   # elisp error in old versions
69   ampc = ignoreCompilationErrorIfOlder super.ampc "0.2.0.20240220.181558";
71   auctex = mkHome super.auctex;
73   auctex-cont-latexmk = mkHome super.auctex-cont-latexmk;
75   auctex-label-numbers = mkHome super.auctex-label-numbers;
77   # missing optional dependencies https://codeberg.org/rahguzar/consult-hoogle/issues/4
78   consult-hoogle = addPackageRequiresIfOlder super.consult-hoogle [ self.consult ] "0.2.2";
80   # missing optional dependencies https://github.com/jacksonrayhamilton/context-coloring/issues/10
81   context-coloring = addPackageRequires super.context-coloring [ self.js2-mode ];
83   cpio-mode = ignoreCompilationError super.cpio-mode; # elisp error
85   # fixed in https://git.savannah.gnu.org/cgit/emacs/elpa.git/commit/?h=externals/dbus-codegen&id=cfc46758c6252a602eea3dbc179f8094ea2a1a85
86   dbus-codegen = ignoreCompilationErrorIfOlder super.dbus-codegen "0.1.0.20201127.221326"; # elisp error
88   ebdb = super.ebdb.overrideAttrs (
89     finalAttrs: previousAttrs:
90     let
91       applyOrgRoamMissingPatch = lib.versionOlder finalAttrs.version "0.8.22.0.20240205.070828";
92     in
93     {
94       dontUnpack = !applyOrgRoamMissingPatch;
95       patches =
96         if applyOrgRoamMissingPatch then
97           previousAttrs.patches or [ ]
98           ++ [
99             (pkgs.fetchpatch {
100               name = "fix-comilation-error-about-missing-org-roam.patch";
101               url = "https://github.com/girzel/ebdb/commit/058f30a996eb9074feac8f94db4eb49e85ae08f1.patch";
102               hash = "sha256-UI72N3lCgro6bG75sWnbw9truREToQHEzZ1TeQAIMjo=";
103             })
104           ]
105         else
106           previousAttrs.patches or null;
107       preBuild =
108         if applyOrgRoamMissingPatch then
109           previousAttrs.preBuild or ""
110           + "\n"
111           + ''
112             pushd ..
113             local content_directory=$ename-$version
114             src=$PWD/$content_directory.tar
115             tar --create --verbose --file=$src $content_directory
116             popd
117           ''
118         else
119           previousAttrs.preBuild or null;
120     }
121   );
123   eglot = super.eglot.overrideAttrs (
124     finalAttrs: previousAttrs: {
125       postInstall =
126         previousAttrs.postInstall or ""
127         # old versions do not include an info manual
128         + lib.optionalString (lib.versionAtLeast "1.17.0.20240829.5352" finalAttrs.version) ''
129           local info_file=eglot.info
130           pushd $out/share/emacs/site-lisp/elpa/eglot-*
131           # specify output info file to override the one defined in eglot.texi
132           makeinfo --output=$info_file eglot.texi
133           install-info $info_file dir
134           popd
135         '';
136     }
137   );
139   jinx = super.jinx.overrideAttrs (old: {
140     dontUnpack = false;
142     nativeBuildInputs = old.nativeBuildInputs or [ ] ++ [ pkgs.pkg-config ];
144     buildInputs = old.buildInputs or [ ] ++ [ pkgs.enchant2 ];
146     postBuild =
147       old.postBuild or ""
148       + "\n"
149       + ''
150         NIX_CFLAGS_COMPILE="$($PKG_CONFIG --cflags enchant-2) $NIX_CFLAGS_COMPILE"
151         $CC -shared -o jinx-mod${libExt} jinx-mod.c -lenchant-2
152       '';
154     postInstall =
155       old.postInstall or ""
156       + "\n"
157       + ''
158         outd=$out/share/emacs/site-lisp/elpa/jinx-*
159         install -m444 -t $outd jinx-mod${libExt}
160         rm $outd/jinx-mod.c $outd/emacs-module.h
161       '';
163     meta = old.meta // {
164       maintainers = [ lib.maintainers.DamienCassou ];
165     };
166   });
168   notes-mode = (mkHome super.notes-mode).overrideAttrs (old: {
169     dontUnpack = false;
170     buildInputs = old.buildInputs or [ ] ++ [ pkgs.perl ];
171     nativeBuildInputs = old.nativeBuildInputs or [ ] ++ [ pkgs.perl ];
172     preInstall =
173       old.preInstall or ""
174       + "\n"
175       + ''
176         patchShebangs --build mkconfig
177         pushd ..
178         local content_directory=$ename-$version
179         src=$PWD/$content_directory.tar
180         tar --create --verbose --file=$src $content_directory
181         popd
182       '';
183     postFixup =
184       old.postFixup or ""
185       + "\n"
186       + ''
187         patchShebangs --host --update $out/share/emacs/site-lisp/elpa/$ename-$version/mkconfig
188       '';
189   });
191   plz = super.plz.overrideAttrs (old: {
192     dontUnpack = false;
193     postPatch =
194       old.postPatch or ""
195       + "\n"
196       + ''
197         substituteInPlace plz.el \
198           --replace-fail 'plz-curl-program "curl"' 'plz-curl-program "${lib.getExe pkgs.curl}"'
199       '';
200     preInstall =
201       old.preInstall or ""
202       + "\n"
203       + ''
204         tar -cf "$ename-$version.tar" --transform "s,^,$ename-$version/," * .[!.]*
205         src="$ename-$version.tar"
206       '';
207   });
209   # https://sourceware.org/bugzilla/show_bug.cgi?id=32185
210   poke = addPackageRequires super.poke [ self.poke-mode ];
212   pq = super.pq.overrideAttrs (old: {
213     buildInputs = old.buildInputs or [ ] ++ [ pkgs.postgresql ];
214   });
216   preview-auto = mkHome super.preview-auto;
218   preview-tailor = mkHome super.preview-tailor;
220   # https://debbugs.gnu.org/cgi/bugreport.cgi?bug=73325
221   psgml = ignoreCompilationError super.psgml; # elisp error
223   # native-ice https://github.com/mattiase/relint/issues/15
224   relint = ignoreCompilationError super.relint;
226   shen-mode = ignoreCompilationErrorIfOlder super.shen-mode "0.1.0.20221221.82050"; # elisp error
228   # native compilation for tests/seq-tests.el never ends
229   # delete tests/seq-tests.el to workaround this
230   seq = super.seq.overrideAttrs (old: {
231     dontUnpack = false;
232     postUnpack =
233       old.postUnpack or ""
234       + "\n"
235       + ''
236         local content_directory=$(echo seq-*)
237         rm --verbose $content_directory/tests/seq-tests.el
238         src=$PWD/$content_directory.tar
239         tar --create --verbose --file=$src $content_directory
240       '';
241   });
243   # https://github.com/alphapapa/taxy.el/issues/3
244   taxy = super.taxy.overrideAttrs (old: {
245     dontUnpack = false;
246     postUnpack =
247       old.postUnpack or ""
248       + "\n"
249       + ''
250         local content_directory=$ename-$version
251         rm --verbose --recursive $content_directory/examples
252         src=$PWD/$content_directory.tar
253         tar --create --verbose --file=$src $content_directory
254       '';
255   });
257   tex-parens = mkHomeIfOlder super.tex-parens "0.4.0.20240630.70456";
259   timerfunctions = ignoreCompilationErrorIfOlder super.timerfunctions "1.4.2.0.20201129.225252";
261   # kv is required in triples-test.el
262   # Alternatively, we can delete that file.  But adding a dependency is easier.
263   triples = addPackageRequires super.triples [ self.kv ];
265   wisitoken-grammar-mode = ignoreCompilationError super.wisitoken-grammar-mode; # elisp error
267   xeft = super.xeft.overrideAttrs (old: {
268     dontUnpack = false;
269     buildInputs = old.buildInputs or [ ] ++ [ pkgs.xapian ];
270     buildPhase =
271       old.buildPhase or ""
272       + ''
273         $CXX -shared -o xapian-lite${libExt} xapian-lite.cc -lxapian
274       '';
275     postInstall =
276       old.postInstall or ""
277       + "\n"
278       + ''
279         outd=$out/share/emacs/site-lisp/elpa/xeft-*
280         install -m444 -t $outd xapian-lite${libExt}
281         rm $outd/xapian-lite.cc $outd/emacs-module.h $outd/emacs-module-prelude.h $outd/demo.gif $outd/Makefile
282       '';
283   });
285   # native-ice https://github.com/mattiase/xr/issues/9
286   xr = ignoreCompilationError super.xr;