{stdenv, fetchgit, bdftopcf, mkfontdir, mkfontscale}:

stdenv.mkDerivation rec {
  name = "curie-1.0";

  src = fetchgit {
    url = "https://github.com/NerdyPepper/curie";
    rev = "9edac64b06a544a4607f692672d64edf61158184";
    sha256 = "06wqwjdclp5rj8z7cig5n71bisn3ws4b2cxq1h7rzrwbkmz9sswr";
  };

  nativeBuildInputs = [ bdftopcf mkfontdir mkfontscale ];
  buildPhase = ''
    mv regular/*bdf .
    mv bold/*bdf .

    for i in *.bdf; do
        bdftopcf -o ''${i/bdf/pcf} $i
    done

    gzip -n *.pcf
  '';

  installPhase = ''
    fontDir="$out/share/fonts/misc"
    mkdir -p "$fontDir"
    mv *.pcf.gz "$fontDir"

    cd "$fontDir"
    mkfontdir
    mkfontscale
  '';

  meta = with stdenv.lib; {
    description = "A slightly upscaled version of scientifica";
    homepage = https://github.com/NerdyPepper/curie;
    license = lib.licences.ofl;
    maintainers = [ maintainers.jpotier ];
    platforms = platforms.unix;
  };
}