From b99d947a5ece80ffbafc5043a1e1c16e2f1faac4 Mon Sep 17 00:00:00 2001 From: Martin Potier Date: Wed, 25 Sep 2019 12:28:52 +0300 Subject: [PATCH] Import the whole iosevka --- pkgs/default.nix | 2 +- pkgs/iosevka/bin.nix | 28 ++++++++++++ pkgs/iosevka/default.nix | 95 +++++++++++++++++++++++++++++++++++++++ pkgs/iosevka/package.json | 26 +++++++++++ pkgs/minitube/default.nix | 36 --------------- 5 files changed, 150 insertions(+), 37 deletions(-) create mode 100644 pkgs/iosevka/bin.nix create mode 100644 pkgs/iosevka/default.nix create mode 100644 pkgs/iosevka/package.json delete mode 100644 pkgs/minitube/default.nix diff --git a/pkgs/default.nix b/pkgs/default.nix index f147267..bba1d88 100644 --- a/pkgs/default.nix +++ b/pkgs/default.nix @@ -5,7 +5,7 @@ self: super: { qutebrowserWE = super.qutebrowser.override { withWebEngineDefault = true; }; - iosevka-hskl = super.iosevka.override { + iosevka-hskl = super.callPackage ./iosevka { privateBuildPlan = { family = "Iosevka Samae"; design = [ diff --git a/pkgs/iosevka/bin.nix b/pkgs/iosevka/bin.nix new file mode 100644 index 0000000..962769b --- /dev/null +++ b/pkgs/iosevka/bin.nix @@ -0,0 +1,28 @@ +{ stdenv, fetchzip }: + +let + version = "2.3.0"; +in fetchzip { + name = "iosevka-bin-${version}"; + + url = "https://github.com/be5invis/Iosevka/releases/download/v${version}/ttc-iosevka-${version}.zip"; + + postFetch = '' + mkdir -p $out/share/fonts + unzip -j $downloadedFile \*.ttc -d $out/share/fonts/iosevka + ''; + + sha256 = "0nry6zsmvcj44rijhbvrry84rh5hrixzb4n1mx9c27vvpy33a56w"; + + meta = with stdenv.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 = [ maintainers.cstrahan ]; + }; +} diff --git a/pkgs/iosevka/default.nix b/pkgs/iosevka/default.nix new file mode 100644 index 0000000..a146103 --- /dev/null +++ b/pkgs/iosevka/default.nix @@ -0,0 +1,95 @@ +{ stdenv, lib, pkgs, fetchFromGitHub +, nodejs, nodePackages, remarshal, ttfautohint-nox, otfcc + +# Custom font set options. +# See https://github.com/be5invis/Iosevka#build-your-own-style +# Ex: +# privateBuildPlan = { +# family = "Iosevka Expanded"; +# +# design = [ +# "sans" +# "expanded" +# ]; +# }; +, privateBuildPlan ? null +# Extra parameters. Can be used for ligature mapping. +, extraParameters ? null +# Custom font set name. Required if any custom settings above. +, set ? null +}: + +assert (privateBuildPlan != null) -> set != null; + +stdenv.mkDerivation rec { + pname = + if set != null + then "iosevka-${set}" + else "iosevka"; + + version = "2.3.0"; + + src = fetchFromGitHub { + owner = "be5invis"; + repo = "Iosevka"; + rev = "v${version}"; + sha256 = "1qnbxhx9wvij9zia226mc3sy8j7bfsw5v1cvxvsbbwjskwqdamvv"; + }; + + nativeBuildInputs = [ + nodejs + nodePackages."iosevka-build-deps-../../data/fonts/iosevka" + remarshal + otfcc + ttfautohint-nox + ]; + + privateBuildPlanJSON = builtins.toJSON { buildPlans.${pname} = privateBuildPlan; }; + extraParametersJSON = builtins.toJSON { ${pname} = extraParameters; }; + passAsFile = [ "privateBuildPlanJSON" "extraParametersJSON" ]; + + configurePhase = '' + runHook preConfigure + ${lib.optionalString (privateBuildPlan != null) '' + remarshal -i "$privateBuildPlanJSONPath" -o private-build-plans.toml -if json -of toml + ''} + ${lib.optionalString (extraParameters != null) '' + echo -e "\n" >> parameters.toml + remarshal -i "$extraParametersJSONPath" -if json -of toml >> parameters.toml + ''} + ln -s ${nodePackages."iosevka-build-deps-../../data/fonts/iosevka"}/lib/node_modules/iosevka-build-deps/node_modules . + runHook postConfigure + ''; + + buildPhase = '' + runHook preBuild + npm run build -- ttf::$pname + runHook postBuild + ''; + + installPhase = '' + fontdir="$out/share/fonts/$pname" + install -d "$fontdir" + install "dist/$pname/ttf"/* "$fontdir" + ''; + + enableParallelBuilding = true; + + meta = with stdenv.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 + ]; + }; +} diff --git a/pkgs/iosevka/package.json b/pkgs/iosevka/package.json new file mode 100644 index 0000000..ae162a9 --- /dev/null +++ b/pkgs/iosevka/package.json @@ -0,0 +1,26 @@ +{ + "name": "iosevka-build-deps", + "version": "2.3.0", + "scripts": { + "build": "verda -f verdafile.js" + }, + "dependencies": { + "caryll-shapeops": "^0.3.1", + "colors": "^1.3.3", + "libspiro-js": "^0.3.1", + "megaminx": "^0.9.0", + "object-assign": "^4.1.1", + "otfcc-ttcize": "^0.8.0", + "patel": "^0.33.1", + "patrisika-scopes": "^0.11.1", + "primitive-quadify-off-curves": "^0.4.0", + "stylus": "^0.54.5", + "toml": "^2.3.2", + "topsort": "0.0.2", + "ttf2woff": "^2.0.1", + "ttf2woff2": "^2.0.3", + "unorm": "^1.4.1", + "verda": "^1.0.0-0", + "yargs": "^12.0.0" + } +} diff --git a/pkgs/minitube/default.nix b/pkgs/minitube/default.nix deleted file mode 100644 index d9b94f8..0000000 --- a/pkgs/minitube/default.nix +++ /dev/null @@ -1,36 +0,0 @@ -{ stdenv, fetchgit, makeWrapper, qtbase, qmake -, qtdeclarative, qttools, qtx11extras, mpv, linuxHeaders -, withAPIKey ? "AIzaSyAHj2NywPI-GhV_yMgCDjE7XFGAnPrJDGM" }: - -stdenv.mkDerivation rec { - name = "minitube-${version}"; - version = "3.1"; - - # Have to use fetchgit to import submodules :( - src = fetchgit { - url = "https://github.com/flaviotordini/minitube.git"; - rev = "refs/tags/${version}"; - deepClone = true; - sha256 = "1hm2bwlma2d4rz0sff7axygsj67inghliadhfzv4hdp7pcz8g59x"; - }; - - buildInputs = [ qtbase qtdeclarative qttools qtx11extras mpv linuxHeaders ]; - nativeBuildInputs = [ makeWrapper qmake ]; - - qmakeFlags = [ "DEFINES+=APP_GOOGLE_API_KEY=${withAPIKey}" ]; - - enableParallelBuilding = true; - - meta = with stdenv.lib; { - description = "Stand-alone YouTube video player"; - longDescription = '' - Watch YouTube videos in a new way: you type a keyword, Minitube gives - you an endless video stream. Minitube is not about cloning the YouTube - website, it aims to create a new TV-like experience. - ''; - homepage = https://flavio.tordini.org/minitube; - license = licenses.gpl3Plus; - platforms = platforms.linux; - maintainers = with maintainers; [ jpotier ]; - }; -}