Nix & Emacs

Last week I posted about now I moved to Nix and the ways that it is different from the typical Linux distribution. One of the things that changed for my installations was the way that I manage Emacs packages.

ELPA and MELPA packages as available as part of the distribution. Thanks to that effort, I can install Emacs and ensure that I have all of the additional tools that I want installed at the same time.

{
  programs.emacs = {
    enable = true;
    extraPackages = epkgs : [
      epkgs.magit
      epkgs.nix-mode
      ...
    ];
  };
}

Installing additional packages this way means that I do not need to rely on use-package to download them when Emacs starts up. I can however still take advantage of use-package on in my configuration that way when I use another machine, like my work computer, everything will still work. Since the package is installed, and loaded into Emacs ensure: t will do nothing on Nix.

(use-package vertico
  :ensure t
  :bind (:map vertico-map
	 ("C-j" . vertico-next)
	 ("C-k" . vertico-previous)
	 ("C-f" . vertico-exit)
	 :map minibuffer-local-map
	 ("M-h" . backward-kill-word))
  :custom
  (vertico-cycle t)
  :init
  (vertico-mode))