{
  marleylib,
  config,
  osConfig,
  lib,
  pkgs,
  ...
}: let
  inherit (marleylib.module) mkEnableOption';

  cfg = config.marleyos.programs.neovim;
  osCfg = osConfig.marleyos.programs.neovim;
in {
  options.marleyos.programs.neovim.enable =
    mkEnableOption' "neovim" osCfg.enable;

  config = lib.mkIf cfg.enable {
    home.packages = with pkgs; [
      nvim
    ];

    home.sessionVariables = rec {
      EDITOR = "nvim";
      VISUAL = "${EDITOR}";
      SUDO_EDITOR = "${EDITOR}";
    };
  };
}
