2016-10-10 20:49:43 +00:00
|
|
|
{ config, lib, pkgs, ... }:
|
|
|
|
|
|
|
|
with lib;
|
|
|
|
|
|
|
|
let
|
|
|
|
cfg = config.programs.vim;
|
|
|
|
in {
|
|
|
|
options.programs.vim = {
|
|
|
|
defaultEditor = mkOption {
|
|
|
|
type = types.bool;
|
|
|
|
default = false;
|
2022-07-28 21:19:15 +00:00
|
|
|
description = lib.mdDoc ''
|
2016-10-10 20:49:43 +00:00
|
|
|
When enabled, installs vim and configures vim to be the default editor
|
|
|
|
using the EDITOR environment variable.
|
|
|
|
'';
|
|
|
|
};
|
2020-10-15 08:55:16 +00:00
|
|
|
|
|
|
|
package = mkOption {
|
|
|
|
type = types.package;
|
|
|
|
default = pkgs.vim;
|
2021-10-03 16:06:03 +00:00
|
|
|
defaultText = literalExpression "pkgs.vim";
|
2022-12-14 13:25:30 +00:00
|
|
|
example = literalExpression "pkgs.vim-full";
|
2022-07-28 21:19:15 +00:00
|
|
|
description = lib.mdDoc ''
|
2020-10-15 08:55:16 +00:00
|
|
|
vim package to use.
|
|
|
|
'';
|
|
|
|
};
|
2016-10-10 20:49:43 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
config = mkIf cfg.defaultEditor {
|
2020-10-15 08:55:16 +00:00
|
|
|
environment.systemPackages = [ cfg.package ];
|
|
|
|
environment.variables = { EDITOR = mkOverride 900 "vim"; };
|
2016-10-10 20:49:43 +00:00
|
|
|
};
|
|
|
|
}
|