diff --git a/modules/programs/kakoune.nix b/modules/programs/kakoune.nix
index 32f718909..55db23bd1 100644
--- a/modules/programs/kakoune.nix
+++ b/modules/programs/kakoune.nix
@@ -630,6 +630,15 @@ in {
description = "kakoune configuration options.";
};
+ defaultEditor = mkOption {
+ type = types.bool;
+ default = false;
+ description = ''
+ Whether to configure kak as the default
+ editor using the EDITOR environment variable.
+ '';
+ };
+
extraConfig = mkOption {
type = types.lines;
default = "";
@@ -654,6 +663,7 @@ in {
config = mkIf cfg.enable {
home.packages = [ kakouneWithPlugins ];
+ home.sessionVariables = mkIf cfg.defaultEditor { EDITOR = "kak"; };
xdg.configFile."kak/kakrc".source = configFile;
};
}