Emacs configuration isn't applied

I’ve Emacs installed via Home Manager. When I start Emacs an error message is shown, and the configuration in programs.emacs.extraConfig isn’t applied.

This is an MWE of my Emacs config that fails

programs.emacs = {
  enable = true;
  extraPackages = epkgs: [
  extraConfig = ''
    (use-package nord-theme
      (load-theme 'nord t)

I don’t have any ~/.emacs file or a ~/.emacs.d directory. But the configuration in programs.emacs.extraConfig works flawlessly if I move its content to a new ~/.emacs file and rebuild the system.

Note the comment here.

I don’t use the home-manager support for my configuration, only its package resolution, so I’m not sure, but default.el should be resolved by default if it is present. Maybe try something a bit less complex than using use-package to see if that works, and check if the package is loaded, as well as whether default.el is present on the load path.

Looking at the docs for emacs here, it’s possible you’re disabling loading this config in an already existing config file?

Note that you can still set ~/.config/init.el with xdg.configFile or ~/.emacs with home.file, too, although that is probably best avoided.

You may also want to set use-package-always-ensure to nil and use-package-ensure-function to 'ignore, so that use-package and nix don’t end up fighting over packages.

I did that, but sometimes I got error messages, and sometimes not. Not sure what I did wrong :confused:

I’ve done that, and I couldn’t find any other configuration files.

This seems like the simplest option. I used xdg.configFile to create ~/.config/emacs/init.el, which works flawlessly.

Thanks for the tip! Done that now.