diff options
author | babariviere <babathriviere@gmail.com> | 2019-09-14 22:11:28 +0200 |
---|---|---|
committer | babariviere <babathriviere@gmail.com> | 2019-09-15 16:05:02 +0200 |
commit | 659adfaf2767781f3f1a2dc6e1e3f5edaf24911c (patch) | |
tree | 5392c4d4370f21501612d33bebcdef41c05557a2 /pkgs/data/fonts/iosevka/default.nix | |
parent | 260761649bd857ea73eeb6cd21c7e6c9830d7215 (diff) | |
download | nixpkgs-659adfaf2767781f3f1a2dc6e1e3f5edaf24911c.tar nixpkgs-659adfaf2767781f3f1a2dc6e1e3f5edaf24911c.tar.gz nixpkgs-659adfaf2767781f3f1a2dc6e1e3f5edaf24911c.tar.bz2 nixpkgs-659adfaf2767781f3f1a2dc6e1e3f5edaf24911c.tar.lz nixpkgs-659adfaf2767781f3f1a2dc6e1e3f5edaf24911c.tar.xz nixpkgs-659adfaf2767781f3f1a2dc6e1e3f5edaf24911c.tar.zst nixpkgs-659adfaf2767781f3f1a2dc6e1e3f5edaf24911c.zip |
iosevka: 1.4.3 -> 2.3.0
Integrate new Iosevka build system. Add an extra arguments to add custom parameters (for example to map ligatures).
Diffstat (limited to 'pkgs/data/fonts/iosevka/default.nix')
-rw-r--r-- | pkgs/data/fonts/iosevka/default.nix | 40 |
1 files changed, 21 insertions, 19 deletions
diff --git a/pkgs/data/fonts/iosevka/default.nix b/pkgs/data/fonts/iosevka/default.nix index f7fce315e8c..b1c46ca08ac 100644 --- a/pkgs/data/fonts/iosevka/default.nix +++ b/pkgs/data/fonts/iosevka/default.nix @@ -8,7 +8,9 @@ design ? [], upright ? [], italic ? [], oblique ? [], family ? null, weights ? [], # Custom font set name. Required if any custom settings above. - set ? null + set ? null, + # Extra parameters. Can be used for ligature mapping. + extraParameters ? null }: assert (design != []) -> set != null; @@ -25,32 +27,33 @@ in let pname = if set != null then "iosevka-${set}" else "iosevka"; in let - version = "1.14.3"; + version = "2.3.0"; name = "${pname}-${version}"; src = fetchFromGitHub { owner = "be5invis"; repo ="Iosevka"; rev = "v${version}"; - sha256 = "0ba8hwxi88bp2jb9xfhk95nnlv8ykl74cv62xr4ybzm3b8ahpwqf"; + sha256 = "1qnbxhx9wvij9zia226mc3sy8j7bfsw5v1cvxvsbbwjskwqdamvv"; }; in with lib; -let unwords = concatStringsSep " "; in +let quote = str: "\"" + str + "\""; in +let toTomlList = list: "[" + (concatMapStringsSep ", " quote list) +"]"; in +let unlines = concatStringsSep "\n"; in let param = name: options: - if options != [] then "${name}='${unwords options}'" else null; - config = unwords (lib.filter (x: x != null) [ + if options != [] then "${name}=${toTomlList options}" else null; + config = unlines (lib.filter (x: x != null) [ + "[buildPlans.${pname}]" (param "design" design) (param "upright" upright) (param "italic" italic) (param "oblique" oblique) - (if family != null then "family='${family}'" else null) + (if family != null then "family=\"${family}\"" else null) (param "weights" weights) ]); - custom = design != [] || upright != [] || italic != [] || oblique != [] - || family != null || weights != []; in stdenv.mkDerivation { @@ -58,8 +61,10 @@ stdenv.mkDerivation { nativeBuildInputs = [ nodejs ttfautohint-nox otfcc ]; - passAsFile = [ "installPackageLock" ]; + passAsFile = [ "installPackageLock" "config" "extraParameters" ]; installPackageLock = installPackageLock ./package-lock.json; + config = config; + extraParameters = extraParameters; preConfigure = '' HOME=$TMPDIR @@ -70,21 +75,18 @@ stdenv.mkDerivation { configurePhase = '' runHook preConfigure - ${optionalString custom ''make custom-config set=${set} ${config}''} - - runHook postConfigure + ${optionalString (set != null) ''mv "$configPath" private-build-plans.toml''} + ${optionalString (extraParameters != null) ''cat "$extraParametersPath" >> parameters.toml''} ''; - makeFlags = lib.optionals custom [ "custom" "set=${set}" ]; + buildPhase = '' + npm run build -- ttf::${pname} + ''; installPhase = '' - runHook preInstall - fontdir="$out/share/fonts/$pname" install -d "$fontdir" install "dist/$pname/ttf"/* "$fontdir" - - runHook postInstall ''; enableParallelBuilding = true; @@ -98,6 +100,6 @@ stdenv.mkDerivation { ''; license = licenses.ofl; platforms = platforms.all; - maintainers = with maintainers; [ cstrahan jfrankenau ttuegel ]; + maintainers = with maintainers; [ cstrahan jfrankenau ttuegel babariviere ]; }; } |