emilua: bump + plugin support (#339898)

This commit is contained in:
Thiago Kenji Okada 2024-09-06 14:45:33 +01:00 committed by GitHub
commit 6427bcad3b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 113 additions and 17 deletions

View File

@ -0,0 +1,37 @@
{
stdenv,
emilua,
meson,
gperf,
ninja,
asciidoctor,
pkg-config,
fetchFromGitLab,
gitUpdater,
}:
stdenv.mkDerivation (self: {
pname = "emilua_beast";
version = "1.1.0";
src = fetchFromGitLab {
owner = "emilua";
repo = "beast";
rev = "v${self.version}";
hash = "sha256-HvfEigHJTZelPvHFk22PWxkTFEajHJXfiCndxXHVgq8=";
};
buildInputs = [
emilua
asciidoctor
gperf
];
nativeBuildInputs = [
meson
pkg-config
ninja
];
passthru.updateScript = gitUpdater { rev-prefix = "v"; };
})

View File

@ -22,6 +22,7 @@
cmake,
asciidoctor,
makeWrapper,
gitUpdater
}:
let
@ -29,24 +30,41 @@ let
owner = "breese";
repo = "trial.protocol";
rev = "79149f604a49b8dfec57857ca28aaf508069b669";
name = "trial-protocol";
hash = "sha256-Xd8bX3z9PZWU17N9R95HXdj6qo9at5FBL/+PTVaJgkw=";
sparseCheckout = [
"include"
];
hash = "sha256-QpQ70KDcJyR67PtOowAF6w48GitMJ700B8HiEwDA5sU=";
postFetch = ''
rm $out/*.*
mkdir -p $out/lib/pkgconfig
cat > $out/lib/pkgconfig/trial-protocol.pc << EOF
Name: trial.protocol
Version: 0-unstable-2023-02-10
Description: C++ header-only library with parsers and generators for network wire protocols
Requires:
Libs:
Cflags:
EOF
'';
};
boost = boost182;
in
stdenv.mkDerivation rec {
stdenv.mkDerivation (self: {
pname = "emilua";
version = "0.7.3";
version = "0.10.1";
src = fetchFromGitLab {
owner = "emilua";
repo = "emilua";
rev = "v${version}";
hash = "sha256-j8ohhqHjSBgc4Xk9PcQNrbADmsz4VH2zCv+UNqiCv4I=";
rev = "v${self.version}";
hash = "sha256-D6XKXik9nWQ6t6EF6dLbRGB60iFbPUM8/H8iFAz1QlE=";
};
buildInputs = [
propagatedBuildInputs = [
luajit_openresty
boost182
boost
fmt
ncurses
serd
@ -55,6 +73,7 @@ stdenv.mkDerivation rec {
liburing
openssl
cereal
trial-protocol-wrap
];
nativeBuildInputs = [
@ -80,12 +99,6 @@ stdenv.mkDerivation rec {
];
postPatch = ''
pushd subprojects
cp -r ${trial-protocol-wrap} trial-protocol
chmod +w trial-protocol
cp "packagefiles/trial.protocol/meson.build" "trial-protocol/"
popd
patchShebangs src/emilua_gperf.awk --interpreter '${lib.getExe gawk} -f'
'';
@ -97,12 +110,25 @@ stdenv.mkDerivation rec {
"--no-suite" "libpsx"
];
postInstall = ''
mkdir -p $out/nix-support
cp ${./setup-hook.sh} $out/nix-support/setup-hook
substituteInPlace $out/nix-support/setup-hook \
--replace @sitePackages@ "${self.passthru.sitePackages}"
'';
passthru = {
updateScript = gitUpdater {rev-prefix = "v";};
inherit boost;
sitePackages = "lib/emilua-${(lib.concatStringsSep "." (lib.take 2 (lib.splitVersion self.version)))}";
};
meta = with lib; {
description = "Lua execution engine";
mainProgram = "emilua";
homepage = "https://emilua.org/";
license = licenses.boost;
maintainers = with maintainers; [ manipuladordedados ];
maintainers = with maintainers; [ manipuladordedados lucasew ];
platforms = platforms.linux;
};
}
})

View File

@ -0,0 +1,17 @@
addEmiluaPath() {
addToSearchPathWithCustomDelimiter : EMILUA_PATH $1/@sitePackages@
}
toEmiluaPath() {
local paths="$1"
local result=
for i in $paths; do
p="$i/@sitePackages@"
result="${result}${result:+:}$p"
done
echo $result
}
if [ -z "${dontAddEmiluaPath:-}" ]; then
addEnvHooks "$hostOffset" addEmiluaPath
fi

View File

@ -16620,7 +16620,11 @@ with pkgs;
zuo = callPackage ../development/interpreters/zuo { };
### LUA interpreters
emilua = callPackage ../development/interpreters/emilua { };
emiluaPlugins = recurseIntoAttrs
(callPackage ./emilua-plugins.nix {}
(callPackage ../development/interpreters/emilua { }));
inherit (emiluaPlugins) emilua;
luaInterpreters = callPackage ./../development/interpreters/lua-5 { };
inherit (luaInterpreters) lua5_1 lua5_2 lua5_2_compat lua5_3 lua5_3_compat lua5_4 lua5_4_compat luajit_2_1 luajit_2_0 luajit_openresty;

View File

@ -0,0 +1,12 @@
{
lib,
newScope,
pkgs,
config,
}:
emilua:
(lib.makeScope newScope (self: {
inherit emilua;
beast = self.callPackage ../development/emilua-plugins/beast { };
}))