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

117 lines
2.5 KiB
Nix

{ lib, stdenv
, darwin
, fetchurl
, makeWrapper
, pkg-config
, autoconf
, automake
, poppler_utils
, harfbuzz
, icu
, fontconfig
, lua
, libiconv
, makeFontsConf
, gentium
}:
let
luaEnv = lua.withPackages(ps: with ps; [
cassowary
cosmo
compat53
linenoise
lpeg
lua-zlib
lua_cliargs
luaepnf
luaexpat
luafilesystem
luarepl
luasec
luasocket
penlight
stdlib
vstruct
]);
in
stdenv.mkDerivation rec {
pname = "sile";
version = "0.10.13";
src = fetchurl {
url = "https://github.com/sile-typesetter/sile/releases/download/v${version}/${pname}-${version}.tar.xz";
sha256 = "19k4r7wfszml4dac8cm1hx9rb1im3psigcidz8bdm9j9jzpd01yj";
};
configureFlags = [
"--with-system-luarocks"
"--with-manual"
];
nativeBuildInputs = [
autoconf
automake
pkg-config
makeWrapper
];
buildInputs = [
harfbuzz
icu
fontconfig
libiconv
luaEnv
]
++ stdenv.lib.optional stdenv.isDarwin darwin.apple_sdk.frameworks.AppKit
;
checkInputs = [
poppler_utils
];
preConfigure = stdenv.lib.optionalString stdenv.isDarwin ''
sed -i -e 's|@import AppKit;|#import <AppKit/AppKit.h>|' src/macfonts.m
'';
NIX_LDFLAGS = stdenv.lib.optionalString stdenv.isDarwin "-framework AppKit";
FONTCONFIG_FILE = makeFontsConf {
fontDirectories = [
gentium
];
};
doCheck = true;
enableParallelBuilding = true;
preBuild = stdenv.lib.optionalString stdenv.cc.isClang ''
substituteInPlace libtexpdf/dpxutil.c \
--replace "ASSERT(ht && ht->table && iter);" "ASSERT(ht && iter);"
'';
# Hack to avoid TMPDIR in RPATHs.
preFixup = ''rm -rf "$(pwd)" && mkdir "$(pwd)" '';
outputs = [ "out" "doc" "man" "dev" ];
meta = with lib; {
description = "A typesetting system";
longDescription = ''
SILE is a typesetting system; its job is to produce beautiful
printed documents. Conceptually, SILE is similar to TeXfrom
which it borrows some concepts and even syntax and
algorithmsbut the similarities end there. Rather than being a
derivative of the TeX family SILE is a new typesetting and
layout engine written from the ground up using modern
technologies and borrowing some ideas from graphical systems
such as InDesign.
'';
homepage = "https://sile-typesetter.org/";
platforms = platforms.unix;
broken = stdenv.isDarwin; # https://github.com/NixOS/nixpkgs/issues/23018
maintainers = with maintainers; [ doronbehar alerque ];
license = licenses.mit;
};
}