Samuel Shuert | 02ffd1e | 2024-02-13 21:37:15 -0500 | [diff] [blame] | 1 | { |
| 2 | config, |
| 3 | lib, |
| 4 | pkgs, |
| 5 | ... |
| 6 | }: |
| 7 | { |
| 8 | options.chimera.editor.ed = { |
| 9 | enable = lib.mkEnableOption "Enable the standard text editor, the greatest WYGIWYG editor of all, the only viable text editor, Ed"; |
| 10 | defaultEditor = lib.mkOption { |
| 11 | type = lib.types.bool; |
| 12 | description = "Use Ed as the default editor"; |
| 13 | default = true; |
| 14 | }; |
Skyler Grey | e4da8cb | 2024-02-15 19:53:53 +0000 | [diff] [blame] | 15 | prompt = lib.mkOption { |
| 16 | type = lib.types.nullOr lib.types.str; |
| 17 | description = "What prompt should show up in command mode?"; |
| 18 | default = null; |
| 19 | example = ":"; |
| 20 | }; |
Samuel Shuert | 02ffd1e | 2024-02-13 21:37:15 -0500 | [diff] [blame] | 21 | }; |
| 22 | |
| 23 | config = lib.mkIf config.chimera.editor.ed.enable { |
| 24 | home.packages = [ pkgs.ed ]; |
| 25 | |
| 26 | home.sessionVariables = lib.mkIf config.chimera.editor.ed.defaultEditor { |
Skyler Grey | e4da8cb | 2024-02-15 19:53:53 +0000 | [diff] [blame] | 27 | EDITOR = "${pkgs.ed}/bin/ed${if config.chimera.editor.ed.prompt != null then " -p '${config.chimera.editor.ed.prompt}'" else ""}"; |
Samuel Shuert | 02ffd1e | 2024-02-13 21:37:15 -0500 | [diff] [blame] | 28 | }; |
| 29 | }; |
| 30 | } |