2024-11-04 09:33:14 +02:00
|
|
|
{
|
|
|
|
lib,
|
|
|
|
stdenv,
|
2024-11-09 18:24:14 +02:00
|
|
|
fetchurl,
|
2024-11-04 09:37:49 +02:00
|
|
|
|
|
|
|
# nativeBuildInputs
|
2024-11-09 18:24:14 +02:00
|
|
|
zstd,
|
2024-11-04 09:37:49 +02:00
|
|
|
pkg-config,
|
2024-11-04 10:23:25 +02:00
|
|
|
jq,
|
|
|
|
cargo,
|
|
|
|
rustc,
|
|
|
|
rustPlatform,
|
2024-11-28 16:15:46 +02:00
|
|
|
luarocks,
|
2024-11-04 09:37:49 +02:00
|
|
|
|
|
|
|
# buildInputs
|
|
|
|
lua,
|
2024-11-04 09:33:14 +02:00
|
|
|
harfbuzz,
|
|
|
|
icu,
|
|
|
|
fontconfig,
|
|
|
|
libiconv,
|
2024-11-04 09:37:49 +02:00
|
|
|
# FONTCONFIG_FILE
|
2024-11-04 09:33:14 +02:00
|
|
|
makeFontsConf,
|
2025-06-04 21:24:36 +02:00
|
|
|
gentium-plus,
|
2024-11-04 09:37:49 +02:00
|
|
|
|
|
|
|
# passthru.tests
|
2024-11-04 09:33:14 +02:00
|
|
|
runCommand,
|
2025-02-27 16:43:46 +08:00
|
|
|
poppler-utils,
|
2017-02-04 18:30:00 +01:00
|
|
|
}:
|
|
|
|
|
2023-09-21 11:31:17 +03:00
|
|
|
stdenv.mkDerivation (finalAttrs: {
|
2019-08-15 12:41:18 +00:00
|
|
|
pname = "sile";
|
2025-06-01 09:39:26 +03:00
|
|
|
version = "0.15.13";
|
2017-02-11 15:52:50 +01:00
|
|
|
|
2024-11-09 18:24:14 +02:00
|
|
|
src = fetchurl {
|
|
|
|
url = "https://github.com/sile-typesetter/sile/releases/download/v${finalAttrs.version}/sile-${finalAttrs.version}.tar.zst";
|
2025-06-01 09:39:26 +03:00
|
|
|
hash = "sha256-XpfBllGv9xBoe5MpLVNhy0EWUglLzIxiyBHBn3qBRks=";
|
2017-02-11 15:52:50 +01:00
|
|
|
};
|
2017-02-04 18:30:00 +01:00
|
|
|
|
2025-01-30 16:23:05 +01:00
|
|
|
cargoDeps = rustPlatform.fetchCargoVendor {
|
2024-11-30 23:21:32 +03:00
|
|
|
inherit (finalAttrs) pname version src;
|
2025-01-30 16:23:05 +01:00
|
|
|
dontConfigure = true;
|
2024-11-09 18:24:14 +02:00
|
|
|
nativeBuildInputs = [ zstd ];
|
2025-06-01 09:39:26 +03:00
|
|
|
hash = "sha256-phRnyaF8KTYlgrgBeVNPxBAokRBUoj9vs7P9y97wbG8=";
|
2024-11-04 10:23:25 +02:00
|
|
|
};
|
2020-07-29 23:41:23 +03:00
|
|
|
|
|
|
|
nativeBuildInputs = [
|
2024-11-09 18:24:14 +02:00
|
|
|
zstd
|
2020-07-29 23:41:23 +03:00
|
|
|
pkg-config
|
2025-01-08 12:32:19 +01:00
|
|
|
fontconfig # fc-match
|
2024-11-04 10:23:25 +02:00
|
|
|
jq
|
|
|
|
cargo
|
|
|
|
rustc
|
|
|
|
rustPlatform.cargoSetupHook
|
2024-11-28 16:15:46 +02:00
|
|
|
luarocks
|
2020-07-29 23:41:23 +03:00
|
|
|
];
|
2024-11-28 16:15:46 +02:00
|
|
|
# luarocks propagates cmake, but it shouldn't be used as a build system.
|
|
|
|
dontUseCmakeConfigure = true;
|
2024-11-04 10:23:25 +02:00
|
|
|
|
2024-11-28 15:54:24 +02:00
|
|
|
buildInputs = [
|
|
|
|
finalAttrs.finalPackage.passthru.luaEnv
|
|
|
|
harfbuzz
|
|
|
|
icu
|
|
|
|
fontconfig
|
|
|
|
libiconv
|
|
|
|
];
|
2024-11-04 10:23:25 +02:00
|
|
|
|
|
|
|
configureFlags =
|
|
|
|
[
|
|
|
|
# Nix will supply all the Lua dependencies, so stop the build system from
|
|
|
|
# bundling vendored copies of them.
|
|
|
|
"--with-system-lua-sources"
|
|
|
|
"--with-system-luarocks"
|
|
|
|
# The automake check target uses pdfinfo to confirm the output of a test
|
|
|
|
# run, and uses autotools to discover it. This flake build eschews that
|
|
|
|
# test because it is run from the source directory but the binary is
|
|
|
|
# already built with system paths, so it can't be checked under Nix until
|
|
|
|
# after install. After install the Makefile isn't available of course, so
|
|
|
|
# we have our own copy of it with a hard coded path to `pdfinfo`. By
|
|
|
|
# specifying some binary here we skip the configure time test for
|
|
|
|
# `pdfinfo`, by using `false` we make sure that if it is expected during
|
|
|
|
# build time we would fail to build since we only provide it at test time.
|
|
|
|
"PDFINFO=false"
|
|
|
|
]
|
|
|
|
++ lib.optionals (!lua.pkgs.isLuaJIT) [
|
|
|
|
"--without-luajit"
|
|
|
|
];
|
|
|
|
|
|
|
|
outputs = [
|
|
|
|
"out"
|
|
|
|
"doc"
|
|
|
|
"man"
|
|
|
|
"dev"
|
|
|
|
];
|
|
|
|
|
|
|
|
# TODO: At some point, upstream should support installing the pre-built
|
|
|
|
# manual automatically
|
|
|
|
postInstall = ''
|
|
|
|
install -Dm0644 documentation/sile.pdf $out/share/doc/sile/manual.pdf
|
|
|
|
'';
|
|
|
|
|
|
|
|
FONTCONFIG_FILE = makeFontsConf {
|
|
|
|
fontDirectories = [
|
2025-06-04 21:24:36 +02:00
|
|
|
gentium-plus
|
2024-11-04 10:23:25 +02:00
|
|
|
];
|
|
|
|
};
|
2025-01-08 12:32:19 +01:00
|
|
|
strictDeps = true;
|
|
|
|
env.LUA = "${finalAttrs.finalPackage.passthru.luaEnv}/bin/lua";
|
2024-11-04 10:23:25 +02:00
|
|
|
|
|
|
|
enableParallelBuilding = true;
|
|
|
|
|
2022-06-01 16:48:25 +03:00
|
|
|
passthru = {
|
2024-11-28 19:18:08 +02:00
|
|
|
# Use this passthru variable to add packages to your lua environment. Use
|
|
|
|
# something like this in your development environment:
|
|
|
|
#
|
|
|
|
# myLuaEnv = lua.withPackages (
|
|
|
|
# ps: lib.attrVals (sile.passthru.luaPackages ++ [
|
|
|
|
# "lua-cjson"
|
|
|
|
# "lua-resty-http"
|
|
|
|
# ]) ps
|
|
|
|
# )
|
|
|
|
luaPackages =
|
2024-11-04 09:35:26 +02:00
|
|
|
[
|
2024-11-28 19:18:08 +02:00
|
|
|
"cassowary"
|
|
|
|
"cldr"
|
|
|
|
"fluent"
|
|
|
|
"linenoise"
|
|
|
|
"loadkit"
|
|
|
|
"lpeg"
|
|
|
|
"lua-zlib"
|
|
|
|
"lua_cliargs"
|
|
|
|
"luaepnf"
|
|
|
|
"luaexpat"
|
|
|
|
"luafilesystem"
|
|
|
|
"luarepl"
|
|
|
|
"luasec"
|
|
|
|
"luasocket"
|
|
|
|
"luautf8"
|
|
|
|
"penlight"
|
|
|
|
"vstruct"
|
2024-11-04 10:23:25 +02:00
|
|
|
# lua packages needed for testing
|
2024-11-28 19:18:08 +02:00
|
|
|
"busted"
|
|
|
|
"luacheck"
|
2024-11-04 10:23:25 +02:00
|
|
|
# packages needed for building api docs
|
2024-11-28 19:18:08 +02:00
|
|
|
"ldoc"
|
2024-11-04 10:23:25 +02:00
|
|
|
# NOTE: Add lua packages here, to change the luaEnv also read by `flake.nix`
|
2024-11-04 09:35:26 +02:00
|
|
|
]
|
|
|
|
++ lib.optionals (lib.versionOlder lua.luaversion "5.2") [
|
2024-11-28 19:18:08 +02:00
|
|
|
"bit32"
|
2024-11-04 09:35:26 +02:00
|
|
|
]
|
|
|
|
++ lib.optionals (lib.versionOlder lua.luaversion "5.3") [
|
2024-11-28 19:18:08 +02:00
|
|
|
"compat53"
|
|
|
|
];
|
|
|
|
luaEnv = lua.withPackages (ps: lib.attrVals finalAttrs.finalPackage.passthru.luaPackages ps);
|
2024-11-04 10:23:25 +02:00
|
|
|
|
2023-01-12 21:54:05 +01:00
|
|
|
# Copied from Makefile.am
|
|
|
|
tests.test = lib.optionalAttrs (!(stdenv.hostPlatform.isDarwin && stdenv.hostPlatform.isAarch64)) (
|
2024-11-04 10:23:25 +02:00
|
|
|
runCommand "${finalAttrs.pname}-test"
|
2023-01-12 21:54:05 +01:00
|
|
|
{
|
2024-11-04 09:33:14 +02:00
|
|
|
nativeBuildInputs = [
|
2025-02-27 16:43:46 +08:00
|
|
|
poppler-utils
|
2024-11-04 09:34:01 +02:00
|
|
|
finalAttrs.finalPackage
|
2024-11-04 09:33:14 +02:00
|
|
|
];
|
2023-09-21 11:31:17 +03:00
|
|
|
inherit (finalAttrs) FONTCONFIG_FILE;
|
2024-11-04 09:33:14 +02:00
|
|
|
}
|
|
|
|
''
|
|
|
|
output=$(mktemp -t selfcheck-XXXXXX.pdf)
|
|
|
|
echo "<sile>foo</sile>" | sile -o $output -
|
|
|
|
pdfinfo $output | grep "SILE v${finalAttrs.version}" > $out
|
|
|
|
''
|
|
|
|
);
|
2022-06-01 16:48:25 +03:00
|
|
|
};
|
2017-03-26 08:35:10 +00:00
|
|
|
|
2024-11-04 10:22:12 +02:00
|
|
|
meta = {
|
2017-02-04 18:30:00 +01:00
|
|
|
description = "Typesetting system";
|
|
|
|
longDescription = ''
|
2017-02-11 15:52:50 +01:00
|
|
|
SILE is a typesetting system; its job is to produce beautiful
|
|
|
|
printed documents. Conceptually, SILE is similar to TeX—from
|
|
|
|
which it borrows some concepts and even syntax and
|
|
|
|
algorithms—but 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.
|
2017-02-04 18:30:00 +01:00
|
|
|
'';
|
2021-09-02 12:31:16 +03:00
|
|
|
homepage = "https://sile-typesetter.org";
|
2023-09-21 11:31:17 +03:00
|
|
|
changelog = "https://github.com/sile-typesetter/sile/raw/v${finalAttrs.version}/CHANGELOG.md";
|
2024-11-04 10:22:12 +02:00
|
|
|
platforms = lib.platforms.unix;
|
|
|
|
maintainers = with lib.maintainers; [
|
2024-11-04 09:33:14 +02:00
|
|
|
doronbehar
|
|
|
|
alerque
|
|
|
|
];
|
2024-11-04 10:22:12 +02:00
|
|
|
license = lib.licenses.mit;
|
2023-11-23 03:51:17 +01:00
|
|
|
mainProgram = "sile";
|
2017-02-04 18:30:00 +01:00
|
|
|
};
|
2023-09-21 11:31:17 +03:00
|
|
|
})
|