diff options
Diffstat (limited to 'nixpkgs/pkgs/data/fonts/iosevka')
-rw-r--r-- | nixpkgs/pkgs/data/fonts/iosevka/bin.nix | 39 | ||||
-rw-r--r-- | nixpkgs/pkgs/data/fonts/iosevka/default.nix | 139 | ||||
-rw-r--r-- | nixpkgs/pkgs/data/fonts/iosevka/node.nix | 17 | ||||
-rwxr-xr-x | nixpkgs/pkgs/data/fonts/iosevka/update-bin.sh | 28 | ||||
-rwxr-xr-x | nixpkgs/pkgs/data/fonts/iosevka/update-default.sh | 21 | ||||
-rw-r--r-- | nixpkgs/pkgs/data/fonts/iosevka/variants.nix | 26 |
6 files changed, 270 insertions, 0 deletions
diff --git a/nixpkgs/pkgs/data/fonts/iosevka/bin.nix b/nixpkgs/pkgs/data/fonts/iosevka/bin.nix new file mode 100644 index 000000000000..26d67ba170e1 --- /dev/null +++ b/nixpkgs/pkgs/data/fonts/iosevka/bin.nix @@ -0,0 +1,39 @@ +{ stdenv, lib, fetchurl, iosevka, unzip +, variant ? "" +}: + +let + name = "iosevka" + lib.optionalString (variant != "") "-" + variant; + + variantHashes = import ./variants.nix; + validVariants = map (lib.removePrefix "iosevka-") + (builtins.attrNames (builtins.removeAttrs variantHashes [ "iosevka" ])); +in stdenv.mkDerivation rec { + pname = "${name}-bin"; + version = "5.0.5"; + + src = fetchurl { + url = "https://github.com/be5invis/Iosevka/releases/download/v${version}/ttc-${name}-${version}.zip"; + sha256 = variantHashes.${name} or (throw '' + No such variant "${variant}" for package iosevka-bin. + Valid variants are: ${lib.concatStringsSep ", " validVariants}. + ''); + }; + + nativeBuildInputs = [ unzip ]; + + phases = [ "unpackPhase" ]; + + unpackPhase = '' + mkdir -p $out/share/fonts + unzip -d $out/share/fonts/truetype $src + ''; + + meta = iosevka.meta // { + maintainers = with lib.maintainers; [ + cstrahan + ]; + }; + + passthru.updateScript = ./update-bin.sh; +} diff --git a/nixpkgs/pkgs/data/fonts/iosevka/default.nix b/nixpkgs/pkgs/data/fonts/iosevka/default.nix new file mode 100644 index 000000000000..04e5b48bd0bd --- /dev/null +++ b/nixpkgs/pkgs/data/fonts/iosevka/default.nix @@ -0,0 +1,139 @@ +{ stdenv, lib, 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. + + # 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. + + # Ex: + # 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 + # changes not when our update script is run (which in turn updates + # node-packages.json, but when node-packages/generate.sh is run + # (which updates node-packages.nix). + # + # Doing it this way ensures that the package can always be built, + # although possibly an older version than ioseva-bin. + nodeIosevka = ( + lib.findSingle + (drv: drv ? packageName && drv.packageName == "iosevka") + (throw "no 'iosevka' package found in nodePackages") + (throw "multiple 'iosevka' packages found in nodePackages") + (lib.attrValues nodePackages) + ).override (drv: { dontNpmInstall = true; }); +in +stdenv.mkDerivation rec { + pname = if set != null then "iosevka-${set}" else "iosevka"; + inherit (nodeIosevka) version src; + + nativeBuildInputs = [ + nodejs + nodeIosevka + remarshal + ttfautohint-nox + ]; + + buildPlan = + if builtins.isAttrs privateBuildPlan + then builtins.toJSON { buildPlans.${pname} = privateBuildPlan; } + else privateBuildPlan; + + inherit extraParameters; + passAsFile = [ "buildPlan" "extraParameters" ]; + + configurePhase = '' + runHook preConfigure + ${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 + cat "$extraParametersPath" >> params/parameters.toml + ''} + ln -s ${nodeIosevka}/lib/node_modules/iosevka/node_modules . + runHook postConfigure + ''; + + buildPhase = '' + runHook preBuild + npm run build --no-update-notifier -- --jCmd=$NIX_BUILD_CORES ttf::$pname >/dev/null + runHook postBuild + ''; + + installPhase = '' + runHook preInstall + fontdir="$out/share/fonts/truetype" + install -d "$fontdir" + install "dist/$pname/ttf"/* "$fontdir" + runHook postInstall + ''; + + enableParallelBuilding = true; + + passthru = { + updateScript = ./update-default.sh; + }; + + meta = with lib; { + homepage = "https://be5invis.github.io/Iosevka"; + downloadPage = "https://github.com/be5invis/Iosevka/releases"; + description = '' + Slender monospace sans-serif and slab-serif typeface inspired by Pragmata + Pro, M+ and PF DIN Mono, designed to be the ideal font for programming. + ''; + license = licenses.ofl; + platforms = platforms.all; + maintainers = with maintainers; [ + cstrahan + jfrankenau + ttuegel + babariviere + rileyinman + AluisioASG + ]; + }; +} diff --git a/nixpkgs/pkgs/data/fonts/iosevka/node.nix b/nixpkgs/pkgs/data/fonts/iosevka/node.nix new file mode 100644 index 000000000000..0983d3e127be --- /dev/null +++ b/nixpkgs/pkgs/data/fonts/iosevka/node.nix @@ -0,0 +1,17 @@ +# This file has been generated by node2nix 1.7.0. Do not edit! + +{pkgs ? import <nixpkgs> { + inherit system; + }, system ? builtins.currentSystem, nodejs ? pkgs."nodejs-8_x"}: + +let + nodeEnv = import ../../../development/node-packages/node-env.nix { + inherit (pkgs) stdenv python2 utillinux runCommand writeTextFile; + inherit nodejs; + libtool = if pkgs.stdenv.isDarwin then pkgs.darwin.cctools else null; + }; +in +import ./node-packages.nix { + inherit (pkgs) fetchurl fetchgit; + inherit nodeEnv; +} \ No newline at end of file diff --git a/nixpkgs/pkgs/data/fonts/iosevka/update-bin.sh b/nixpkgs/pkgs/data/fonts/iosevka/update-bin.sh new file mode 100755 index 000000000000..a402f152d8a1 --- /dev/null +++ b/nixpkgs/pkgs/data/fonts/iosevka/update-bin.sh @@ -0,0 +1,28 @@ +#! /usr/bin/env nix-shell +#! nix-shell -i bash -p curl jq + +set -euo pipefail +cd "$(dirname "${BASH_SOURCE[0]}")" + +release=$(curl -s https://api.github.com/repos/be5invis/Iosevka/releases/latest) + +oldVersion=$(nix-instantiate --eval -E 'with import ../../../.. {}; lib.getVersion iosevka-bin' | tr -d '"') +version=$(echo "$release" | jq -r .tag_name | tr -d v) + +if test "$oldVersion" = "$version"; then + echo "New version same as old version, nothing to do." >&2 + exit 0 +fi + +sed -i "s/$oldVersion/$version/" bin.nix + +{ + echo '# This file was autogenerated. DO NOT EDIT!' + echo '{' + for asset in $(echo "$release" | jq -r '.assets[].name | select(startswith("ttc"))'); do + printf ' %s = "%s";\n' \ + $(echo "$asset" | sed -r "s/^ttc-(.*)-$version.zip$/\1/") \ + $(nix-prefetch-url "https://github.com/be5invis/Iosevka/releases/download/v$version/$asset") + done + echo '}' +} >variants.nix diff --git a/nixpkgs/pkgs/data/fonts/iosevka/update-default.sh b/nixpkgs/pkgs/data/fonts/iosevka/update-default.sh new file mode 100755 index 000000000000..208ea6101ac2 --- /dev/null +++ b/nixpkgs/pkgs/data/fonts/iosevka/update-default.sh @@ -0,0 +1,21 @@ +#!/usr/bin/env nix-shell +#!nix-shell -i bash -p common-updater-scripts coreutils gawk replace +set -euo pipefail +cd "$(dirname "${BASH_SOURCE[0]}")" + +nixpkgs=../../../.. +repo=https://github.com/be5invis/Iosevka + +# Discover the latest version. +current_version=$(nix-instantiate "$nixpkgs" --eval --strict -A iosevka.version | tr -d '"') +new_version=$(list-git-tags "$repo" | sort --reverse --version-sort | awk 'match($0, /^v([0-9.]+)$/, m) { print m[1]; exit; }') +if [[ "$new_version" == "$current_version" ]]; then + echo "iosevka: no update found" + exit +fi + +# Update the source package in nodePackages. +current_source="$repo/archive/v$current_version.tar.gz" +new_source="$repo/archive/v$new_version.tar.gz" +replace-literal -ef "$current_source" "$new_source" ../../../development/node-packages/node-packages.json +echo "iosevka: $current_version -> $new_version (after nodePackages update)" diff --git a/nixpkgs/pkgs/data/fonts/iosevka/variants.nix b/nixpkgs/pkgs/data/fonts/iosevka/variants.nix new file mode 100644 index 000000000000..6c31d3edb742 --- /dev/null +++ b/nixpkgs/pkgs/data/fonts/iosevka/variants.nix @@ -0,0 +1,26 @@ +# This file was autogenerated. DO NOT EDIT! +{ + iosevka = "1fva80sxdcmsl8y3m23ndif3ff54if37g1xqpda1f13yrbd9ii8q"; + iosevka-aile = "0fy58yd17k8k41j5f48572d4vad3zz7c2mbc6vsiii9abfkwwalr"; + iosevka-curly = "1lxw8na3qvc5g04prczl7qprdkvd0zf91ybmv276dnkq27abnjn4"; + iosevka-curly-slab = "19b6xr5vjnb20j34x2ynfji63qibczn0mm2j76d01py304839bws"; + iosevka-etoile = "0fhcn69idb6w8abpmmvpdp9c08zdhy0zwn8nbyy9jcznwj8vwb7m"; + iosevka-slab = "0jlm3l13p9c965zx6z4df65lzxzj9yjjvpwlnx94ipayinxa1iff"; + iosevka-ss01 = "1i6bvslpxj87p3xi198l486ba40ixicdkmj29vcb1d7w1hhr6wnm"; + iosevka-ss02 = "1raczi1ja4barvjg5cp3j96kyph4aj8qlp9i10q7835sy29q3285"; + iosevka-ss03 = "0cn9hi5w9rx8xhbh9a75c7s9pxa3dkqfhd24lbp72hwfgv5nk1v0"; + iosevka-ss04 = "0v8fvif71604vyqanphq9mmlmx4xy0y2bykvplhrj1zmrj6v2ing"; + iosevka-ss05 = "1fh99av3ml2zhjvdif02r2f82n4hsswpgd2i42d964swjdplxdga"; + iosevka-ss06 = "0b0kl49djpc77qpmr1g2nzrg0q477xkjiqxb2i33pkrjsxn4vhn7"; + iosevka-ss07 = "1d2by3najsambqxyzapnmd200hah39jq0mqdalidb2kjh5lx9n6k"; + iosevka-ss08 = "05m03zn9pfl1khvl9xvgmlaygh1ni67lj2pc8zjgqydyls1vmxl4"; + iosevka-ss09 = "1hzglj7sclg6h4jc9ibb1777apl11885w1gpscv81b8n1h0qhnb7"; + iosevka-ss10 = "1fr52sclgp10k0lh86scjn3aylvsfnr7msg7jfsr3bkg61f5x1da"; + iosevka-ss11 = "1cmdjmlqvhn3qvqdfflwa4wgza364jn9gbj5vq8rsd6qili175ix"; + iosevka-ss12 = "0bk56hh9894z59rpkk5s9hhmkz1b2gmvfys46frijg3am54xh03q"; + iosevka-ss13 = "1kgxlxz1cdkzrfbnkavscf48im9lwiya9rcqlaa10k0ssas28br5"; + iosevka-ss14 = "06djgn86r2yy3ll2ask5mr9qhqibqzr7v95db5dzxcbz7hrmaaxf"; + iosevka-ss15 = "0qcld7h38c7cif518sa84x50igxjkh38ckav9qhhv7ls1n5h0jpm"; + iosevka-ss16 = "0qa6h8qx60rajbpp0v4wxia5n3yinp2nvwy2dsi1270prra7r49x"; + iosevka-ss17 = "1s04vlkll42am6w3lcka518zv2dlrwwnykdid0sp81najwmq0fk3"; +} |