Porting emacs config to Nixos (using home-manager)

Hello,

I’m in the process of switching to NixOS, and started porting my config. I decided to go with home-manager and I’m more or less following the recommendations found on this blog. However, I’m hitting a wall with emacs, for which many plugins are broken. Here is my current config and here is what I see on startup:

Loading /nix/store/gd16zhzic956appadcj80sf18an9h5d7-emacs-26.3/share/emacs/site-lisp/site-start.el (source)...done
Loading /home/corentin/.emacs.d/custom.el (source)...
Loading /home/corentin/.emacs.d/custom.el (source)...done
Key Chord mode on
[Treemacs] Warning: couldn’t find hl-line-mode’s background color for icons, falling back on unspecified-bg.
[Treemacs] Python3 not found, advanced git-mode and directory flattening features will be disabled.
Error (use-package): auto-dim-other-buffers/:init: Symbol’s function definition is void: auto-dim-other-buffers-mode
Error (use-package): company/:catch: Symbol’s function definition is void: company-tng-configure-default
Error (use-package): projectile/:init: Symbol’s function definition is void: projectile-mode
Error (use-package): flycheck/:init: Symbol’s function definition is void: global-flycheck-mode

I’m using the emacs overlay project to install the plugins, since I’ve seen it being recommended.

Does anyone know why these plugins are broken for me? I have also tries not using the emacs overlay, and install everything from MELPA (this is what I do on my non-NixOS machines) but most plugins failed to install :frowning:

I’m not sure what

Error (use-package): company/:catch: Symbol’s function definition is void: company-tng-configure-default

is about but the others I assume you can resolve by letting use-package know that the functions exists. E.g. for flycheck try changing

(use-package flycheck
  :init
  (global-flycheck-mode))

to

(use-package flycheck
  :commands global-flycheck-mode
  :init
  (global-flycheck-mode))
1 Like

Thanks you so much @rycee that fixes it !
Out of curiosity do you know why this happen only on NixOS?
I seems that I should have seen that on the other distros as well.

And thank you for home-manager, it is amazing!

1 Like

Unfortunately, I don’t know why that is. My knowledge of Emacs is limited to using it and hacking together a configuration that mostly works :slightly_smiling_face:

You might also like his emacs-init stuff. I love it.

1 Like