{
  pkgs,
  lib,
  config,
  ...
}: let
  program = "xdg";
  cfg = config.dots.${program};
  home_dir = config.home.homeDirectory;
in {
  options.dots.${program} = {
    enable = lib.mkEnableOption "enables ${program}";
  };

  config = lib.mkIf cfg.enable {
    home.packages = with pkgs; [xdg-ninja ];

    xdg = {
        enable = true;

        configHome = "${home_dir}/.config";
        cacheHome = "${home_dir}/.cache";
        dataHome = "${home_dir}/.local/share";
        stateHome = "${home_dir}/.local/state";

        userDirs = {
          enable = true;
          # writes ~/.config/user-dirs.dirs
          desktop = "${home_dir}/desktop";
          download = "${home_dir}/downloads";
          documents = "${home_dir}/documents";
          pictures = "${home_dir}/pictures";
          videos = "${home_dir}/videos";
          music = "${home_dir}/music";
          publicShare = "${home_dir}/public";
          templates = "${home_dir}/templates";
        };

        mimeApps = {
          enable = true;
          defaultApplications = {
            "application/pdf" = ["org.pwmt.zathura.desktop"];
          };
        };        
      };

    # misc env variables to get things out of ~ (<3 xdg-ninja)
    home.sessionVariables = {
      GOPATH = "$XDG_DATA_HOME/go";
      _JAVA_OPTIONS = ''-Djava.util.prefs.userRoot="$XDG_CONFIG_HOME"/java'';
    };
  };
}
