2017-11-19 19:03:51 +01:00
|
|
|
{
|
|
|
|
stdenv, lib,
|
|
|
|
fetchFromGitHub, fetchurl,
|
2017-11-27 02:01:54 +01:00
|
|
|
nodejs, ttfautohint-nox, otfcc,
|
2017-11-19 19:29:40 +01:00
|
|
|
|
|
|
|
# Custom font set options.
|
|
|
|
# See https://github.com/be5invis/Iosevka#build-your-own-style
|
|
|
|
design ? [], upright ? [], italic ? [], oblique ? [],
|
2018-02-12 09:48:36 +01:00
|
|
|
family ? null, weights ? [],
|
2017-11-19 19:29:40 +01:00
|
|
|
# Custom font set name. Required if any custom settings above.
|
|
|
|
set ? null
|
2017-11-19 19:03:51 +01:00
|
|
|
}:
|
|
|
|
|
2017-11-19 19:29:40 +01:00
|
|
|
assert (design != []) -> set != null;
|
|
|
|
assert (upright != []) -> set != null;
|
|
|
|
assert (italic != []) -> set != null;
|
|
|
|
assert (oblique != []) -> set != null;
|
2018-02-12 09:48:36 +01:00
|
|
|
assert (family != null) -> set != null;
|
|
|
|
assert (weights != []) -> set != null;
|
2017-11-19 19:03:51 +01:00
|
|
|
|
|
|
|
let
|
|
|
|
installPackageLock = import ./package-lock.nix { inherit fetchurl lib; };
|
|
|
|
in
|
2015-11-24 01:51:31 +01:00
|
|
|
|
2017-11-19 19:29:40 +01:00
|
|
|
let pname = if set != null then "iosevka-${set}" else "iosevka"; in
|
|
|
|
|
2017-08-11 06:01:26 +02:00
|
|
|
let
|
2018-05-18 10:45:25 +02:00
|
|
|
version = "1.14.3";
|
2017-11-19 19:29:40 +01:00
|
|
|
name = "${pname}-${version}";
|
2017-11-19 19:03:51 +01:00
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "be5invis";
|
|
|
|
repo ="Iosevka";
|
|
|
|
rev = "v${version}";
|
2018-05-18 10:45:25 +02:00
|
|
|
sha256 = "0ba8hwxi88bp2jb9xfhk95nnlv8ykl74cv62xr4ybzm3b8ahpwqf";
|
2017-11-19 19:03:51 +01:00
|
|
|
};
|
|
|
|
in
|
2015-12-17 10:26:57 +01:00
|
|
|
|
2017-11-19 19:29:40 +01:00
|
|
|
with lib;
|
|
|
|
let unwords = concatStringsSep " "; in
|
|
|
|
|
|
|
|
let
|
|
|
|
param = name: options:
|
|
|
|
if options != [] then "${name}='${unwords options}'" else null;
|
|
|
|
config = unwords (lib.filter (x: x != null) [
|
|
|
|
(param "design" design)
|
|
|
|
(param "upright" upright)
|
|
|
|
(param "italic" italic)
|
|
|
|
(param "oblique" oblique)
|
2018-02-12 09:48:36 +01:00
|
|
|
(if family != null then "family='${family}'" else null)
|
|
|
|
(param "weights" weights)
|
2017-11-19 19:29:40 +01:00
|
|
|
]);
|
2018-02-12 09:48:36 +01:00
|
|
|
custom = design != [] || upright != [] || italic != [] || oblique != []
|
|
|
|
|| family != null || weights != [];
|
2017-11-19 19:29:40 +01:00
|
|
|
in
|
|
|
|
|
2017-11-19 19:03:51 +01:00
|
|
|
stdenv.mkDerivation {
|
2017-11-19 19:29:40 +01:00
|
|
|
inherit name pname version src;
|
2015-11-24 01:51:31 +01:00
|
|
|
|
2017-11-27 02:01:54 +01:00
|
|
|
nativeBuildInputs = [ nodejs ttfautohint-nox otfcc ];
|
2017-11-19 19:03:51 +01:00
|
|
|
|
|
|
|
passAsFile = [ "installPackageLock" ];
|
|
|
|
installPackageLock = installPackageLock ./package-lock.json;
|
|
|
|
|
|
|
|
preConfigure = ''
|
|
|
|
HOME=$TMPDIR
|
|
|
|
source "$installPackageLockPath";
|
|
|
|
npm --offline rebuild
|
2015-11-24 01:51:31 +01:00
|
|
|
'';
|
2015-12-17 10:26:57 +01:00
|
|
|
|
2017-11-19 19:29:40 +01:00
|
|
|
configurePhase = ''
|
|
|
|
runHook preConfigure
|
|
|
|
|
|
|
|
${optionalString custom ''make custom-config set=${set} ${config}''}
|
|
|
|
|
|
|
|
runHook postConfigure
|
|
|
|
'';
|
|
|
|
|
2017-11-27 01:48:43 +01:00
|
|
|
makeFlags = lib.optionals custom [ "custom" "set=${set}" ];
|
2017-11-19 19:29:40 +01:00
|
|
|
|
2017-11-19 19:03:51 +01:00
|
|
|
installPhase = ''
|
2017-11-19 19:29:40 +01:00
|
|
|
runHook preInstall
|
|
|
|
|
|
|
|
fontdir="$out/share/fonts/$pname"
|
|
|
|
install -d "$fontdir"
|
|
|
|
install "dist/$pname/ttf"/* "$fontdir"
|
2017-11-19 19:03:51 +01:00
|
|
|
|
2017-11-19 19:29:40 +01:00
|
|
|
runHook postInstall
|
2017-11-19 19:03:51 +01:00
|
|
|
'';
|
2017-08-11 06:01:26 +02:00
|
|
|
|
2017-11-27 01:48:43 +01:00
|
|
|
enableParallelBuilding = true;
|
|
|
|
|
2016-07-04 09:16:40 +02:00
|
|
|
meta = with stdenv.lib; {
|
2017-08-02 23:50:51 +02:00
|
|
|
homepage = https://be5invis.github.io/Iosevka/;
|
2015-12-17 10:26:57 +01:00
|
|
|
downloadPage = "https://github.com/be5invis/Iosevka/releases";
|
2015-11-24 01:51:31 +01:00
|
|
|
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;
|
2017-11-19 19:04:30 +01:00
|
|
|
maintainers = with maintainers; [ cstrahan jfrankenau ttuegel ];
|
2015-11-24 01:51:31 +01:00
|
|
|
};
|
|
|
|
}
|