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).
This commit is contained in:
babariviere 2019-09-14 22:11:28 +02:00
parent 260761649b
commit 659adfaf27
No known key found for this signature in database
GPG Key ID: EECF965F5AAA4E1A
3 changed files with 2433 additions and 418 deletions

View File

@ -8,7 +8,9 @@
design ? [], upright ? [], italic ? [], oblique ? [], design ? [], upright ? [], italic ? [], oblique ? [],
family ? null, weights ? [], family ? null, weights ? [],
# Custom font set name. Required if any custom settings above. # 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; assert (design != []) -> set != null;
@ -25,32 +27,33 @@ in
let pname = if set != null then "iosevka-${set}" else "iosevka"; in let pname = if set != null then "iosevka-${set}" else "iosevka"; in
let let
version = "1.14.3"; version = "2.3.0";
name = "${pname}-${version}"; name = "${pname}-${version}";
src = fetchFromGitHub { src = fetchFromGitHub {
owner = "be5invis"; owner = "be5invis";
repo ="Iosevka"; repo ="Iosevka";
rev = "v${version}"; rev = "v${version}";
sha256 = "0ba8hwxi88bp2jb9xfhk95nnlv8ykl74cv62xr4ybzm3b8ahpwqf"; sha256 = "1qnbxhx9wvij9zia226mc3sy8j7bfsw5v1cvxvsbbwjskwqdamvv";
}; };
in in
with lib; with lib;
let unwords = concatStringsSep " "; in let quote = str: "\"" + str + "\""; in
let toTomlList = list: "[" + (concatMapStringsSep ", " quote list) +"]"; in
let unlines = concatStringsSep "\n"; in
let let
param = name: options: param = name: options:
if options != [] then "${name}='${unwords options}'" else null; if options != [] then "${name}=${toTomlList options}" else null;
config = unwords (lib.filter (x: x != null) [ config = unlines (lib.filter (x: x != null) [
"[buildPlans.${pname}]"
(param "design" design) (param "design" design)
(param "upright" upright) (param "upright" upright)
(param "italic" italic) (param "italic" italic)
(param "oblique" oblique) (param "oblique" oblique)
(if family != null then "family='${family}'" else null) (if family != null then "family=\"${family}\"" else null)
(param "weights" weights) (param "weights" weights)
]); ]);
custom = design != [] || upright != [] || italic != [] || oblique != []
|| family != null || weights != [];
in in
stdenv.mkDerivation { stdenv.mkDerivation {
@ -58,8 +61,10 @@ stdenv.mkDerivation {
nativeBuildInputs = [ nodejs ttfautohint-nox otfcc ]; nativeBuildInputs = [ nodejs ttfautohint-nox otfcc ];
passAsFile = [ "installPackageLock" ]; passAsFile = [ "installPackageLock" "config" "extraParameters" ];
installPackageLock = installPackageLock ./package-lock.json; installPackageLock = installPackageLock ./package-lock.json;
config = config;
extraParameters = extraParameters;
preConfigure = '' preConfigure = ''
HOME=$TMPDIR HOME=$TMPDIR
@ -70,21 +75,18 @@ stdenv.mkDerivation {
configurePhase = '' configurePhase = ''
runHook preConfigure runHook preConfigure
${optionalString custom ''make custom-config set=${set} ${config}''} ${optionalString (set != null) ''mv "$configPath" private-build-plans.toml''}
${optionalString (extraParameters != null) ''cat "$extraParametersPath" >> parameters.toml''}
runHook postConfigure
''; '';
makeFlags = lib.optionals custom [ "custom" "set=${set}" ]; buildPhase = ''
npm run build -- ttf::${pname}
'';
installPhase = '' installPhase = ''
runHook preInstall
fontdir="$out/share/fonts/$pname" fontdir="$out/share/fonts/$pname"
install -d "$fontdir" install -d "$fontdir"
install "dist/$pname/ttf"/* "$fontdir" install "dist/$pname/ttf"/* "$fontdir"
runHook postInstall
''; '';
enableParallelBuilding = true; enableParallelBuilding = true;
@ -98,6 +100,6 @@ stdenv.mkDerivation {
''; '';
license = licenses.ofl; license = licenses.ofl;
platforms = platforms.all; platforms = platforms.all;
maintainers = with maintainers; [ cstrahan jfrankenau ttuegel ]; maintainers = with maintainers; [ cstrahan jfrankenau ttuegel babariviere ];
}; };
} }

File diff suppressed because it is too large Load Diff

View File

@ -117,6 +117,7 @@ let
prepareDepend = { name, src, depends, ... }: prepareDepend = { name, src, depends, ... }:
'' ''
unpackFile '${src}' unpackFile '${src}'
mkdir -p $(dirname "${name}")
mv package '${name}' mv package '${name}'
mkdir -p '${name}/node_modules' mkdir -p '${name}/node_modules'
( (