Chemacs2 flake usage example

Does anyone have a working example of using the chemacs2 flake in conjunction with home-manager to manage an Emacs configuration that includes Doom-Emacs, that they wouldn’t mind sharing?

1 Like

Haven’t tried it, but:

Looks like the options in chemacs.nix use options.programs.emacs.chemacs
chemacs2nix/chemacs.nix at 5d474b40d4a78dee6cd5f14c9ac8079f1aa6395e · league/chemacs2nix · GitHub

and the code under tests/ looks like HM configs using those options, e.g. chemacs2nix/various.nix at 5d474b40d4a78dee6cd5f14c9ac8079f1aa6395e · league/chemacs2nix · GitHub

The chemacs for doom is along the lines of:

...
("doom" . ((user-emacs-directory . "~/doom-emacs")
            (env . (("DOOMDIR" . "~/.config/doom")))))
...

The transliteration of which is:

config.program.emacs = {
    chemacs.profiles.doom = {
      userDir = "~/doom-emacs";
      env.DOOMDIR = "~/.config/doom";
    };
};

(And ~/.config/doom you could manage under xdg.configFile).

Where should you import the chemacs module that comes in the flake? In other words, how would you make the chemacs option available in config.program.emacs?

My best guess:

With the (undocumented?) extraModules option to homeManagerConfiguration.

In the flake.nix in that repo, it uses self.homeModule, but first thing I’d try would be to use an expression like chemacs2.homeModule; or otherwise try to refer to the chemacs.nix from that flake.

Another option maybe to somehow add the module to imports = [ ... ]; in your home.nix, (using the extraSpecialArgs to pass the chemacs flake in).

Hosted by Flying Circus.