2024-06-24 11:38:28 -04:00
|
|
|
# Basic system-wide text editor configuration.
|
2024-08-02 17:55:48 -04:00
|
|
|
{ config, lib, ... }:
|
2024-06-24 11:38:28 -04:00
|
|
|
|
|
|
|
let
|
|
|
|
cfg = config.aux.system.editor;
|
|
|
|
in
|
|
|
|
{
|
|
|
|
options = {
|
|
|
|
aux.system.editor = lib.mkOption {
|
|
|
|
description = "Selects the default text editor.";
|
|
|
|
default = "nano";
|
|
|
|
type = lib.types.enum [
|
|
|
|
"vim"
|
|
|
|
"nano"
|
|
|
|
"emacs"
|
|
|
|
];
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
config = lib.mkMerge [
|
|
|
|
(lib.mkIf (cfg == "emacs") {
|
|
|
|
services.emacs = {
|
|
|
|
enable = true;
|
|
|
|
defaultEditor = true;
|
|
|
|
};
|
|
|
|
})
|
|
|
|
(lib.mkIf (cfg == "nano") {
|
|
|
|
programs.nano = {
|
|
|
|
enable = true;
|
|
|
|
syntaxHighlight = true;
|
|
|
|
};
|
|
|
|
environment.variables."EDITOR" = "nano";
|
|
|
|
})
|
|
|
|
(lib.mkIf (cfg == "vim") { programs.vim.defaultEditor = true; })
|
|
|
|
];
|
|
|
|
}
|