1{ config, lib, pkgs, ... }:
2
3with lib;
4
5let
6 cfg = config.programs.vim;
7in {
8 options.programs.vim = {
9 defaultEditor = mkOption {
10 type = types.bool;
11 default = false;
12 description = ''
13 When enabled, installs vim and configures vim to be the default editor
14 using the EDITOR environment variable.
15 '';
16 };
17 };
18
19 config = mkIf cfg.defaultEditor {
20 environment.systemPackages = [ pkgs.vim ];
21 environment.variables = { EDITOR = mkOverride 900 "vim"; };
22 };
23}