-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Expose build function to make custom derivations #65
Comments
Not sure this is what you want, but you can build a single elisp package: nix build .#emacs-config.elispPackages.dash Exposing |
I want to compile my Also if I want to make these local sources packages how do I go about that? I saw you added something extra to However, if I defined a local source there nothing happened, and if I added that package to I want to:
The latter one I guess I could achieve by using custom recipes, but I would like to grab the source from the current flake. |
Now I've got your points. Thank you for your patience.
Byte-compiling (or native-compiling) I didn't work on it because I wasn't sure if it would be a good idea, but it is possible to add the feature from now.
You have to
Adding a recipe for a package means, if the package is specified in your init file, twist fetches source from somewhere specified in the recipe and build it. But you can override the source to anywhere by setting In your case, you can simply set Now I think the configuration API of |
@akirak So I finally got around to try this (the nixpkgs Relevant parts: {
emacs-config = prev.callPackage inputs.self {
buildElispPackage = (inputs.twist.lib.buildElispPackage final).override {
emacs = emacsPackage;
};
elispInputs = prev.lib.pipe final.emacs-env.elispPackages [
builtins.attrValues
(builtins.filter prev.lib.isDerivation)
];
};
} buildElispPackage {
ename = "config-init";
src = lib.sourceByRegex ./. [ "init.org" ];
files = [ "init.org" ];
lispFiles = [
"early-init.el"
"init.el"
];
inherit elispInputs;
nativeCompileAhead = true;
wantExtraOutputs = false;
errorOnWarn = true;
doTangle = false;
preBuild = ''
export HOME="$NIX_BUILD_TOP/.home"
mkdir -p "$HOME/.config/emacs"
emacs --batch --quick \
--load org \
*.org \
--funcall org-babel-tangle
rm *.org
ln -s ${tree-sitter}/lib "$HOME/.config/emacs/tree-sitter"
'';
meta = { };
} Regarding the interface, here are some thoughts:
All in all, really pleased with this, so thank you very much :) |
@terlar Thanks. I'll study your config to explore how I can improve the API. Regarding the defaults, I'm thinking of adding a convenient option to toggle |
It would be nice if the build function was exposed so one could make custom derivations:
https://github.com/emacs-twist/twist.nix/blob/master/pkgs/emacs/build/default.nix
The use case is that I want to build my configuration and not install it as a package but still would like to byte compile it. Perhaps the correct thing is to make packages out of this not sure, but at least that is what I am doing currently.
I have achieved this by a bit of a hack using the trivialBuild instead:
Then later it is used in custom packages:
The text was updated successfully, but these errors were encountered: