summary refs log tree commit diff
path: root/pkgs/data/fonts
diff options
context:
space:
mode:
authorgithub-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>2021-02-12 06:16:24 +0000
committerGitHub <noreply@github.com>2021-02-12 06:16:24 +0000
commit1551e9d6ee20d2498352bfbb64c37ff71a47f489 (patch)
treeb3003621399712c8cb51f20c7a58b1d8fc57f976 /pkgs/data/fonts
parent344456f66a3f84bba46fa824a6f371447408e886 (diff)
parent21a675946347bca090e2e68bfb5b1677b6113cb2 (diff)
Merge master into staging-next
Diffstat (limited to 'pkgs/data/fonts')
-rw-r--r--pkgs/data/fonts/iosevka/default.nix70
1 files changed, 48 insertions, 22 deletions
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