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

let
  cfg = config.sydnix.dank-material-shell;
  json = pkgs.formats.json {};
in {
  options.sydnix.dank-material-shell = {
    enable = lib.mkEnableOption "DMS";
    settings = lib.mkOption {
      type = json.type;
      default = { };
      description = ''
        DankMaterialShell configuration settings as an attribute set,
        to be written to ~/.config/DankMaterialShell/settings.json.
      '';
    };
  };

  config = lib.mkIf cfg.enable {
    xdg.configFile = {
      "DankMaterialShell/settings.json".source =
        json.generate "settings.json" cfg.settings;
    };
  };
}
