feat: add default editor option and configuration

This commit is contained in:
Youwen Wu 2024-12-24 20:55:07 -08:00
parent f889514d7d
commit 2823e5284e
Signed by: youwen5
GPG key ID: 865658ED1FE61EC3
3 changed files with 12 additions and 4 deletions

View file

@ -19,6 +19,7 @@
liminalOS = {
flakeLocation = "/home/youwen/.config/liminalOS";
config.allowUnfree = true;
defaultEditor = inputs.viminal.packages.${pkgs.system}.default;
system = {
audio.prod.enable = true;
networking = {

View file

@ -84,10 +84,6 @@ in
inputs.viminal.packages.${pkgs.system}.default
];
environment.variables = {
EDITOR = "nvim";
};
# tells electron apps to use Wayland
environment.sessionVariables = lib.mkIf cfg.waylandFixes {
NIXOS_OZONE_WL = "1";

View file

@ -50,6 +50,11 @@ in
default = true;
description = "Whether to use the en_US locale automatically";
};
defaultEditor = lib.mkOption {
type = lib.types.nullOr lib.types.package;
default = pkgs.neovim;
description = "Default text editor that will be installed and set as $EDITOR. Set to null to disable setting and installing default text editor.";
};
};
config = {
@ -86,6 +91,12 @@ in
)
);
environment.variables.EDITOR = lib.mkIf (
cfg.defaultEditor != null
) cfg.defaultEditor.meta.mainProgram;
environment.systemPackages = lib.mkIf (cfg.defaultEditor != null) [ cfg.defaultEditor ];
# Select internationalisation properties.
i18n = lib.mkIf cfg.useEnUsLocale {
defaultLocale = "en_US.UTF-8";