From 6f3735f3829be2cc0b562c4990d93d6fb2457b35 Mon Sep 17 00:00:00 2001 From: lucasew Date: Tue, 10 Sep 2024 21:38:15 -0300 Subject: [PATCH 1/2] emiluaPlugins.qt5: init at 1.0.1 Signed-off-by: lucasew --- .../emilua-plugins/qt5/basic_test.lua | 12 +++ .../emilua-plugins/qt5/default.nix | 87 +++++++++++++++++++ pkgs/top-level/emilua-plugins.nix | 1 + 3 files changed, 100 insertions(+) create mode 100644 pkgs/development/emilua-plugins/qt5/basic_test.lua create mode 100644 pkgs/development/emilua-plugins/qt5/default.nix diff --git a/pkgs/development/emilua-plugins/qt5/basic_test.lua b/pkgs/development/emilua-plugins/qt5/basic_test.lua new file mode 100644 index 000000000000..5e37771a1ca5 --- /dev/null +++ b/pkgs/development/emilua-plugins/qt5/basic_test.lua @@ -0,0 +1,12 @@ +local qt = require 'qt5' +local qml = qt.load_qml(byte_span.append([[ + import QtQml 2.0 + QtObject { + function foobar(a: int, b: int): int { + return a + b + } + } +]])) +assert(qml.object('foobar(int,int)', 1, 2), 3) + +print("done 👍") diff --git a/pkgs/development/emilua-plugins/qt5/default.nix b/pkgs/development/emilua-plugins/qt5/default.nix new file mode 100644 index 000000000000..95b8919f723c --- /dev/null +++ b/pkgs/development/emilua-plugins/qt5/default.nix @@ -0,0 +1,87 @@ +{ + lib, + stdenv, + meson, + ninja, + fetchFromGitLab, + gperf, + gawk, + gitUpdater, + pkg-config, + boost, + luajit_openresty, + asciidoctor, + libsForQt5, + emilua, + liburing, + fmt, + runCommand, + xvfb-run, + qt5, # this +}: + +stdenv.mkDerivation rec { + pname = "emilua-qt5"; + version = "1.0.1"; + + src = fetchFromGitLab { + owner = "emilua"; + repo = "qt5"; + rev = "v${version}"; + hash = "sha256-FkBfzGzUX7dvHjWRBjVwppU4jZBbY02gP+fIta8mjIw="; + }; + + buildInputs = [ + luajit_openresty + boost + libsForQt5.qtdeclarative + emilua + liburing + fmt + libsForQt5.qtbase + ]; + + nativeBuildInputs = [ + gperf + gawk + pkg-config + asciidoctor + meson + ninja + libsForQt5.wrapQtAppsHook + libsForQt5.qttools + ]; + + passthru = { + updateScript = gitUpdater { rev-prefix = "v"; }; + tests.basic = + runCommand "test-basic-qt5" + { + buildInputs = [ + emilua + qt5 + libsForQt5.wrapQtAppsHook + xvfb-run + ]; + dontWrapQtApps = true; + } + '' + makeWrapper ${lib.getExe emilua} payload \ + ''${qtWrapperArgs[@]} \ + --add-flags ${./basic_test.lua} + xvfb-run ./payload + touch $out + ''; + }; + + meta = with lib; { + description = "Qt5 bindings for Emilua"; + homepage = "https://emilua.org/"; + license = licenses.boost; + maintainers = with maintainers; [ + manipuladordedados + lucasew + ]; + platforms = platforms.linux; + }; +} diff --git a/pkgs/top-level/emilua-plugins.nix b/pkgs/top-level/emilua-plugins.nix index a4387b18e653..82e779359546 100644 --- a/pkgs/top-level/emilua-plugins.nix +++ b/pkgs/top-level/emilua-plugins.nix @@ -9,4 +9,5 @@ emilua: (lib.makeScope newScope (self: { inherit emilua; beast = self.callPackage ../development/emilua-plugins/beast { }; + qt5 = self.callPackage ../development/emilua-plugins/qt5 { }; })) From 32741141c7e8d4c4a1f18eeaece38abdb66ce0fb Mon Sep 17 00:00:00 2001 From: lucasew Date: Tue, 10 Sep 2024 21:49:11 -0300 Subject: [PATCH 2/2] emiluaPlugins.qt6: init at 1.0.3 Signed-off-by: lucasew --- .../emilua-plugins/qt6/basic_test.lua | 12 +++ .../emilua-plugins/qt6/default.nix | 91 +++++++++++++++++++ pkgs/top-level/emilua-plugins.nix | 1 + 3 files changed, 104 insertions(+) create mode 100644 pkgs/development/emilua-plugins/qt6/basic_test.lua create mode 100644 pkgs/development/emilua-plugins/qt6/default.nix diff --git a/pkgs/development/emilua-plugins/qt6/basic_test.lua b/pkgs/development/emilua-plugins/qt6/basic_test.lua new file mode 100644 index 000000000000..1c3ca102520c --- /dev/null +++ b/pkgs/development/emilua-plugins/qt6/basic_test.lua @@ -0,0 +1,12 @@ +local qt = require 'qt6' +local qml = qt.load_qml(byte_span.append([[ + import QtQml 2.0 + QtObject { + function foobar(a: int, b: int): int { + return a + b + } + } +]])) +assert(qml.object('foobar(int,int)', 1, 2), 3) + +print("done 👍") diff --git a/pkgs/development/emilua-plugins/qt6/default.nix b/pkgs/development/emilua-plugins/qt6/default.nix new file mode 100644 index 000000000000..e8245200eccc --- /dev/null +++ b/pkgs/development/emilua-plugins/qt6/default.nix @@ -0,0 +1,91 @@ +{ + lib, + stdenv, + fetchFromGitLab, + asciidoctor, + ninja, + gperf, + gawk, + pkg-config, + boost, + luajit_openresty, + fmt, + meson, + emilua, + qt6Packages, + openssl, + liburing, + gitUpdater, + runCommand, + xvfb-run, + qt6, # this +}: + +stdenv.mkDerivation rec { + pname = "emilua-qt6"; + version = "1.0.3"; + + src = fetchFromGitLab { + owner = "emilua"; + repo = "qt6"; + rev = "v${version}"; + hash = "sha256-azMnM17HQMzC0ExgWurQzbR3fX9EwBRSu4kVTm3U2Ic="; + }; + + buildInputs = with qt6Packages; [ + qtbase + qtdeclarative + boost + luajit_openresty + emilua + fmt + openssl + liburing + ]; + + nativeBuildInputs = with qt6Packages; [ + qttools + wrapQtAppsHook + gperf + gawk + asciidoctor + pkg-config + meson + ninja + ]; + + passthru = { + updateScript = gitUpdater { rev-prefix = "v"; }; + tests.basic = + runCommand "test-basic-qt6" + { + buildInputs = [ + emilua + qt6 + qt6Packages.wrapQtAppsHook + qt6Packages.qtbase + qt6Packages.qtdeclarative + xvfb-run + ]; + dontWrapQtApps = true; + } + '' + makeWrapper ${lib.getExe emilua} payload \ + ''${qtWrapperArgs[@]} \ + --add-flags ${./basic_test.lua} + xvfb-run ./payload + touch $out + ''; + }; + + meta = with lib; { + description = "Qt6 bindings for Emilua"; + homepage = "https://emilua.org/"; + license = licenses.boost; + maintainers = with maintainers; [ + manipuladordedados + lucasew + ]; + platforms = platforms.linux; + }; +} diff --git a/pkgs/top-level/emilua-plugins.nix b/pkgs/top-level/emilua-plugins.nix index 82e779359546..eb220d4b3ab7 100644 --- a/pkgs/top-level/emilua-plugins.nix +++ b/pkgs/top-level/emilua-plugins.nix @@ -10,4 +10,5 @@ emilua: inherit emilua; beast = self.callPackage ../development/emilua-plugins/beast { }; qt5 = self.callPackage ../development/emilua-plugins/qt5 { }; + qt6 = self.callPackage ../development/emilua-plugins/qt6 { }; }))