You can also write the Emacs configuration in Nix itself, which has the benefit that you can refer to programs the Nix way (e.g. "${somepackage}/bin/somebinary") and that you can integrate Emacs configuration with home-manager modules (so, that e.g. your Rust specific configuration is only added to the Emacs configuration when your Rust module is enabled).
I did this by first copying rycee’s emacs-init module, extending it with some functionality that I needed:
You can also write the Emacs configuration in Nix itself, which has the benefit that you can refer to programs the Nix way (e.g.
"${somepackage}/bin/somebinary"
) and that you can integrate Emacs configuration with home-manager modules (so, that e.g. your Rust specific configuration is only added to the Emacs configuration when your Rust module is enabled).I did this by first copying rycee’s
emacs-init
module, extending it with some functionality that I needed:https://github.com/danieldk/nix-home/blob/93b11b64a5e18e2f86bc85454f958996dcc492ac/home/modules/emacs-init.nix
My base Emacs configuration in Nix:
https://github.com/danieldk/nix-home/blob/93b11b64a5e18e2f86bc85454f958996dcc492ac/home/cfg/emacs.nix
Example of module-specific configurations:
https://github.com/danieldk/nix-home/blob/93b11b64a5e18e2f86bc85454f958996dcc492ac/home/cfg/rust.nix#L11 https://github.com/danieldk/nix-home/blob/93b11b64a5e18e2f86bc85454f958996dcc492ac/home/cfg/go.nix#L10
I do something similar and really like how this makes the configuration more portable.
Also worth mentioning is the emacs-overlay which, among other tings, provides daily generations of MELPA.