From 21a675946347bca090e2e68bfb5b1677b6113cb2 Mon Sep 17 00:00:00 2001 From: Riley Inman Date: Mon, 8 Feb 2021 18:47:20 -0500 Subject: iosevka: 3.7.1 -> 4.5.0, revise build plan system --- pkgs/data/fonts/iosevka/default.nix | 70 +++++++++++++++++++++++++------------ 1 file changed, 48 insertions(+), 22 deletions(-) (limited to 'pkgs/data') diff --git a/pkgs/data/fonts/iosevka/default.nix b/pkgs/data/fonts/iosevka/default.nix index 0d998a4863ab8..cbdd309db5e55 100644 --- a/pkgs/data/fonts/iosevka/default.nix +++ b/pkgs/data/fonts/iosevka/default.nix @@ -1,31 +1,51 @@ { stdenv, lib, pkgs, fetchFromGitHub, nodejs, nodePackages, remarshal , ttfautohint-nox + # Custom font set options. + # See https://typeof.net/Iosevka/customizer + # Can be a raw TOML string, or a Nix attrset. -# Custom font set options. -# See https://github.com/be5invis/Iosevka#build-your-own-style -# Ex: -# privateBuildPlan = { -# family = "Iosevka Expanded"; -# -# design = [ -# "sans" -# "expanded" -# ]; -# }; + # Ex: + # privateBuildPlan = '' + # [buildPlans.iosevka-custom] + # family = "Iosevka Custom" + # spacing = "normal" + # serifs = "sans" + # + # [buildPlans.iosevka-custom.variants.design] + # capital-j = "serifless" + # + # [buildPlans.iosevka-custom.variants.italic] + # i = "tailed" + # ''; + + # Or: + # privateBuildPlan = { + # family = "Iosevka Custom"; + # spacing = "normal"; + # serifs = "sans"; + # + # variants = { + # design.capital-j = "serifless"; + # italic.i = "tailed"; + # }; + # } , privateBuildPlan ? null # Extra parameters. Can be used for ligature mapping. - # It must be a raw toml string. - # + # It must be a raw TOML string. + # Ex: - # [[iosevka.compLig]] - # unicode = 57808 # 0xe1d0 - # featureTag = 'XHS0' - # sequence = "+>" + # extraParameters = '' + # [[iosevka.compLig]] + # unicode = 57808 # 0xe1d0 + # featureTag = 'XHS0' + # sequence = "+>" + # ''; , extraParameters ? null # Custom font set name. Required if any custom settings above. , set ? null }: assert (privateBuildPlan != null) -> set != null; +assert (extraParameters != null) -> set != null; let # We don't know the attribute name for the Iosevka package as it @@ -54,15 +74,21 @@ stdenv.mkDerivation rec { ttfautohint-nox ]; - privateBuildPlanJSON = - builtins.toJSON { buildPlans.${pname} = privateBuildPlan; }; + buildPlan = + if builtins.isAttrs privateBuildPlan + then builtins.toJSON { buildPlans.${pname} = privateBuildPlan; } + else privateBuildPlan; + inherit extraParameters; - passAsFile = [ "privateBuildPlanJSON" "extraParameters" ]; + passAsFile = [ "buildPlan" "extraParameters" ]; configurePhase = '' runHook preConfigure - ${lib.optionalString (privateBuildPlan != null) '' - remarshal -i "$privateBuildPlanJSONPath" -o private-build-plans.toml -if json -of toml + ${lib.optionalString (builtins.isAttrs privateBuildPlan) '' + remarshal -i "$buildPlanPath" -o private-build-plans.toml -if json -of toml + ''} + ${lib.optionalString (builtins.isString privateBuildPlan) '' + cp "$buildPlanPath" private-build-plans.toml ''} ${lib.optionalString (extraParameters != null) '' echo -e "\n" >> params/parameters.toml -- cgit 1.4.1