programs.helix: add defaultEditor (#4127)

This commit is contained in:
Dany Marcoux 2023-06-21 15:50:13 +02:00 committed by GitHub
parent 9ce6977fe7
commit 50cb4d8a1e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -18,6 +18,15 @@ in {
description = "The package to use for helix.";
};
defaultEditor = mkOption {
type = types.bool;
default = false;
description = ''
Whether to configure <command>hx</command> as the default
editor using the <envar>EDITOR</envar> 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 != { }) {