Skip to content
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

elisp.nix: add a param to include user config as a default init file #252

Merged

Conversation

jian-lin
Copy link
Member

@jian-lin jian-lin commented Oct 6, 2022

This is good for AOT native compilation of user config.

Besides being bool, the value of this new option can also be a derivation produced by pkgs.substituteAll, which avoids IFD comparing to directly setting that derivation to the config param.

cc @leungbk

@adisbladis
Copy link
Member

adisbladis commented Oct 10, 2022

Related issue comment: #106 (comment) (cc @lambdadog).

@jian-lin
Copy link
Member Author

jian-lin commented Oct 11, 2022

To be honest, I choose default.el just because it is what home-manager does.

After reading @lambdadog's comparison of 4 methods, I still think default.el is the one to use in this overlay because it is less invasive, causes fewer problems and is easiest to implement. The only "problem" (I do not think it is a problem to me that it is loaded after init.el) is that it cannot handle the cases where early-init.el is needed. But that's not a big deal to me.

My initial goal is to do AOT native-comp for my emacs config file. I cannot make it work when specifying my config using home-manager's extraConfig together with emacsWithPackagesFromUsePackage like:

{
  programs.emacs = {
    enable = true;
    extraConfig = "...";
    package = pkgs.emacsWithPackagesFromUsePackage { ... };
  };
}

I guess it's because what home-manager thinks is emacs is actually a wrapper of emacs made by emacsWithPackagesFromUsePackage, and for that to work, a horrible hack can be to change lib.optionalAttrs (emacs.nativeComp or false) to lib.optionalAttrs (emacs.emacs.nativeComp or emacs.nativeComp or false) in generic.nix. So I choose to implement this pr, which is more elegant in my opinion.

Please note that, currently my implementation does not support org files and I do not have strong interest to support it since I do not use it myself. I suppose it's fine to leave that for future contributors and merge this pr for now. But if that support is needed to get this merged, please let me know and I might try to implement that, not a priority for me though.

elisp.nix Outdated Show resolved Hide resolved
elisp.nix Outdated Show resolved Hide resolved
elisp.nix Outdated Show resolved Hide resolved
@jian-lin jian-lin force-pushed the do-aot-nativecomp-for-config-file branch from 5bc29f0 to 63c751e Compare October 15, 2022 08:12
@jian-lin jian-lin requested a review from leungbk October 15, 2022 08:12
This is good for AOT native compilation of user config.

Besides being bool, the value of this new option can also be a
derivation produced by pkgs.substituteAll, which avoids IFD comparing
to directly setting that derivation to the config param.
@jian-lin jian-lin force-pushed the do-aot-nativecomp-for-config-file branch from 63c751e to 57ee1ea Compare October 15, 2022 08:30
@leungbk leungbk merged commit 08445dd into nix-community:master Oct 15, 2022
@leungbk
Copy link
Member

leungbk commented Oct 15, 2022

Thanks!

@jian-lin jian-lin deleted the do-aot-nativecomp-for-config-file branch October 17, 2022 11:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants