sile: leverage lua environments

allows to simplify the implementation quite a bit
This commit is contained in:
Matthieu Coudron 2019-06-06 16:31:23 +09:00 committed by Vincent Laporte
parent 308706fe9e
commit f70b980def
2 changed files with 4 additions and 20 deletions

View File

@ -1,5 +1,5 @@
{ stdenv, darwin, fetchurl, makeWrapper, pkgconfig { stdenv, darwin, fetchurl, makeWrapper, pkgconfig
, harfbuzz, icu, lpeg, luaexpat, lua-zlib, luafilesystem, luasocket, luasec , harfbuzz, icu
, fontconfig, lua, libiconv , fontconfig, lua, libiconv
, makeFontsConf, gentium, gentium-book-basic, dejavu_fonts , makeFontsConf, gentium, gentium-book-basic, dejavu_fonts
}: }:
@ -7,13 +7,7 @@
with stdenv.lib; with stdenv.lib;
let let
luaEnv = lua.withPackages(ps: with ps;[ lpeg luaexpat lua-zlib luafilesystem luasocket luasec]);
libs = [ lpeg luaexpat lua-zlib luafilesystem luasocket luasec ];
getPath = lib : type : "${lib}/lib/lua/${lua.luaversion}/?.${type};${lib}/share/lua/${lua.luaversion}/?.${type}";
getLuaPath = lib : getPath lib "lua";
getLuaCPath = lib : getPath lib "so";
luaPath = concatStringsSep ";" (map getLuaPath libs);
luaCPath = concatStringsSep ";" (map getLuaCPath libs);
in in
@ -27,8 +21,7 @@ stdenv.mkDerivation rec {
}; };
nativeBuildInputs = [pkgconfig makeWrapper]; nativeBuildInputs = [pkgconfig makeWrapper];
buildInputs = [ harfbuzz icu lua fontconfig libiconv ] buildInputs = [ harfbuzz icu fontconfig libiconv luaEnv ]
++ libs
++ optional stdenv.isDarwin darwin.apple_sdk.frameworks.AppKit ++ optional stdenv.isDarwin darwin.apple_sdk.frameworks.AppKit
; ;
@ -38,9 +31,6 @@ stdenv.mkDerivation rec {
NIX_LDFLAGS = optionalString stdenv.isDarwin "-framework AppKit"; NIX_LDFLAGS = optionalString stdenv.isDarwin "-framework AppKit";
LUA_PATH = luaPath;
LUA_CPATH = luaCPath;
FONTCONFIG_FILE = makeFontsConf { FONTCONFIG_FILE = makeFontsConf {
fontDirectories = [ fontDirectories = [
gentium gentium
@ -60,10 +50,6 @@ stdenv.mkDerivation rec {
''; '';
postInstall = '' postInstall = ''
wrapProgram $out/bin/sile \
--set LUA_PATH "${luaPath};" \
--set LUA_CPATH "${luaCPath};" \
install -D -t $out/share/doc/sile documentation/*.pdf install -D -t $out/share/doc/sile documentation/*.pdf
''; '';

View File

@ -5857,9 +5857,7 @@ in
silc_server = callPackage ../servers/silc-server { }; silc_server = callPackage ../servers/silc-server { };
sile = callPackage ../tools/typesetting/sile { sile = callPackage ../tools/typesetting/sile { };
inherit (lua52Packages) lua luaexpat lua-zlib luafilesystem lpeg luasocket luasec;
};
silver-searcher = callPackage ../tools/text/silver-searcher { }; silver-searcher = callPackage ../tools/text/silver-searcher { };