diff --git a/modules/programs/helix.nix b/modules/programs/helix.nix
index a240a71b..1f3e6249 100644
--- a/modules/programs/helix.nix
+++ b/modules/programs/helix.nix
@@ -18,6 +18,15 @@ in {
description = "The package to use for helix.";
};
+ defaultEditor = mkOption {
+ type = types.bool;
+ default = false;
+ description = ''
+ Whether to configure hx as the default
+ editor using the EDITOR environment variable.
+ '';
+ };
+
settings = mkOption {
type = tomlFormat.type;
default = { };
@@ -154,6 +163,8 @@ in {
config = mkIf cfg.enable {
home.packages = [ cfg.package ];
+ home.sessionVariables = mkIf cfg.defaultEditor { EDITOR = "hx"; };
+
xdg.configFile = let
settings = {
"helix/config.toml" = mkIf (cfg.settings != { }) {