{ lib, stdenv, fetchFromGitHub, inkscape, xcursorgen }:

stdenv.mkDerivation rec {
  pname = "modernxp-cursor-theme";
  version = "1.0";

  src = fetchFromGitHub {
    owner = "na0miluv";
    repo = "modernXP-cursor-theme";
    rev = "main";
    sha256 = "sha256-1Pv+Ny1Gt7NM3cB038oQXb1cGIgg0VNxuO1IApTWo5U=";
  };

  nativeBuildInputs = [ inkscape xcursorgen ];

  buildPhase = ''
    bash build.sh
  '';

  installPhase = ''
    mkdir -p $out/share/icons/ModernXP
    cp -r dist/* $out/share/icons/ModernXP/
  '';

  meta = with lib; {
    description = "Windows XP cursor theme";
    homepage = "https://github.com/na0miluv/modernXP-cursor-theme";
    license = licenses.gpl3;
    platforms = platforms.linux;
  };
}

