2025-05-04 02:47:36 +02:00
|
|
|
{
|
|
|
|
|
pkgs,
|
|
|
|
|
config,
|
|
|
|
|
lib,
|
|
|
|
|
...
|
2025-05-18 16:36:06 +02:00
|
|
|
}:
|
|
|
|
|
with lib; let
|
2025-11-01 12:15:06 +01:00
|
|
|
emacsDefaultPackage = with pkgs; ((emacsPackagesFor emacs).emacsWithPackages (
|
2025-11-02 13:10:25 +01:00
|
|
|
epkgs:
|
|
|
|
|
with epkgs; [
|
|
|
|
|
mu4e
|
|
|
|
|
pdf-tools
|
|
|
|
|
tree-sitter
|
|
|
|
|
tree-sitter-langs
|
|
|
|
|
(treesit-grammars.with-grammars (grammar:
|
|
|
|
|
with grammar; [
|
|
|
|
|
tree-sitter-bash
|
|
|
|
|
tree-sitter-c
|
|
|
|
|
tree-sitter-cpp
|
|
|
|
|
tree-sitter-css
|
|
|
|
|
tree-sitter-dockerfile
|
|
|
|
|
tree-sitter-http
|
|
|
|
|
tree-sitter-javascript
|
|
|
|
|
tree-sitter-jsdoc
|
|
|
|
|
tree-sitter-json
|
|
|
|
|
tree-sitter-just
|
|
|
|
|
tree-sitter-markdown
|
|
|
|
|
tree-sitter-markdown-inline
|
|
|
|
|
tree-sitter-nix
|
|
|
|
|
tree-sitter-rust
|
|
|
|
|
tree-sitter-sql
|
|
|
|
|
tree-sitter-toml
|
|
|
|
|
tree-sitter-typescript
|
|
|
|
|
tree-sitter-typst
|
|
|
|
|
tree-sitter-vue
|
|
|
|
|
tree-sitter-yaml
|
|
|
|
|
]))
|
|
|
|
|
]
|
2025-05-04 02:47:36 +02:00
|
|
|
));
|
2025-07-27 22:50:25 +02:00
|
|
|
cfg = config.home.dev.editors.emacs;
|
2025-05-04 02:47:36 +02:00
|
|
|
in {
|
2025-07-27 22:50:25 +02:00
|
|
|
options.home.dev.editors.emacs = {
|
2025-05-15 15:19:59 +02:00
|
|
|
enable = mkEnableOption "enables Emacs";
|
|
|
|
|
package = mkOption {
|
|
|
|
|
type = types.package;
|
2025-05-04 02:47:36 +02:00
|
|
|
default = emacsDefaultPackage;
|
|
|
|
|
};
|
2025-05-15 15:19:59 +02:00
|
|
|
service = mkEnableOption "enables Emacs service";
|
|
|
|
|
mu4eMime = mkEnableOption "Enables mu4e to handle mailto scheme";
|
|
|
|
|
org-protocol = mkEnableOption "Enables org-protocol";
|
2025-05-04 02:47:36 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
config = {
|
2025-11-02 13:10:25 +01:00
|
|
|
home.packages = with pkgs; [
|
|
|
|
|
emacs-all-the-icons-fonts
|
|
|
|
|
emacs-lsp-booster
|
|
|
|
|
];
|
2025-05-15 15:19:59 +02:00
|
|
|
programs.emacs = mkIf cfg.enable {
|
2025-05-04 02:47:36 +02:00
|
|
|
enable = true;
|
|
|
|
|
inherit (cfg) package;
|
|
|
|
|
};
|
2025-05-15 15:19:59 +02:00
|
|
|
services.emacs = mkIf cfg.service {
|
2025-05-04 02:47:36 +02:00
|
|
|
enable = true;
|
|
|
|
|
inherit (cfg) package;
|
|
|
|
|
startWithUserSession = "graphical";
|
|
|
|
|
};
|
2025-05-15 15:19:59 +02:00
|
|
|
|
|
|
|
|
xdg.desktopEntries.mu4e = mkIf cfg.mu4eMime {
|
|
|
|
|
name = "mu4e";
|
|
|
|
|
genericName = "mu4e";
|
|
|
|
|
comment = "Maildir Utils for Emacs";
|
|
|
|
|
mimeType = ["x-scheme-handler/mailto"];
|
|
|
|
|
noDisplay = true;
|
|
|
|
|
exec = "${cfg.package}/bin/emacsclient -c -n -a ${cfg.package}/bin/emacs -e \"(browse-url-mail \\\"\\$*\\\")\"";
|
|
|
|
|
terminal = false;
|
|
|
|
|
categories = ["Network" "Email" "TextEditor" "Utility"];
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
xdg.desktopEntries.org-protocol = mkIf cfg.org-protocol {
|
|
|
|
|
name = "org-protocol";
|
|
|
|
|
exec = "${cfg.package}/bin/emacsclient -c -n -a ${cfg.package}/bin/emacs %u";
|
|
|
|
|
terminal = false;
|
|
|
|
|
noDisplay = true;
|
|
|
|
|
categories = ["System"];
|
|
|
|
|
mimeType = ["x-scheme-handler/org-protocol"];
|
|
|
|
|
};
|
2025-05-04 02:47:36 +02:00
|
|
|
};
|
|
|
|
|
}
|