blob: 6893369a4271c429ca17a7d6593d4250c3cca6f2 [file] [log] [blame]
Skyler Grey098f19e2024-03-01 18:54:42 +00001{ pkgs, config, lib, ... }:
Samuel Shuert02ffd1e2024-02-13 21:37:15 -05002{
3 options.chimera.editor.emacs = {
4 enable = lib.mkEnableOption "Enable emacs editor";
5 defaultEditor = lib.mkOption {
6 type = lib.types.bool;
7 description = "Use emacs as the default editor";
8 default = true;
9 };
10 };
11
12 config = lib.mkIf config.chimera.editor.emacs.enable {
13 programs.emacs.enable = true;
14 services.emacs = {
15 enable = true;
16 defaultEditor = config.chimera.editor.emacs.defaultEditor;
Skyler Greycf4412a2024-02-25 13:53:55 +000017 client = {
18 enable = true;
19 arguments = [ "--create-frame" "--alternate-editor=${config.programs.emacs.package}/bin/emacs" ];
20 };
Samuel Shuert02ffd1e2024-02-13 21:37:15 -050021 };
Skyler Grey098f19e2024-03-01 18:54:42 +000022
23 /* we already have emacsclient.desktop which starts emacs if the server is not up, so emacs.desktop only serves to get in the way */
24 home.packages = [
25 (lib.pipe {
26 "Desktop Entry" = {
27 Type = "Application";
28 NoDisplay = true;
29 };
30 } [
31 (lib.generators.toINI { })
32 (pkgs.writeTextDir "share/applications/emacs.desktop")
33 lib.hiPrio
34 ])
35 ];
Samuel Shuert02ffd1e2024-02-13 21:37:15 -050036 };
37}