Any emacs home manager config examples examples?

I’m trying to set up emacs here’s my bare bones config:

services.emacs.enable = true;

programs.emacs = {
    enable = true;
    package = pkgs.emacs;  # replace with pkgs.emacs-gtk, or a version provided by the community overlay if desired.
	extraPackages = epkgs: [ epkgs.dracula-theme ];
	extraConfig = ''
      (setq standard-indent 2)

issues are is that it isn’t making the tab indents two spaces and I’m trying to look around for examples to see what to do but there isn’t any

Can you check if the file is generated into ~/.config/emacs? Do you perhaps by any chance already have ~/.emacs.d. GNU Emacs have transitioned to the new folders, but if the old ones exist they will take precedence. I do have an Emacs configuration using home manager, but I’m also using a bunch of other tools to manage it, so it is probably not what you are looking for:

You can take a look at this repo. It’s based on the home-manager module emacs-init.

so is emacs looking at what’s inside of .emacs.d? there’s no .el files so do I take out the folder or do I do a different workaround?

programs.emacs.extraConfig doesn’t place configuration files under the home directory. It instead generates default.el, which is added to load-path by a launcher script generated by Home Manager.

default.el is the initialization script meant for use by downstream. Notably, it doesn’t load if inhibit-default-init is set.

interesting. I’ve been doing more and as it turns out it works fine on normal emacs but not on emacsclient. what seems to be the solution here?

I’m not sure because it works for me. Maybe this can help diagnose your problem:

  • Run M-x find-library and enter default.
  • Run M-x describe-variable and enter standard-indent.

for the first one there’s no default for the second it just brings me to a menu

btw I don’t have an init.el file do I have to have that for this problem to not exist anymore?

I prefer to keep the init.el outside Nix.
Nix (home-manager) merely installs the packages.
I use home.files module to install the dotfile.

1 Like

Do you by any chance use Emacs configuration frameworks like Doom Emacs? I forgot about this, but I use Doom Emacs and it disables the loading of default.el. I had to load it explicitly in my configuration.


I also keep my Emacs configuration outside of Nix. Well, mostly. But FWIW programs.emacs.extraConfig is useful when you need to refer to Nix store paths in your Emacs configuration.

1 Like

no I do not, I’m manually configuring. I might just use the other replies solution of having my emacs configuration outside of nix. It sucks but whtever

so install the packages , then configure everything in emacs standalone?

ok so I have installed doom emacs, and it’s still the same issue, so either it’s a nixos issue or systemd issue

Yes. Just a truckload of use-packages and voilà!

never mind it just worked