Unverified Commit cec62b8d authored by Weijia Wang's avatar Weijia Wang Committed by GitHub
Browse files

Merge pull request #213105 from wegank/fonts-9

treewide: convert 9 fonts to stdenvNoCC.mkDerivation
parents c14628ef 7562d1ed
Loading
Loading
Loading
Loading
+16 −13
Original line number Diff line number Diff line
# when changing this expression convert it from 'fetchzip' to 'stdenvNoCC.mkDerivation'
{ lib, fetchzip }:
{ lib, stdenvNoCC, fetchzip }:

let
stdenvNoCC.mkDerivation rec {
  pname = "source-code-pro";
  version = "2.038";
in (fetchzip {
  name = "source-code-pro-${version}";

  src = fetchzip {
    url = "https://github.com/adobe-fonts/source-code-pro/releases/download/${version}R-ro%2F1.058R-it%2F1.018R-VAR/OTF-source-code-pro-${version}R-ro-1.058R-it.zip";
    stripRoot = false;
    hash = "sha256-ijeTLka131jf6B9xj/eNWK1T5r7r3aBXBgnVyRAxmuY=";
  };

  installPhase = ''
    runHook preInstall

  sha256 = "027cf62zj27q7l3d4sqzdfgz423lzysihdg8cvmkk6z910a1v368";
    install -Dm644 *.otf -t $out/share/fonts/opentype

    runHook postInstall
  '';

  meta = {
    description = "Monospaced font family for user interface and coding environments";
@@ -17,9 +25,4 @@ in (fetchzip {
    homepage = "https://adobe-fonts.github.io/source-code-pro/";
    license = lib.licenses.ofl;
  };
}).overrideAttrs (_: {
  postFetch = ''
    mkdir -p $out/share/fonts
    unzip -j $downloadedFile \*.otf -d $out/share/fonts/opentype
  '';
})
}
+15 −14
Original line number Diff line number Diff line
# when changing this expression convert it from 'fetchzip' to 'stdenvNoCC.mkDerivation'
{ lib, fetchzip }:
{ lib, stdenvNoCC, fetchzip }:

let
stdenvNoCC.mkDerivation rec {
  pname = "source-han-code-jp";
  version = "2.012R";
in (fetchzip {
  name = "${pname}-${version}";
  version = "2.012";

  url = "https://github.com/adobe-fonts/${pname}/archive/${version}.zip";
  src = fetchzip {
    url = "https://github.com/adobe-fonts/${pname}/archive/${version}R.zip";
    hash = "sha256-ljO/1/CaE9Yj+AN5xxlIr30/nV/axGQPO0fGACAZGCQ=";
  };

  installPhase = ''
    runHook preInstall

  sha256 = "16y5as1k864ghy3vzp8svr3q0sw57rv53za3f48700ksvxz5pwry";
    install -Dm444 OTF/*.otf -t $out/share/fonts/opentype

    runHook postInstall
  '';

  meta = {
    description = "A monospaced Latin font suitable for coding";
@@ -18,9 +24,4 @@ in (fetchzip {
    homepage = "https://blogs.adobe.com/CCJKType/2015/06/source-han-code-jp.html";
    license = lib.licenses.ofl;
  };
}).overrideAttrs (_: {
  postFetch = ''
    mkdir -p $out/share/fonts
    unzip -j $downloadedFile \*.otf -d $out/share/fonts/opentype
  '';
})
}
+32 −24
Original line number Diff line number Diff line
# when changing this expression convert it from 'fetchzip' to 'stdenvNoCC.mkDerivation'
{ stdenvNoCC
, lib
, fetchzip
{ lib
, stdenvNoCC
, fetchurl
, unzip
}:

let
@@ -9,21 +9,37 @@ let
    { family
    , description
    , rev
    , sha256
    , postFetch ? ''
        install -m444 -Dt $out/share/fonts/opentype/source-han-${family} $downloadedFile
      ''
    , hash
    , zip ? ""
    }:
    let Family =
      lib.toUpper (lib.substring 0 1 family) +
      lib.substring 1 (lib.stringLength family) family;
    in
    (fetchzip {
      name = "source-han-${family}-${lib.removeSuffix "R" rev}";
    stdenvNoCC.mkDerivation rec {
      pname = "source-han-${family}";
      version = lib.removeSuffix "R" rev;

      src = fetchurl {
        url = "https://github.com/adobe-fonts/source-han-${family}/releases/download/${rev}/SourceHan${Family}.ttc${zip}";
      inherit sha256;
        inherit hash;
      };

      nativeBuildInputs = lib.optionals (zip == ".zip") [ unzip ];

      unpackPhase = lib.optionalString (zip == "") ''
        cp $src SourceHan${Family}.ttc${zip}
      '' + lib.optionalString (zip == ".zip") ''
        unzip $src
      '';

      installPhase = ''
        runHook preInstall

        install -Dm444 *.ttc -t $out/share/fonts/opentype/${pname}

        runHook postInstall
      '';

      meta = {
        description = "An open source Pan-CJK ${description} typeface";
@@ -31,18 +47,14 @@ let
        license = lib.licenses.ofl;
        maintainers = with lib.maintainers; [ taku0 emily ];
      };
    }).overrideAttrs (_: { inherit postFetch; });
    };
in
{
  sans = makePackage {
    family = "sans";
    description = "sans-serif";
    rev = "2.004R";
    sha256 = "052d17hvz435zc4r2y1p9cgkkgn0ps8g74mfbvnbm1pv8ykj40m9";
    postFetch = ''
      mkdir -p $out/share/fonts/opentype/source-han-sans
      unzip $downloadedFile -d $out/share/fonts/opentype/source-han-sans
    '';
    hash = "sha256-b1kRiprdpaf+Tp5rtTgwn34dPFQR+anTKvMqeVAbfk8=";
    zip = ".zip";
  };

@@ -50,11 +62,7 @@ in
    family = "serif";
    description = "serif";
    rev = "2.000R";
    sha256 = "0x3n6s4khdd6l0crwd7g9sjaqp8lkvksglhc7kj3cv80hldab9wp";
    postFetch = ''
      mkdir -p $out/share/fonts/opentype/source-han-serif
      unzip $downloadedFile -d $out/share/fonts/opentype/source-han-serif
    '';
    hash = "sha256-RDgywab7gwT+YBO7F1KJvKOv0E/3+7Zi/pQl+UDsGcM=";
    zip = ".zip";
  };

@@ -62,6 +70,6 @@ in
    family = "mono";
    description = "monospaced";
    rev = "1.002";
    sha256 = "010h1y469c21bjavwdmkpbwk3ny686inz8i062wh1dhcv8cnqk3c";
    hash = "sha256-DBkkSN6QhI8R64M2h2iDqaNtxluJZeSJYAz8x6ZzWME=";
  };
}
+18 −15
Original line number Diff line number Diff line
# when changing this expression convert it from 'fetchzip' to 'stdenvNoCC.mkDerivation'
{ lib, fetchzip }:
{ lib, stdenvNoCC, fetchzip }:

# Source Sans Pro got renamed to Source Sans 3 (see
# https://github.com/adobe-fonts/source-sans/issues/192). This is the
# last version named "Pro". It is useful for backward compatibility
# with older documents/templates/etc.
let
  version = "3.006";
in (fetchzip {

stdenvNoCC.mkDerivation rec {
  name = "source-sans-pro-${version}";
  version = "3.006";

  src = fetchzip {
    url = "https://github.com/adobe-fonts/source-sans/archive/${version}R.zip";
    hash = "sha256-1Savijgq3INuUN89MR0t748HOuGseXVw5Kd4hYwuVas=";
  };

  sha256 = "sha256-uWr/dFyLF65v0o6+oN/3RQoe4ziPspzGB1rgiBkoTYY=";
  installPhase = ''
    runHook preInstall

    install -Dm444 OTF/*.otf -t $out/share/fonts/opentype
    install -Dm444 TTF/*.ttf -t $out/share/fonts/truetype
    install -Dm444 VAR/*.otf -t $out/share/fonts/variable

    runHook postInstall
  '';

  meta = with lib; {
    homepage = "https://adobe-fonts.github.io/source-sans/";
@@ -21,11 +31,4 @@ in (fetchzip {
    platforms = platforms.all;
    maintainers = with maintainers; [ ttuegel ];
  };
}).overrideAttrs (_: {
  postFetch = ''
    mkdir -p $out/share/fonts/{opentype,truetype,variable}
    unzip -j $downloadedFile "*/OTF/*.otf" -d $out/share/fonts/opentype
    unzip -j $downloadedFile "*/TTF/*.ttf" -d $out/share/fonts/truetype
    unzip -j $downloadedFile "*/VAR/*.otf" -d $out/share/fonts/variable
  '';
})
}
+17 −15
Original line number Diff line number Diff line
# when changing this expression convert it from 'fetchzip' to 'stdenvNoCC.mkDerivation'
{ lib, fetchzip }:
{ lib, stdenvNoCC, fetchzip }:

let
stdenvNoCC.mkDerivation rec {
  pname = "source-sans";
  version = "3.046";
in (fetchzip {
  name = "source-sans-${version}";

  src = fetchzip {
    url = "https://github.com/adobe-fonts/source-sans/archive/${version}R.zip";
    hash = "sha256-nBLEK+T5n1CdZK2zvCWIhF2MxPmiAwL9l55a55yHtgU=";
  };

  installPhase = ''
    runHook preInstall

  sha256 = "1wxdinnliq0xqbjrs0sqykwaggkmyqawfq862d9xn05g1pnxda94";
    install -Dm444 OTF/*.otf -t $out/share/fonts/opentype
    install -Dm444 TTF/*.ttf -t $out/share/fonts/truetype
    install -Dm444 VAR/*.otf -t $out/share/fonts/variable

    runHook postInstall
  '';

  meta = with lib; {
    homepage = "https://adobe-fonts.github.io/source-sans/";
@@ -17,11 +26,4 @@ in (fetchzip {
    platforms = platforms.all;
    maintainers = with maintainers; [ ttuegel ];
  };
}).overrideAttrs (_: {
  postFetch = ''
    mkdir -p $out/share/fonts/{opentype,truetype,variable}
    unzip -j $downloadedFile "*/OTF/*.otf" -d $out/share/fonts/opentype
    unzip -j $downloadedFile "*/TTF/*.ttf" -d $out/share/fonts/truetype
    unzip -j $downloadedFile "*/VAR/*.otf" -d $out/share/fonts/variable
  '';
})
}
Loading