2016-10-10 22:49:43 +02:00
|
|
|
{ config, lib, pkgs, ... }:
|
|
|
|
|
|
|
|
with lib;
|
|
|
|
|
|
|
|
let
|
|
|
|
cfg = config.programs.vim;
|
|
|
|
in {
|
|
|
|
options.programs.vim = {
|
|
|
|
defaultEditor = mkOption {
|
|
|
|
type = types.bool;
|
|
|
|
default = false;
|
|
|
|
description = ''
|
|
|
|
When enabled, installs vim and configures vim to be the default editor
|
|
|
|
using the EDITOR environment variable.
|
|
|
|
'';
|
|
|
|
};
|
2020-10-15 10:55:16 +02:00
|
|
|
|
|
|
|
package = mkOption {
|
|
|
|
type = types.package;
|
|
|
|
default = pkgs.vim;
|
2021-10-03 18:06:03 +02:00
|
|
|
defaultText = literalExpression "pkgs.vim";
|
|
|
|
example = literalExpression "pkgs.vimHugeX";
|
2020-10-15 10:55:16 +02:00
|
|
|
description = ''
|
|
|
|
vim package to use.
|
|
|
|
'';
|
|
|
|
};
|
2016-10-10 22:49:43 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
config = mkIf cfg.defaultEditor {
|
2020-10-15 10:55:16 +02:00
|
|
|
environment.systemPackages = [ cfg.package ];
|
|
|
|
environment.variables = { EDITOR = mkOverride 900 "vim"; };
|
2016-10-10 22:49:43 +02:00
|
|
|
};
|
|
|
|
}
|