{
  lib,
  config,
  ...
}: let
  cfg = config.marleyos.programs.lazygit;
  has-delta = config.programs.git.delta.enable;
  has-difft = config.programs.git.difftastic.enable;
in {
  options.marleyos.programs.lazygit.enable = lib.mkEnableOption "lazygit";

  config = lib.mkIf cfg.enable {
    programs.lazygit = {
      enable = true;

      settings = {
        gui.nerdFontsVersion = 3;

        git.paging = {
          colorArg = "always";
          pager = lib.mkIf has-delta "delta --paging=never --features=arctic-fox";
          externalDiffCommand = lib.mkIf has-difft "difft --color=always --display=inline";
        };

        os.editPreset = "nvim-remote";
      };
    };

    home.shellAbbrs = {
      lzg = "lazygit";
    };
  };
}
