1
0
Fork 1
mirror of https://github.com/NixOS/nixpkgs.git synced 2024-12-25 03:17:13 +00:00
nixpkgs/pkgs/data/fonts/iosevka/default.nix

99 lines
2.4 KiB
Nix
Raw Normal View History

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