Merge pull request #69219 from rileyinman/iosevka
iosevka: Simplify custom build process The interface to configure a custom build with Nix has changed due to changes upstream; please refer to the derivation for details.
This commit is contained in:
commit
7a4d7c58e3
@ -5370,6 +5370,12 @@
|
|||||||
github = "rickynils";
|
github = "rickynils";
|
||||||
name = "Rickard Nilsson";
|
name = "Rickard Nilsson";
|
||||||
};
|
};
|
||||||
|
rileyinman = {
|
||||||
|
email = "rileyminman@gmail.com";
|
||||||
|
github = "rileyinman";
|
||||||
|
githubId = 37246692;
|
||||||
|
name = "Riley Inman";
|
||||||
|
};
|
||||||
ris = {
|
ris = {
|
||||||
email = "code@humanleg.org.uk";
|
email = "code@humanleg.org.uk";
|
||||||
github = "risicle";
|
github = "risicle";
|
||||||
|
@ -1,83 +1,70 @@
|
|||||||
{
|
{ stdenv, lib, pkgs, fetchFromGitHub
|
||||||
stdenv, lib, pkgs,
|
, nodejs, nodePackages, remarshal, ttfautohint-nox, otfcc
|
||||||
fetchFromGitHub, fetchurl,
|
|
||||||
nodejs, ttfautohint-nox, otfcc,
|
|
||||||
|
|
||||||
# Custom font set options.
|
# Custom font set options.
|
||||||
# See https://github.com/be5invis/Iosevka#build-your-own-style
|
# See https://github.com/be5invis/Iosevka#build-your-own-style
|
||||||
design ? [], upright ? [], italic ? [], oblique ? [],
|
# Ex:
|
||||||
family ? null, weights ? [],
|
# privateBuildPlan = {
|
||||||
# Custom font set name. Required if any custom settings above.
|
# family = "Iosevka Expanded";
|
||||||
set ? null,
|
#
|
||||||
# Extra parameters. Can be used for ligature mapping.
|
# design = [
|
||||||
extraParameters ? null
|
# "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 (design != []) -> set != null;
|
assert (privateBuildPlan != null) -> set != null;
|
||||||
assert (upright != []) -> set != null;
|
|
||||||
assert (italic != []) -> set != null;
|
|
||||||
assert (oblique != []) -> set != null;
|
|
||||||
assert (family != null) -> set != null;
|
|
||||||
assert (weights != []) -> set != null;
|
|
||||||
|
|
||||||
let
|
stdenv.mkDerivation rec {
|
||||||
system = builtins.currentSystem;
|
pname =
|
||||||
nodePackages = import ./node-packages.nix { inherit pkgs system nodejs; };
|
if set != null
|
||||||
in
|
then "iosevka-${set}"
|
||||||
|
else "iosevka";
|
||||||
|
|
||||||
let pname = if set != null then "iosevka-${set}" else "iosevka"; in
|
|
||||||
|
|
||||||
let
|
|
||||||
version = "2.3.0";
|
version = "2.3.0";
|
||||||
name = "${pname}-${version}";
|
|
||||||
src = fetchFromGitHub {
|
src = fetchFromGitHub {
|
||||||
owner = "be5invis";
|
owner = "be5invis";
|
||||||
repo ="Iosevka";
|
repo = "Iosevka";
|
||||||
rev = "v${version}";
|
rev = "v${version}";
|
||||||
sha256 = "1qnbxhx9wvij9zia226mc3sy8j7bfsw5v1cvxvsbbwjskwqdamvv";
|
sha256 = "1qnbxhx9wvij9zia226mc3sy8j7bfsw5v1cvxvsbbwjskwqdamvv";
|
||||||
};
|
};
|
||||||
in
|
|
||||||
|
|
||||||
with lib;
|
nativeBuildInputs = [
|
||||||
let quote = str: "\"" + str + "\""; in
|
nodejs
|
||||||
let toTomlList = list: "[" + (concatMapStringsSep ", " quote list) +"]"; in
|
nodePackages."iosevka-build-deps-../../data/fonts/iosevka"
|
||||||
let unlines = concatStringsSep "\n"; in
|
remarshal
|
||||||
|
otfcc
|
||||||
|
ttfautohint-nox
|
||||||
|
];
|
||||||
|
|
||||||
let
|
privateBuildPlanJSON = builtins.toJSON { buildPlans.${pname} = privateBuildPlan; };
|
||||||
param = name: options:
|
extraParametersJSON = builtins.toJSON { ${pname} = extraParameters; };
|
||||||
if options != [] then "${name}=${toTomlList options}" else null;
|
passAsFile = [ "privateBuildPlanJSON" "extraParametersJSON" ];
|
||||||
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)
|
|
||||||
(param "weights" weights)
|
|
||||||
]);
|
|
||||||
installNodeModules = unlines (lib.mapAttrsToList
|
|
||||||
(name: value: "mkdir -p node_modules/${name}\n cp -r ${value.outPath}/lib/node_modules/. node_modules")
|
|
||||||
nodePackages);
|
|
||||||
in
|
|
||||||
|
|
||||||
stdenv.mkDerivation {
|
|
||||||
inherit name pname version src;
|
|
||||||
|
|
||||||
nativeBuildInputs = [ nodejs ttfautohint-nox otfcc ];
|
|
||||||
|
|
||||||
passAsFile = [ "config" "extraParameters" ];
|
|
||||||
config = config;
|
|
||||||
extraParameters = extraParameters;
|
|
||||||
|
|
||||||
configurePhase = ''
|
configurePhase = ''
|
||||||
mkdir -p node_modules/.bin
|
runHook preConfigure
|
||||||
${installNodeModules}
|
${lib.optionalString (privateBuildPlan != null) ''
|
||||||
${optionalString (set != null) ''mv "$configPath" private-build-plans.toml''}
|
remarshal -i "$privateBuildPlanJSONPath" -o private-build-plans.toml -if json -of toml
|
||||||
${optionalString (extraParameters != null) ''cat "$extraParametersPath" >> parameters.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 = ''
|
buildPhase = ''
|
||||||
npm run build -- ttf::${pname}
|
runHook preBuild
|
||||||
|
npm run build -- ttf::$pname
|
||||||
|
runHook postBuild
|
||||||
'';
|
'';
|
||||||
|
|
||||||
installPhase = ''
|
installPhase = ''
|
||||||
@ -89,14 +76,20 @@ stdenv.mkDerivation {
|
|||||||
enableParallelBuilding = true;
|
enableParallelBuilding = true;
|
||||||
|
|
||||||
meta = with stdenv.lib; {
|
meta = with stdenv.lib; {
|
||||||
homepage = https://be5invis.github.io/Iosevka/;
|
homepage = https://be5invis.github.io/Iosevka;
|
||||||
downloadPage = "https://github.com/be5invis/Iosevka/releases";
|
downloadPage = https://github.com/be5invis/Iosevka/releases;
|
||||||
description = ''
|
description = ''
|
||||||
Slender monospace sans-serif and slab-serif typeface inspired by Pragmata
|
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.
|
Pro, M+ and PF DIN Mono, designed to be the ideal font for programming.
|
||||||
'';
|
'';
|
||||||
license = licenses.ofl;
|
license = licenses.ofl;
|
||||||
platforms = platforms.all;
|
platforms = platforms.all;
|
||||||
maintainers = with maintainers; [ cstrahan jfrankenau ttuegel babariviere ];
|
maintainers = with maintainers; [
|
||||||
|
cstrahan
|
||||||
|
jfrankenau
|
||||||
|
ttuegel
|
||||||
|
babariviere
|
||||||
|
rileyinman
|
||||||
|
];
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -1,6 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
|
|
||||||
node2nix --nodejs-10 --input node-packages.json \
|
|
||||||
--output node-packages-generated.nix \
|
|
||||||
--composition node-packages.nix \
|
|
||||||
--node-env ./../../../development/node-packages/node-env.nix
|
|
File diff suppressed because it is too large
Load Diff
@ -1,20 +0,0 @@
|
|||||||
[
|
|
||||||
"caryll-shapeops",
|
|
||||||
"libspiro-js",
|
|
||||||
"megaminx",
|
|
||||||
"object-assign",
|
|
||||||
"otfcc-ttcize",
|
|
||||||
"primitive-quadify-off-curves",
|
|
||||||
"toml",
|
|
||||||
"topsort",
|
|
||||||
"ttf2woff",
|
|
||||||
"ttf2woff2",
|
|
||||||
"unorm",
|
|
||||||
"verda",
|
|
||||||
"yargs",
|
|
||||||
"colors",
|
|
||||||
"patel",
|
|
||||||
"patrisika-scopes",
|
|
||||||
"eslint",
|
|
||||||
"stylus"
|
|
||||||
]
|
|
17
pkgs/data/fonts/iosevka/node-packages.nix
generated
17
pkgs/data/fonts/iosevka/node-packages.nix
generated
@ -1,17 +0,0 @@
|
|||||||
# This file has been generated by node2nix 1.7.0. Do not edit!
|
|
||||||
|
|
||||||
{pkgs ? import <nixpkgs> {
|
|
||||||
inherit system;
|
|
||||||
}, system ? builtins.currentSystem, nodejs ? pkgs."nodejs-10_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-generated.nix {
|
|
||||||
inherit (pkgs) fetchurl fetchgit;
|
|
||||||
inherit nodeEnv;
|
|
||||||
}
|
|
26
pkgs/data/fonts/iosevka/package.json
Normal file
26
pkgs/data/fonts/iosevka/package.json
Normal file
@ -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"
|
||||||
|
}
|
||||||
|
}
|
@ -57,6 +57,7 @@
|
|||||||
, "indium"
|
, "indium"
|
||||||
, "ionic"
|
, "ionic"
|
||||||
, "ios-deploy"
|
, "ios-deploy"
|
||||||
|
, { "iosevka-build-deps": "../../data/fonts/iosevka" }
|
||||||
, "jake"
|
, "jake"
|
||||||
, "javascript-typescript-langserver"
|
, "javascript-typescript-langserver"
|
||||||
, "joplin"
|
, "joplin"
|
||||||
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user