emacs, home-manager: theme is unable to be set when using package made with `emacsWithPackagesFromUsePackage`
Issue?
The module provided by Stylix for Emacs is trying to override the extraConfig provided by my custom Emacs package. This however fails as the latter takes precedence over Stylix, resulting in an unthemed Emacs.
Is this fixable?
I am guessing you can try an override, however an override will probably not work out because it overrides that part of the package, instead of [app/prep]ending to it. Maybe adding prev will fix this?
Example?
This is what is happening to me right now, however it could happen to more people.
The module provided by Stylix for Emacs is trying to override the extraConfig provided by my custom Emacs package.
This however fails as the latter takes precedence over Stylix, resulting in an unthemed Emacs.
This is a somewhat already acknowledged problem:
the use of
extraConfigmight cause other potentially related issues. As discussed in #159 (comment), it makes it harder to override options, and as discussed in #388 (comment), it makes it easier to accidentally override Stylix options.-- https://github.com/danth/stylix/issues/395
+1
Workaround for now:
programs.emacs = {
enable = true;
package = pkgs.emacsWithPackagesFromUsePackage {
config = pkgs.writeTextFile {
text = ''
${builtins.readFile <config file>}
#+begin_src emacs-lisp
${config.home-manager.users.<username>.programs.emacs.extraConfig}
#+end_src'';
name = "config.org";
};
alwaysTangle = true;
defaultInitFile = true;
package = pkgs.emacs-pgtk;
extraEmacsPackages = config.home-manager.users."<config file>".programs.emacs.extraPackages;
};
};
Is there any alternative if pkgs.callPackage was called?
@gusgibbon Thanks, your workaround worked like a charm for me!