{
  config,
  lib,
  pkgs,
  ...
}:

{
  imports = [ ];

  options.me = {
    latex.enable = lib.mkOption {
      type = lib.types.bool;
      default = false;
      example = true;
      description = "Whether we want to install latex.";
    };
  };

  config = lib.mkIf config.me.latex.enable {
    environment.systemPackages = with pkgs; [
      tex
    ];

    nixpkgs.overlays = [
      (final: prev: {
        tex = (
          pkgs.texlive.combine {
            inherit (pkgs.texlive)
              scheme-basic
              dvisvgm
              dvipng # for preview and export as html in org-mode
              wrapfig
              amsmath
              ulem
              hyperref
              capt-of
              svg # emacs org-mode pdf export
              catchfile # emacs org-mode pdf export
              xcolor # emacs org-mode pdf export
              transparent # emacs org-mode pdf export
              pgf # emacs org-mode pdf export
              minted # emacs org-mode pdf export code block highlighting
              upquote # emacs org-mode pdf export
              lineno # emacs org-mode pdf export
              beamer # emacs org-mode presentation pdf export
              ;
          }
        );
      })
    ];
  };
}
