1
0
Fork 1
mirror of https://github.com/NixOS/nixpkgs.git synced 2024-11-18 03:30:45 +00:00

emacs: factor out common overrides for elpa and nongnu packages (#341745)

This commit is contained in:
Lin Jian 2024-09-15 00:34:01 +08:00 committed by GitHub
commit dfc36088ba
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 103 additions and 119 deletions

View file

@ -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
'';
});
}

View file

@ -47,52 +47,16 @@ self: let
super = imported; super = imported;
overrides = { commonOverrides = import ./elpa-common-overrides.nix pkgs;
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
'';
});
overrides = self: super: {
pq = super.pq.overrideAttrs (old: { pq = super.pq.overrideAttrs (old: {
buildInputs = (old.buildInputs or [ ]) ++ [ pkgs.postgresql ]; 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); in elpaDevelPackages);

View file

@ -47,7 +47,9 @@ self: let
super = imported; super = imported;
overrides = { commonOverrides = import ./elpa-common-overrides.nix pkgs;
overrides = self: super: {
# upstream issue: Wrong type argument: arrayp, nil # upstream issue: Wrong type argument: arrayp, nil
org-transclusion = org-transclusion =
if super.org-transclusion.version == "1.2.0" 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 jinx = super.jinx.overrideAttrs (old: let
libExt = pkgs.stdenv.hostPlatform.extensions.sharedLibrary; libExt = pkgs.stdenv.hostPlatform.extensions.sharedLibrary;
in { 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); in elpaPackages);

View file

@ -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
'';
};
}

View file

@ -10,7 +10,11 @@
3. Run `git commit -m "nongnu-devel-packages $(date -Idate)" -- nongnu-devel-generated.nix` 3. Run `git commit -m "nongnu-devel-packages $(date -Idate)" -- nongnu-devel-generated.nix`
*/ */
{ lib, buildPackages }: {
lib,
pkgs,
buildPackages,
}:
self: self:
let let
@ -35,26 +39,15 @@ let
super = imported; super = imported;
overrides = { commonOverrides = import ./nongnu-common-overrides.nix pkgs;
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 overrides = self: super: { };
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
'';
};
};
in in
super // overrides let
super' = super // (commonOverrides self super);
in
super' // (overrides self super')
); );
in in

View file

@ -12,7 +12,7 @@ To update the list of packages from nongnu (ELPA),
*/ */
{ lib, buildPackages }: { lib, pkgs, buildPackages }:
self: let self: let
@ -29,24 +29,11 @@ self: let
super = imported; super = imported;
overrides = { commonOverrides = import ./nongnu-common-overrides.nix pkgs;
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 overrides = self: super: { };
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 in
''; let super' = super // (commonOverrides self super); in super' // (overrides self super'));
};
};
in super // overrides);
in generateNongnu { } in generateNongnu { }

View file

@ -34,12 +34,12 @@ let
}; };
mkNongnuDevelPackages = { pkgs, lib }: import ../applications/editors/emacs/elisp-packages/nongnu-devel-packages.nix { mkNongnuDevelPackages = { pkgs, lib }: import ../applications/editors/emacs/elisp-packages/nongnu-devel-packages.nix {
inherit (pkgs) buildPackages; inherit (pkgs) pkgs buildPackages;
inherit lib; inherit lib;
}; };
mkNongnuPackages = { pkgs, lib }: import ../applications/editors/emacs/elisp-packages/nongnu-packages.nix { mkNongnuPackages = { pkgs, lib }: import ../applications/editors/emacs/elisp-packages/nongnu-packages.nix {
inherit (pkgs) buildPackages; inherit (pkgs) pkgs buildPackages;
inherit lib; inherit lib;
}; };