Skyler Grey | 098f19e | 2024-03-01 18:54:42 +0000 | [diff] [blame] | 1 | { pkgs, config, lib, ... }: |
Samuel Shuert | 02ffd1e | 2024-02-13 21:37:15 -0500 | [diff] [blame] | 2 | { |
| 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 Grey | cf4412a | 2024-02-25 13:53:55 +0000 | [diff] [blame] | 17 | client = { |
| 18 | enable = true; |
| 19 | arguments = [ "--create-frame" "--alternate-editor=${config.programs.emacs.package}/bin/emacs" ]; |
| 20 | }; |
Samuel Shuert | 02ffd1e | 2024-02-13 21:37:15 -0500 | [diff] [blame] | 21 | }; |
Skyler Grey | 098f19e | 2024-03-01 18:54:42 +0000 | [diff] [blame] | 22 | |
| 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 Shuert | 02ffd1e | 2024-02-13 21:37:15 -0500 | [diff] [blame] | 36 | }; |
| 37 | } |