fresh-editor: add defaultEditor option

This commit is contained in:
Daru
2026-04-11 11:33:31 +02:00
committed by Robert Helgesson
parent fb821d6422
commit b0569dc6ec
+15
View File
@@ -28,6 +28,15 @@ in
example = literalExpression "[ pkgs.rust-analyzer ]";
description = "Extra package to add to fresh";
};
defaultEditor = mkOption {
type = types.bool;
default = false;
description = ''
Whether to configure {command}`fresh` as the default
editor using the {env}`EDITOR` and {env}`VISUAL`
environment variables.
'';
};
settings = mkOption {
inherit (jsonFormat) type;
default = { };
@@ -63,6 +72,12 @@ in
]
else
[ cfg.package ];
home.sessionVariables = mkIf cfg.defaultEditor {
EDITOR = "fresh";
VISUAL = "fresh";
};
xdg.configFile."fresh/config.json" = mkIf (cfg.settings != { }) {
source = jsonFormat.generate "config.json" cfg.settings;
};