{ lib, stdenvNoCC, fetchFromGitHub }:

stdenvNoCC.mkDerivation {
  pname = "lexica-ultralegible";
  version = "1.0.0-unstable";

  src = fetchFromGitHub {
    owner = "jacobxperez";
    repo = "lexica-ultralegible";
    rev = "109729403ce6f5d9d74c6c6d8debc3380f3e3c10";
    hash = "sha256-+mHIsmj2TL/sUVxUBsIqTK6D6GLgK4DgaiU9PTkgmUA=";
  };

  installPhase = ''
    runHook preInstall

    install -Dm644 -t $out/share/fonts/opentype fonts/otf/*
    install -Dm644 -t $out/share/fonts/truetype fonts/ttf/*
    install -Dm644 -t $out/share/fonts/woff2 fonts/web/*

    runHook postInstall
  '';

  meta = with lib; {
    description = "Maintained version of Atkinson Hyperlegible";
    homepage = "https://jacobxperez.github.io/lexica-ultralegible/";
    license = licenses.ofl;
    platforms = platforms.all;
  };
}
