Unverified Commit 6427bcad authored by Thiago Kenji Okada's avatar Thiago Kenji Okada Committed by GitHub
Browse files

emilua: bump + plugin support (#339898)

parents 0fd01c01 b9732794
Loading
Loading
Loading
Loading
+37 −0
Original line number Diff line number Diff line
{
  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"; };
})
+42 −16
Original line number Diff line number Diff line
@@ -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;
  };
}
})
+17 −0
Original line number Diff line number Diff line
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
+5 −1
Original line number Diff line number Diff line
@@ -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;
+12 −0
Original line number Diff line number Diff line
{
  lib,
  newScope,
  pkgs,
  config,
}:

emilua:
(lib.makeScope newScope (self: {
  inherit emilua;
  beast = self.callPackage ../development/emilua-plugins/beast { };
}))