nixpkgs/pkgs/tools/typesetting/satysfi/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

78 lines
2.5 KiB
Nix

{ lib, stdenv, fetchzip, fetchFromGitHub, ruby, dune_2, ocamlPackages
, ipaexfont, junicode, lmodern, lmmath
}:
let
camlpdf = ocamlPackages.camlpdf.overrideAttrs (o: {
src = fetchFromGitHub {
owner = "gfngfn";
repo = "camlpdf";
rev = "v2.3.1+satysfi";
sha256 = "1s8wcqdkl1alvfcj67lhn3qdz8ikvd1v64f4q6bi4c0qj9lmp30k";
};
});
otfm = ocamlPackages.otfm.overrideAttrs (o: {
src = fetchFromGitHub {
owner = "gfngfn";
repo = "otfm";
rev = "v0.3.7+satysfi";
sha256 = "0y8s0ij1vp1s4h5y1hn3ns76fzki2ba5ysqdib33akdav9krbj8p";
};
});
yojson-with-position = ocamlPackages.buildDunePackage {
pname = "yojson-with-position";
version = "1.4.2";
src = fetchFromGitHub {
owner = "gfngfn";
repo = "yojson-with-position";
rev = "v1.4.2+satysfi";
sha256 = "17s5xrnpim54d1apy972b5l08bph4c0m5kzbndk600fl0vnlirnl";
};
useDune2 = true;
nativeBuildInputs = [ ocamlPackages.cppo ];
propagatedBuildInputs = [ ocamlPackages.biniou ];
inherit (ocamlPackages.yojson) meta;
};
in
stdenv.mkDerivation rec {
pname = "satysfi";
version = "0.0.5";
src = fetchFromGitHub {
owner = "gfngfn";
repo = "SATySFi";
rev = "v${version}";
sha256 = "1y72by6d15bc6qb1lv1ch6cm1i74gyr0w127nnvs2s657snm0y1n";
fetchSubmodules = true;
};
preConfigure = ''
substituteInPlace src/frontend/main.ml --replace \
'/usr/local/share/satysfi"; "/usr/share/satysfi' \
$out/share/satysfi
'';
nativeBuildInputs = [ ruby dune_2 ];
buildInputs = [ camlpdf otfm yojson-with-position ] ++ (with ocamlPackages; [
ocaml findlib menhir
batteries camlimages core_kernel ppx_deriving uutf omd cppo re
]);
installPhase = ''
cp -r ${ipaexfont}/share/fonts/opentype/* lib-satysfi/dist/fonts/
cp -r ${junicode}/share/fonts/junicode-ttf/* lib-satysfi/dist/fonts/
cp -r ${lmodern}/share/fonts/opentype/public/lm/* lib-satysfi/dist/fonts/
cp -r ${lmmath}/share/fonts/opentype/latinmodern-math.otf lib-satysfi/dist/fonts/
make install PREFIX=$out LIBDIR=$out/share/satysfi
mkdir -p $out/share/satysfi/
cp -r lib-satysfi/dist/ $out/share/satysfi/
'';
meta = with lib; {
homepage = "https://github.com/gfngfn/SATySFi";
description = "A statically-typed, functional typesetting system";
license = licenses.lgpl3;
maintainers = [ maintainers.mt-caret maintainers.marsam ];
platforms = platforms.all;
};
}