{
  pkgs,
  lib,
  config,
  ...
}: let
  cfg = config.mods.theme;
in {
  options.mods.theme = {
    enable = lib.mkEnableOption "enables stylix system theme";
    scheme = lib.mkOption {
      default = "gruvbox-dark-medium";
      description = "system color scheme";
      apply = value: "${pkgs.base16-schemes}/share/themes/${value}.yaml";
    };
    wallpaper = lib.mkOption {
      default = ./wallpaper.png;
      description = "desktop wallpaper";
    };
  };

  config = lib.mkIf cfg.enable {
    stylix = {
      enable = true;
      autoEnable = true;
      base16Scheme = cfg.scheme;
      image = cfg.wallpaper;
      cursor = {
        name = "phinger-cursors-light";
        package = pkgs.phinger-cursors;
        size = 16;
      };
      fonts = {
        monospace = {
          package = pkgs.nerd-fonts.commit-mono;
          name = "CommitMono Nerd Font";
        };
        emoji = {
          package = pkgs.noto-fonts-color-emoji;
          name = "OpenMoji Color";
        };
        serif = config.stylix.fonts.monospace;
        sansSerif = config.stylix.fonts.monospace;
      };
    };

    fonts.packages = with pkgs; [
      openmoji-color
      commit-mono
      nerd-fonts.commit-mono
    ];
  };
}
