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 ? [],
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 ];
};
}

File diff suppressed because it is too large Load Diff

View File

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