Split custom elisp packages to their own file

This commit is contained in:
Marien Zwart 2024-03-04 15:18:20 +11:00
parent 47e1bba41e
commit f2858f01a0
No known key found for this signature in database
2 changed files with 103 additions and 99 deletions

101
elisp-packages.nix Normal file
View file

@ -0,0 +1,101 @@
{
emacs,
eself,
esuper,
git,
makeWrapper,
}:
{
# Doom uses using emacs-straight/auctex, which still contains parts of
# upstream's build system but does not contain all .in files, resulting
# in a failed build if we attempt to use upstream's configure..
auctex = esuper.trivialBuild {
pname = "auctex";
version = "1";
meta = {
description = "build auctex from emacs-straight for Doom";
};
# TODO: figure out why this is necessary (there may be a better
# solution).
preBuild = ''
export HOME=$(mktemp -d)
'';
};
# Doom lets Straight provide org-autoloads.el as an alternative for
# org-loaddefs.el, and manually generates org-version.el.
# I currently run Org's build system.
# TODO: pass in ORGVERSION / GITVERSION (or provide a .git dir).
org = esuper.trivialBuild {
pname = "org";
version = "1";
meta = {
description = "build org-mode from emacs-straight repo for Doom";
};
buildInputs = [ ];
nativeBuildInputs = [ emacs makeWrapper ];
# XXX this sticks stuff in $out/emacs/etc/org (datadir in default.mk)
# that probably needs to go somewhere else.
# Possibly same for $out/share/info/.
configurePhase = ''
echo "prefix = $out" > local.mk
echo "lispdir = $out/share/emacs/site-lisp/org" >> local.mk
make config
'';
buildPhase = ''
runHook preBuild
make
runHook postBuild
'';
installPhase = ''
runHook preInstall
make install
runHook postInstall
'';
};
org-contrib = esuper.trivialBuild {
pname = "org-contrib";
version = "1";
meta = {
description = "build org-contrib from emacsmirror for Doom";
};
# Apply upstream fix for hard dependency on ess-custom.
# Straight just seems to ignore the byte-compilation failure(?).
patches = [ ./org-contrib-ob-stata-ess-optional.patch ];
# HACK around sources being in lisp/, which trivialBuild does not
# handle. Setting sourceDir would probably be more sane, but we
# need the original one for a patch to apply.
postPatch = ''
cd lisp
'';
};
sln-mode = esuper.trivialBuild {
pname = "sln-mode";
version = "1";
meta = {
description = "build sln-mode for doom with manual dependencies";
};
# Straight uses a recipe from el-get that specifiecs the font-lock-ext
# dependency.
buildInputs = [ eself.font-lock-ext ];
};
# Straight checks for git's presence at import time.
# We could probably get by with feeding it /bin/true or similar,
# but it seems not worth the risk.
straight = esuper.trivialBuild {
pname = "straight";
version = "1";
meta = {
description = "build straight with Git dependency added for Doom";
};
nativeBuildInputs = [ git ];
};
# Nix uses a Melpa recipe that assumes the upstream CMake repo layout.
# Doom uses emacsmirror and sets :files (:defaults "*").
cmake-mode = esuper.trivialBuild {
pname = "cmake-mode";
version = "1";
meta = {
description = "build cmake-mode from emacsmirror for Doom";
};
};
}

View file

@ -11,16 +11,12 @@
testing. */
full ? false,
autoreconfHook,
callPackages,
emacsPackagesFor,
fetchFromGitHub,
git,
lib,
linkFarm,
makeWrapper,
runCommand,
runtimeShell,
texliveBasic,
}:
let
inherit (lib) optional optionalAttrs optionalString;
@ -81,100 +77,7 @@ let
doomEmacsPackages = (emacsPackagesFor emacs).overrideScope (
eself: esuper:
let
customPackages = {
# Doom uses using emacs-straight/auctex, which still contains parts of
# upstream's build system but does not contain all .in files, resulting
# in a failed build if we attempt to use upstream's configure..
auctex = esuper.trivialBuild {
pname = "auctex";
version = "1";
meta = {
description = "build auctex from emacs-straight for Doom";
};
# TODO: figure out why this is necessary (there may be a better
# solution).
preBuild = ''
export HOME=$(mktemp -d)
'';
};
# Doom lets Straight provide org-autoloads.el as an alternative for
# org-loaddefs.el, and manually generates org-version.el.
# I currently run Org's build system.
# TODO: pass in ORGVERSION / GITVERSION (or provide a .git dir).
org = esuper.trivialBuild {
pname = "org";
version = "1";
meta = {
description = "build org-mode from emacs-straight repo for Doom";
};
buildInputs = [ ];
nativeBuildInputs = [ emacs makeWrapper ];
# XXX this sticks stuff in $out/emacs/etc/org (datadir in default.mk)
# that probably needs to go somewhere else.
# Possibly same for $out/share/info/.
configurePhase = ''
echo "prefix = $out" > local.mk
echo "lispdir = $out/share/emacs/site-lisp/org" >> local.mk
make config
'';
buildPhase = ''
runHook preBuild
make
runHook postBuild
'';
installPhase = ''
runHook preInstall
make install
runHook postInstall
'';
};
org-contrib = esuper.trivialBuild {
pname = "org-contrib";
version = "1";
meta = {
description = "build org-contrib from emacsmirror for Doom";
};
# Apply upstream fix for hard dependency on ess-custom.
# Straight just seems to ignore the byte-compilation failure(?).
patches = [ ./org-contrib-ob-stata-ess-optional.patch ];
# HACK around sources being in lisp/, which trivialBuild does not
# handle. Setting sourceDir would probably be more sane, but we
# need the original one for a patch to apply.
postPatch = ''
cd lisp
'';
};
sln-mode = esuper.trivialBuild {
pname = "sln-mode";
version = "1";
meta = {
description = "build sln-mode for doom with manual dependencies";
};
# Straight uses a recipe from el-get that specifiecs the font-lock-ext
# dependency.
buildInputs = [ eself.font-lock-ext ];
};
# Straight checks for git's presence at import time.
# We could probably get by with feeding it /bin/true or similar,
# but it seems not worth the risk.
straight = esuper.trivialBuild {
pname = "straight";
version = "1";
meta = {
description = "build straight with Git dependency added for Doom";
};
nativeBuildInputs = [ git ];
};
# Nix uses a Melpa recipe that assumes the upstream CMake repo layout.
# Doom uses emacsmirror and sets :files (:defaults "*").
cmake-mode = esuper.trivialBuild {
pname = "cmake-mode";
version = "1";
meta = {
description = "build cmake-mode from emacsmirror for Doom";
};
};
};
customPackages = callPackages ./elisp-packages.nix { inherit emacs esuper eself; };
makePackage = name: p:
assert lib.asserts.assertEachOneOf