diff --git a/pkgs/applications/editors/emacs/elisp-packages/elpa-common-overrides.nix b/pkgs/applications/editors/emacs/elisp-packages/elpa-common-overrides.nix new file mode 100644 index 000000000000..0fc6d0bf4717 --- /dev/null +++ b/pkgs/applications/editors/emacs/elisp-packages/elpa-common-overrides.nix @@ -0,0 +1,55 @@ +pkgs: + +self: super: + +let + libExt = pkgs.stdenv.hostPlatform.extensions.sharedLibrary; +in +{ + # TODO delete this when we get upstream fix https://debbugs.gnu.org/cgi/bugreport.cgi?bug=73241 + eglot = super.eglot.overrideAttrs (old: { + postInstall = + old.postInstall or "" + + '' + local info_file=eglot.info + pushd $out/share/emacs/site-lisp/elpa/eglot-* + # specify output info file to override the one defined in eglot.texi + makeinfo --output=$info_file eglot.texi + install-info $info_file dir + popd + ''; + }); + + # native compilation for tests/seq-tests.el never ends + # delete tests/seq-tests.el to workaround this + seq = super.seq.overrideAttrs (old: { + dontUnpack = false; + postUnpack = + old.postUnpack or "" + + "\n" + + '' + local content_directory=$(echo seq-*) + rm --verbose $content_directory/tests/seq-tests.el + src=$PWD/$content_directory.tar + tar --create --verbose --file=$src $content_directory + ''; + }); + + xeft = super.xeft.overrideAttrs (old: { + dontUnpack = false; + buildInputs = old.buildInputs or [ ] ++ [ pkgs.xapian ]; + buildPhase = + old.buildPhase or "" + + '' + $CXX -shared -o xapian-lite${libExt} xapian-lite.cc $NIX_CFLAGS_COMPILE -lxapian + ''; + postInstall = + old.postInstall or "" + + "\n" + + '' + outd=$out/share/emacs/site-lisp/elpa/xeft-* + install -m444 -t $outd xapian-lite${libExt} + rm $outd/xapian-lite.cc $outd/emacs-module.h $outd/emacs-module-prelude.h $outd/demo.gif $outd/Makefile + ''; + }); +} diff --git a/pkgs/applications/editors/emacs/elisp-packages/elpa-devel-packages.nix b/pkgs/applications/editors/emacs/elisp-packages/elpa-devel-packages.nix index bd927e1fb919..1d04c8f361e0 100644 --- a/pkgs/applications/editors/emacs/elisp-packages/elpa-devel-packages.nix +++ b/pkgs/applications/editors/emacs/elisp-packages/elpa-devel-packages.nix @@ -47,52 +47,16 @@ self: let super = imported; - overrides = { - eglot = super.eglot.overrideAttrs (old: { - postInstall = (old.postInstall or "") + '' - local info_file=eglot.info - pushd $out/share/emacs/site-lisp/elpa/eglot-* - # specify output info file to override the one defined in eglot.texi - makeinfo --output=$info_file eglot.texi - install-info $info_file dir - popd - ''; - }); + commonOverrides = import ./elpa-common-overrides.nix pkgs; + overrides = self: super: { pq = super.pq.overrideAttrs (old: { buildInputs = (old.buildInputs or [ ]) ++ [ pkgs.postgresql ]; }); - - xeft = super.xeft.overrideAttrs (old: let - libExt = pkgs.stdenv.hostPlatform.extensions.sharedLibrary; - in { - dontUnpack = false; - - buildInputs = (old.buildInputs or [ ]) ++ [ pkgs.xapian ]; - buildPhase = (old.buildPhase or "") + '' - $CXX -shared -o xapian-lite${libExt} xapian-lite.cc $NIX_CFLAGS_COMPILE -lxapian - ''; - postInstall = (old.postInstall or "") + "\n" + '' - outd=$out/share/emacs/site-lisp/elpa/xeft-* - install -m444 -t $outd xapian-lite${libExt} - rm $outd/xapian-lite.cc $outd/emacs-module.h $outd/emacs-module-prelude.h $outd/demo.gif $outd/Makefile - ''; - }); - - # native compilation for tests/seq-tests.el never ends - # delete tests/seq-tests.el to workaround this - seq = super.seq.overrideAttrs (old: { - dontUnpack = false; - postUnpack = (old.postUnpack or "") + "\n" + '' - local content_directory=$(echo seq-*) - rm --verbose $content_directory/tests/seq-tests.el - src=$PWD/$content_directory.tar - tar --create --verbose --file=$src $content_directory - ''; - }); }; - elpaDevelPackages = super // overrides; + elpaDevelPackages = + let super' = super // (commonOverrides self super); in super' // (overrides self super'); in elpaDevelPackages); diff --git a/pkgs/applications/editors/emacs/elisp-packages/elpa-packages.nix b/pkgs/applications/editors/emacs/elisp-packages/elpa-packages.nix index 2d1122e270fd..dc412e9b246d 100644 --- a/pkgs/applications/editors/emacs/elisp-packages/elpa-packages.nix +++ b/pkgs/applications/editors/emacs/elisp-packages/elpa-packages.nix @@ -47,7 +47,9 @@ self: let super = imported; - overrides = { + commonOverrides = import ./elpa-common-overrides.nix pkgs; + + overrides = self: super: { # upstream issue: Wrong type argument: arrayp, nil org-transclusion = if super.org-transclusion.version == "1.2.0" @@ -98,17 +100,6 @@ self: let }; }); - eglot = super.eglot.overrideAttrs (old: { - postInstall = (old.postInstall or "") + '' - local info_file=eglot.info - pushd $out/share/emacs/site-lisp/elpa/eglot-* - # specify output info file to override the one defined in eglot.texi - makeinfo --output=$info_file eglot.texi - install-info $info_file dir - popd - ''; - }); - jinx = super.jinx.overrideAttrs (old: let libExt = pkgs.stdenv.hostPlatform.extensions.sharedLibrary; in { @@ -150,38 +141,11 @@ self: let } ); - xeft = super.xeft.overrideAttrs (old: let - libExt = pkgs.stdenv.hostPlatform.extensions.sharedLibrary; - in { - dontUnpack = false; - - buildInputs = (old.buildInputs or [ ]) ++ [ pkgs.xapian ]; - buildPhase = (old.buildPhase or "") + '' - $CXX -shared -o xapian-lite${libExt} xapian-lite.cc $NIX_CFLAGS_COMPILE -lxapian - ''; - postInstall = (old.postInstall or "") + "\n" + '' - outd=$out/share/emacs/site-lisp/elpa/xeft-* - install -m444 -t $outd xapian-lite${libExt} - rm $outd/xapian-lite.cc $outd/emacs-module.h $outd/emacs-module-prelude.h $outd/demo.gif $outd/Makefile - ''; - }); - - # native compilation for tests/seq-tests.el never ends - # delete tests/seq-tests.el to workaround this - seq = super.seq.overrideAttrs (old: { - dontUnpack = false; - postUnpack = (old.postUnpack or "") + "\n" + '' - local content_directory=$(echo seq-*) - rm --verbose $content_directory/tests/seq-tests.el - src=$PWD/$content_directory.tar - tar --create --verbose --file=$src $content_directory - ''; - }); - }; - elpaPackages = super // overrides; + elpaPackages = + let super' = super // (commonOverrides self super); in super' // (overrides self super'); in elpaPackages); diff --git a/pkgs/applications/editors/emacs/elisp-packages/nongnu-common-overrides.nix b/pkgs/applications/editors/emacs/elisp-packages/nongnu-common-overrides.nix new file mode 100644 index 000000000000..d6ac00a3a817 --- /dev/null +++ b/pkgs/applications/editors/emacs/elisp-packages/nongnu-common-overrides.nix @@ -0,0 +1,21 @@ +pkgs: + +self: super: + +{ + p4-16-mode = super.p4-16-mode.overrideAttrs { + # workaround https://github.com/NixOS/nixpkgs/issues/301795 + prePatch = '' + mkdir tmp-untar-dir + pushd tmp-untar-dir + + tar --extract --verbose --file=$src + content_directory=$(echo p4-16-mode-*) + cp --verbose $content_directory/p4-16-mode-pkg.el $content_directory/p4-pkg.el + src=$PWD/$content_directory.tar + tar --create --verbose --file=$src $content_directory + + popd + ''; + }; +} diff --git a/pkgs/applications/editors/emacs/elisp-packages/nongnu-devel-packages.nix b/pkgs/applications/editors/emacs/elisp-packages/nongnu-devel-packages.nix index 7b156aeaaa49..8cbcd0a71119 100644 --- a/pkgs/applications/editors/emacs/elisp-packages/nongnu-devel-packages.nix +++ b/pkgs/applications/editors/emacs/elisp-packages/nongnu-devel-packages.nix @@ -10,7 +10,11 @@ 3. Run `git commit -m "nongnu-devel-packages $(date -Idate)" -- nongnu-devel-generated.nix` */ -{ lib, buildPackages }: +{ + lib, + pkgs, + buildPackages, +}: self: let @@ -35,26 +39,15 @@ let super = imported; - overrides = { - p4-16-mode = super.p4-16-mode.overrideAttrs { - # workaround https://github.com/NixOS/nixpkgs/issues/301795 - prePatch = '' - mkdir tmp-untar-dir - pushd tmp-untar-dir + commonOverrides = import ./nongnu-common-overrides.nix pkgs; - tar --extract --verbose --file=$src - content_directory=$(echo p4-16-mode-*) - cp --verbose $content_directory/p4-16-mode-pkg.el $content_directory/p4-pkg.el - src=$PWD/$content_directory.tar - tar --create --verbose --file=$src $content_directory - - popd - ''; - }; - }; + overrides = self: super: { }; in - super // overrides + let + super' = super // (commonOverrides self super); + in + super' // (overrides self super') ); in diff --git a/pkgs/applications/editors/emacs/elisp-packages/nongnu-packages.nix b/pkgs/applications/editors/emacs/elisp-packages/nongnu-packages.nix index ce13179ca1ea..4466621b3926 100644 --- a/pkgs/applications/editors/emacs/elisp-packages/nongnu-packages.nix +++ b/pkgs/applications/editors/emacs/elisp-packages/nongnu-packages.nix @@ -12,7 +12,7 @@ To update the list of packages from nongnu (ELPA), */ -{ lib, buildPackages }: +{ lib, pkgs, buildPackages }: self: let @@ -29,24 +29,11 @@ self: let super = imported; - overrides = { - p4-16-mode = super.p4-16-mode.overrideAttrs { - # workaround https://github.com/NixOS/nixpkgs/issues/301795 - prePatch = '' - mkdir tmp-untar-dir - pushd tmp-untar-dir + commonOverrides = import ./nongnu-common-overrides.nix pkgs; - tar --extract --verbose --file=$src - content_directory=$(echo p4-16-mode-*) - cp --verbose $content_directory/p4-16-mode-pkg.el $content_directory/p4-pkg.el - src=$PWD/$content_directory.tar - tar --create --verbose --file=$src $content_directory + overrides = self: super: { }; - popd - ''; - }; - }; - - in super // overrides); + in + let super' = super // (commonOverrides self super); in super' // (overrides self super')); in generateNongnu { } diff --git a/pkgs/top-level/emacs-packages.nix b/pkgs/top-level/emacs-packages.nix index 837155a55407..968bf2a2800a 100644 --- a/pkgs/top-level/emacs-packages.nix +++ b/pkgs/top-level/emacs-packages.nix @@ -34,12 +34,12 @@ let }; mkNongnuDevelPackages = { pkgs, lib }: import ../applications/editors/emacs/elisp-packages/nongnu-devel-packages.nix { - inherit (pkgs) buildPackages; + inherit (pkgs) pkgs buildPackages; inherit lib; }; mkNongnuPackages = { pkgs, lib }: import ../applications/editors/emacs/elisp-packages/nongnu-packages.nix { - inherit (pkgs) buildPackages; + inherit (pkgs) pkgs buildPackages; inherit lib; };