aboutsummaryrefslogtreecommitdiff
path: root/modules/home-manager/emacs/default.nix
blob: 9d43d56ccdcad6bd9567bb0599defcfac5c22847 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
{ ... }:
{
	flake.modules.homeManager.emacs =
		{ pkgs, config, lib, ... }:
		let
			tex = (
				pkgs.texlive.combine {
					inherit (pkgs.texlive)
						scheme-medium
						dvisvgm
						dvipng # for preview and export as html
						# svg transparent
						etoolbox
						subfiles
						enumitem
						wrapfig
						amsmath
						ulem
						hyperref
						capt-of
						;
				}
			);
			myEmacs = (pkgs.emacsPackagesFor pkgs.emacs30).emacsWithPackages (
				# Packages listed here come from Nix; anything else in the config
				# is still installed by package.el (use-package-always-ensure)
				epkgs: with epkgs; [
					treesit-grammars.with-all-grammars
					# Not in nixpkgs; built here so nothing is cloned at startup
					(trivialBuild {
						pname = "trust-manager";
						version = "0-unstable-2026";
						src = pkgs.fetchFromGitHub {
							owner = "eshelyaron";
							repo = "trust-manager";
							rev = "0ff311bb59c9f1bb1ecdf413fa2bfa353bf389d7";
							hash = "sha256-hyWkMTCzIOdQ6NRjSdXAotEGsB76h2x5JvAg8X3fpug=";
						};
					})
					(trivialBuild {
						pname = "org-margin";
						version = "0.1.0";
						src = pkgs.fetchFromGitHub {
							owner = "rougier";
							repo = "org-margin";
							rev = "4013b59ff829903a7ab86b95593be71aa5c9b87d";
							hash = "sha256-2w9jc8Jd1McdyItqWJ+XXc62RIxsJ+Gro6Fi55EppY8=";
						};
					})
					ace-window
					consult
					corfu
					dashboard
					diminish
					direnv
					doom-themes
					ein
					eldoc-box
					embark
					embark-consult
					emms
					general
					glsl-mode
					haskell-mode
					helpful
					jabber
					kind-icon
					magit
					marginalia
					nerd-icons
					nix-mode
					orderless
					org-roam
					org-superstar
					pass
					posframe
					projectile
					rust-mode
					sudo-edit
					totp
					tree-sitter
					tree-sitter-langs
					treemacs
					treemacs-projectile
					typescript-mode
					typst-ts-mode
					vertico
					zoom-window
				]
			);
		in
		{
			# Config files are symlinked out of the store so they can be edited live
			home.file =
				let
					link = f: config.lib.file.mkOutOfStoreSymlink "${config.home.homeDirectory}/nixos-configuration/modules/home-manager/emacs/config/${f}";
				in
				{
					".emacs.d/init.el".source = link "init.el";
					".emacs.d/config".source = link "config";
					".emacs.d/lisp".source = link "lisp";
					".emacs.d/gnu.png".source = link "gnu.png";
				};

			services.emacs = {
				enable = true;
				package = myEmacs;
			};

			# Restart the daemon on switch when the package or the elisp changes
			systemd.user.services.emacs.Unit = {
				X-RestartIfChanged = lib.mkForce true;
				X-Restart-Triggers = [ "${./config}" ];
			};

			home.packages = with pkgs; [
				# mu
				# emacsPackages.mu4e
				# isync
				ispell
				poppler-utils
				tex
				ghostscript
				haskell-language-server
				myEmacs
			];
		};
}