nixpkgs/nixos/modules/programs/vim.nix
h7x4 0a37316d6c
treewide: use mkPackageOption
This commit replaces a lot of usages of `mkOption` with the package
type, to be `mkPackageOption`, in order to reduce the amount of code.
2023-11-27 01:28:36 +01:00

28 lines
602 B
Nix

{ config, lib, pkgs, ... }:
with lib;
let
cfg = config.programs.vim;
in {
options.programs.vim = {
defaultEditor = mkOption {
type = types.bool;
default = false;
description = lib.mdDoc ''
When enabled, installs vim and configures vim to be the default editor
using the EDITOR environment variable.
'';
};
package = mkPackageOption pkgs "vim" {
example = "vim-full";
};
};
config = mkIf cfg.defaultEditor {
environment.systemPackages = [ cfg.package ];
environment.variables = { EDITOR = mkOverride 900 "vim"; };
};
}