{
  config,
  lib,
  ...
}: {
  imports = [../home/sessionVariables];

  options.dotfiles.inputs.home-manager.xdg = {
    enable = lib.dotfiles.mkEnableOption;
    mimeApps.enable = lib.dotfiles.mkEnableOption;
    userDirs.enable = lib.dotfiles.mkEnableOption;
  };

  config = let
    cfg = config.dotfiles.inputs.home-manager.xdg;
  in {
    dotfiles.inputs.home-manager.home.sessionVariables = {
      TMPDIR.enable = true;
      enable = true;
    };

    xdg = {
      inherit (cfg) enable;

      mimeApps.enable = cfg.mimeApps.enable;

      userDirs = let
        personal = "${config.home.homeDirectory}/p";
      in
        lib.mkIf cfg.userDirs.enable {
          desktop = config.home.sessionVariables.TMPDIR;
          documents = config.home.sessionVariables.TMPDIR;
          download = config.home.sessionVariables.TMPDIR;
          music = "${personal}/music";
          pictures = "${personal}/images";
          publicShare = config.home.sessionVariables.TMPDIR;
          templates = config.home.sessionVariables.TMPDIR;
          videos = "${personal}/videos";
        };
    };
  };
}
