From 8c21021f0f6132ba88205afb8357610f2bc6eb3b Mon Sep 17 00:00:00 2001 From: Michael Weiss Date: Mon, 10 Oct 2016 22:49:43 +0200 Subject: [PATCH] vim module: init --- nixos/modules/module-list.nix | 1 + nixos/modules/programs/vim.nix | 24 ++++++++++++++++++++++++ 2 files changed, 25 insertions(+) create mode 100644 nixos/modules/programs/vim.nix diff --git a/nixos/modules/module-list.nix b/nixos/modules/module-list.nix index 26e5d625848d..cadc907cadf6 100644 --- a/nixos/modules/module-list.nix +++ b/nixos/modules/module-list.nix @@ -84,6 +84,7 @@ ./programs/ssmtp.nix ./programs/tmux.nix ./programs/venus.nix + ./programs/vim.nix ./programs/wvdial.nix ./programs/xfs_quota.nix ./programs/xonsh.nix diff --git a/nixos/modules/programs/vim.nix b/nixos/modules/programs/vim.nix new file mode 100644 index 000000000000..8476c1accd31 --- /dev/null +++ b/nixos/modules/programs/vim.nix @@ -0,0 +1,24 @@ +{ config, lib, pkgs, ... }: + +with lib; + +let + cfg = config.programs.vim; +in { + options.programs.vim = { + defaultEditor = mkOption { + type = types.bool; + default = false; + example = true; + description = '' + When enabled, installs vim and configures vim to be the default editor + using the EDITOR environment variable. + ''; + }; + }; + + config = mkIf cfg.defaultEditor { + environment.systemPackages = [ pkgs.vim ]; + environment.variables = { EDITOR = mkOverride 900 "vim"; }; + }; +}