emacs: Install plugins from nix repositories

Maybe I should also look in to removing melpa and ensure? I could maybe
also remove elpa itself potentially? This way I could make sure that
no extra packages are ever installed that are not directly managed
through Nix. But then it would be quite annyoing to use my config
for someone not using nix. For that purpose I could maybe look in
to supporting nix on non-nixos again maybe?
This commit is contained in:
caem 2025-04-05 22:44:21 +02:00
parent c1c2fc5cc0
commit af1d3f7592
Signed by: caem
GPG key ID: 69A830D03203405F
3 changed files with 22 additions and 13 deletions

View file

@ -1,20 +1,32 @@
{ pkgs, config, ... }: { pkgs, config, ... }:
let let
# Has to be >= 29.1 due to treesitter emacs-package = pkgs.emacs30-pgtk;
emacsPkg = "emacs30";
in { in {
services.emacs = { services.emacs = {
enable = true; enable = true;
package = pkgs."${emacsPkg}"; package = emacs-package;
defaultEditor = true; socketActivation.enable = true;
}; };
programs.emacs = { programs.emacs = {
enable = true; enable = true;
package = (pkgs."${emacsPkg}-pgtk".pkgs.withPackages (epkgs: [ package = emacs-package;
epkgs.treesit-grammars.with-all-grammars extraPackages = epkgs: with epkgs; [
])); treesit-grammars.with-all-grammars
vterm
paredit
nix-mode
meson-mode
rainbow-delimiters
darktooth-theme
smex
amx
# Why the fuck would you put a '+' in your package's name
(builtins.getAttr "ido-completing-read+" epkgs)
no-littering
treesit-auto
];
}; };
home.file."${config.xdg.configHome}/emacs".source = ./emacs.d; home.file."${config.xdg.configHome}/emacs".source = ./emacs.d;

View file

@ -6,9 +6,3 @@
(require 'package) (require 'package)
(add-to-list 'package-archives '("melpa" . "https://melpa.org/packages/")) (add-to-list 'package-archives '("melpa" . "https://melpa.org/packages/"))
(package-initialize) (package-initialize)
;; Doesn't exactly fit in here but it's the earliest we can call this
(use-package benchmark-init
:ensure t
:config
(add-hook 'after-init-hook 'benchmark-init/deactivate))

View file

@ -1,5 +1,8 @@
(use-package nix-mode (use-package nix-mode
:ensure t :ensure t
:mode ("\\.nix\\'" "\\.nix.in\\'") :mode ("\\.nix\\'" "\\.nix.in\\'")
:hook
(nix-mode . (lambda ()
(paredit-mode -1)))
:init :init
(global-nix-prettify-mode 1)) (global-nix-prettify-mode 1))