3
0
Fork 0
forked from mirrors/nixpkgs
nixpkgs/pkgs/data/fonts/unifont/default.nix
Profpatsch 4a7f99d55d treewide: with stdenv.lib; in meta -> with lib;
Part of: https://github.com/NixOS/nixpkgs/issues/108938

meta = with stdenv.lib;

is a widely used pattern. We want to slowly remove
the `stdenv.lib` indirection and encourage people
to use `lib` directly. Thus let’s start with the meta
field.

This used a rewriting script to mostly automatically
replace all occurances of this pattern, and add the
`lib` argument to the package header if it doesn’t
exist yet.

The script in its current form is available at
https://cs.tvl.fyi/depot@2f807d7f141068d2d60676a89213eaa5353ca6e0/-/blob/users/Profpatsch/nixpkgs-rewriter/default.nix
2021-01-11 10:38:22 +01:00

54 lines
1.4 KiB
Nix

{ lib, stdenv, fetchurl, mkfontscale
, libfaketime, fonttosfnt
}:
stdenv.mkDerivation rec {
pname = "unifont";
version = "13.0.05";
ttf = fetchurl {
url = "mirror://gnu/unifont/${pname}-${version}/${pname}-${version}.ttf";
sha256 = "0ff7zbyqi45q0171rl9ckj6lpfhcj8a9850d8j89m7wbwky32isf";
};
pcf = fetchurl {
url = "mirror://gnu/unifont/${pname}-${version}/${pname}-${version}.pcf.gz";
sha256 = "16n666p6rs6l4r8grh67gy4ls33qfnbb5xk7cksywzjwdh42js0r";
};
nativeBuildInputs = [ libfaketime fonttosfnt mkfontscale ];
phases = [ "buildPhase" "installPhase" ];
buildPhase =
''
# convert pcf font to otb
faketime -f "1970-01-01 00:00:01" \
fonttosfnt -g 2 -m 2 -v -o "unifont.otb" "${pcf}"
'';
installPhase =
''
# install otb fonts
install -m 644 -D unifont.otb "$out/share/fonts/unifont.otb"
mkfontdir "$out/share/fonts"
# install pcf and ttf fonts
install -m 644 -D ${pcf} $out/share/fonts/unifont.pcf.gz
install -m 644 -D ${ttf} $out/share/fonts/truetype/unifont.ttf
cd "$out/share/fonts"
mkfontdir
mkfontscale
'';
meta = with lib; {
description = "Unicode font for Base Multilingual Plane";
homepage = "http://unifoundry.com/unifont.html";
# Basically GPL2+ with font exception.
license = "http://unifoundry.com/LICENSE.txt";
maintainers = [ maintainers.rycee maintainers.vrthra ];
platforms = platforms.all;
};
}