about summary refs log tree commit diff
path: root/nixos/modules/programs/vim.nix
diff options
context:
space:
mode:
Diffstat (limited to 'nixos/modules/programs/vim.nix')
-rw-r--r--nixos/modules/programs/vim.nix24
1 files changed, 24 insertions, 0 deletions
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"; };
+  };
+}