2020-04-24 23:36:52 +00:00
|
|
|
{ config, lib, pkgs, ... }:
|
|
|
|
|
|
|
|
let
|
|
|
|
cfg = config.programs.vim;
|
|
|
|
in {
|
|
|
|
options.programs.vim = {
|
2024-05-15 15:35:15 +00:00
|
|
|
defaultEditor = lib.mkOption {
|
|
|
|
type = lib.types.bool;
|
2020-04-24 23:36:52 +00:00
|
|
|
default = false;
|
2024-04-21 15:54:59 +00:00
|
|
|
description = ''
|
2020-04-24 23:36:52 +00:00
|
|
|
When enabled, installs vim and configures vim to be the default editor
|
|
|
|
using the EDITOR environment variable.
|
|
|
|
'';
|
|
|
|
};
|
2020-10-16 20:44:37 +00:00
|
|
|
|
2024-05-15 15:35:15 +00:00
|
|
|
package = lib.mkPackageOption pkgs "vim" {
|
2024-01-02 11:29:13 +00:00
|
|
|
example = "vim-full";
|
2020-10-16 20:44:37 +00:00
|
|
|
};
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
2024-05-15 15:35:15 +00:00
|
|
|
config = lib.mkIf cfg.defaultEditor {
|
2020-10-16 20:44:37 +00:00
|
|
|
environment.systemPackages = [ cfg.package ];
|
2024-05-15 15:35:15 +00:00
|
|
|
environment.variables = { EDITOR = lib.mkOverride 900 "vim"; };
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
}
|