plexus / chemacs2

Emacs version switcher, improved
779 stars 47 forks source link

Support specifying a nix-generated elisp package bundle #54

Closed league closed 1 year ago

league commented 1 year ago

The nix package manager supports a flexible way to bundle sets of Emacs packages, including ahead-of-time native compilation. This change provides a simple mechanism for insinuating a nix elisp dependency bundle using chemacs, so that different nix package sets can be selected using --with-profile, along-side profiles using other package managers or distributions like Spacemacs/Doom.

plexus commented 1 year ago

Should this really be part of chemacs2? Would it be possible for people to do this in their own configs?

league commented 1 year ago

That's a good question, thanks. I think it would work in an individual profile's early-init, if that is also maintained by nix.

The feature I'd miss is being able to specify one-off package sets in a command-line S-expression using with-profile. I'm also thinking of offering a module in home-manager (the facility that manages dot files and user-level services with nix) that would allow multiple chemacs profiles to be specified, generating the .emacs-profiles.el.

But any of the above can also work by just applying a small patch to the stock chemacs2 init.el when nix installs it. So it's not much of an inconvenience at all if you prefer not to maintain it as part of chemacs2 (perfectly understandable). The only other factor might be to lend some visibility to this idea – “works with Nix!”

So yeah, no problem if you just prefer to close this! Thanks.

plexus commented 1 year ago

Sure, I'm ok with having this. People who want it can use it, for others it doesn't hurt.

You're using concat to build up file paths, would expand-file-name also work and be perhaps more idiomatic?

league commented 1 year ago

Yes, just changed it to expand-file-name. I think I selected concat initially because I didn't need the canonicalization features at all – the bundle path should always be /nix/store/blah-deps. But when it's specified on command-line, canonicalization may turn out to be useful after all – and then I don't have to worry about a missing or doubled-up separator. Thanks.

plexus commented 1 year ago

Thank you!