Merge pull request #279936 from lucasew/flet-oob

flet: fix out of the box experience
This commit is contained in:
Weijia Wang 2024-03-19 22:45:43 +01:00 committed by GitHub
commit 5ce921d6d2
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
8 changed files with 1650 additions and 23 deletions

View file

@ -0,0 +1,64 @@
{ lib
, fetchFromGitHub
, pkg-config
, flutter
, gst_all_1
, libunwind
, makeWrapper
, mimalloc
, orc
, nix-update-script
, mpv-unwrapped
, libplacebo
}:
flutter.buildFlutterApplication rec {
pname = "flet-client-flutter";
version = "0.21.1";
src = fetchFromGitHub {
owner = "flet-dev";
repo = "flet";
rev = "v${version}";
hash = "sha256-7zAcjek4iZRsNRVA85KBtU7PGbnLDZjnEO8Q5xwBiwM=";
};
sourceRoot = "${src.name}/client";
cmakeFlags = [
"-DMIMALLOC_LIB=${mimalloc}/lib/mimalloc.o"
];
pubspecLock = lib.importJSON ./pubspec.lock.json;
nativeBuildInputs = [
makeWrapper
mimalloc
pkg-config
];
buildInputs = [
mpv-unwrapped
gst_all_1.gst-libav
gst_all_1.gst-plugins-base
gst_all_1.gst-vaapi
gst_all_1.gstreamer
libunwind
orc
mimalloc
]
++ mpv-unwrapped.buildInputs
++ libplacebo.buildInputs
;
passthru.updateScript = nix-update-script { };
meta = {
description = "A framework that enables you to easily build realtime web, mobile, and desktop apps in Python. The frontend part";
homepage = "https://flet.dev/";
changelog = "https://github.com/flet-dev/flet/releases/tag/v${version}";
license = lib.licenses.asl20;
maintainers = with lib.maintainers; [ heyimnova lucasew ];
mainProgram = "flet";
};
}

File diff suppressed because it is too large Load diff

View file

@ -4,6 +4,7 @@
flutter_secure_storage_linux = callPackage ./flutter-secure-storage-linux { };
handy_window = callPackage ./handy-window { };
matrix = callPackage ./matrix { };
media_kit_libs_linux = callPackage ./media_kit_libs_linux { };
olm = callPackage ./olm { };
system_tray = callPackage ./system-tray { };
}

View file

@ -0,0 +1,33 @@
{ stdenv
}:
# Implementation notes
# The patch exploits the fact that the download part is enclosed with "# ---"
# To use this module you will need to pass the CMake variable MIMALLOC_LIB
# example: -DMIMALLOC_LIB=${pkgs.mimalloc}/lib/mimalloc.o
# Direct link for the original CMakeLists.txt: https://raw.githubusercontent.com/media-kit/media-kit/main/libs/linux/media_kit_libs_linux/linux/CMakeLists.txt
{version, src, ...}:
stdenv.mkDerivation {
pname = "media_kit_libs_linux";
inherit version src;
inherit (src) passthru;
doBuild = false;
postPatch = ''
awk -i inplace 'BEGIN {opened = 0}; /# --*[^$]*/ { print (opened ? "]===]" : "#[===["); opened = !opened }; {print $0}' linux/CMakeLists.txt
'';
installPhase = ''
runHook preInstall
mkdir -p "$out"
cp -r ./* "$out"
runHook postInstall
'';
}

View file

@ -1,6 +1,6 @@
{ lib
, buildPythonPackage
, fetchPypi
, flet-client-flutter
# build-system
, poetry-core
@ -12,14 +12,10 @@
buildPythonPackage rec {
pname = "flet-core";
version = "0.21.1";
inherit (flet-client-flutter) version src;
pyproject = true;
src = fetchPypi {
pname = "flet_core";
inherit version;
hash = "sha256-PZY4aRj/zBuHHIPHkEbZ1oXGnJyeCOqP9Pp8jYbOZ4I=";
};
sourceRoot = "${src.name}/sdk/python/packages/flet-core";
nativeBuildInputs = [
poetry-core
@ -37,6 +33,6 @@ buildPythonPackage rec {
description = "The library is the foundation of Flet framework and is not intended to be used directly";
homepage = "https://flet.dev/";
license = lib.licenses.asl20;
maintainers = [ lib.maintainers.heyimnova ];
maintainers = with lib.maintainers; [ heyimnova lucasew ];
};
}

View file

@ -0,0 +1,3 @@
import os
if 'FLET_VIEW_PATH' not in os.environ:
os.environ["FLET_VIEW_PATH"] = "@flet-client-flutter@/bin"

View file

@ -1,6 +1,6 @@
{ lib
, buildPythonPackage
, fetchPypi
, flet-client-flutter
, poetry-core
, pythonRelaxDepsHook
, flet-core
@ -10,14 +10,18 @@
buildPythonPackage rec {
pname = "flet-runtime";
version = "0.21.1";
inherit (flet-client-flutter) version src;
pyproject = true;
src = fetchPypi {
pname = "flet_runtime";
inherit version;
hash = "sha256-48diTMTWbiZNF4jU6ABgWYsdhNNs3bte7brgdEJE3es=";
};
sourceRoot = "${src.name}/sdk/python/packages/flet-runtime";
postPatch = ''
substitute ${./_setup_runtime.py} src/flet_runtime/_setup_runtime.py \
--replace @flet-client-flutter@ ${flet-client-flutter}
echo -e "import flet_runtime._setup_runtime\n$(cat src/flet_runtime/__init__.py)" > src/flet_runtime/__init__.py
'';
nativeBuildInputs = [
poetry-core
@ -43,6 +47,6 @@ buildPythonPackage rec {
description = "A base package for Flet desktop and Flet mobile";
homepage = "https://flet.dev/";
license = lib.licenses.asl20;
maintainers = [ lib.maintainers.wegank ];
maintainers = with lib.maintainers; [ lucasew wegank ];
};
}

View file

@ -1,6 +1,6 @@
{ lib
, buildPythonPackage
, fetchPypi
, flet-client-flutter
, pythonRelaxDepsHook
# build-system
@ -24,13 +24,11 @@
buildPythonPackage rec {
pname = "flet";
version = "0.21.1";
inherit (flet-client-flutter) version src;
pyproject = true;
src = fetchPypi {
inherit pname version;
hash = "sha256-YAMZku8jbdQ8JvUr5aLATIGIiTDmG6CGvfUKo28q7ks=";
};
sourceRoot = "${src.name}/sdk/python/packages/flet";
nativeBuildInputs = [
poetry-core
@ -39,6 +37,8 @@ buildPythonPackage rec {
pythonRelaxDeps = [
"websockets"
"cookiecutter"
"watchdog"
];
propagatedBuildInputs = [
@ -54,6 +54,8 @@ buildPythonPackage rec {
packaging
qrcode
cookiecutter
fastapi
uvicorn
];
doCheck = false;
@ -67,7 +69,7 @@ buildPythonPackage rec {
homepage = "https://flet.dev/";
changelog = "https://github.com/flet-dev/flet/releases/tag/v${version}";
license = lib.licenses.asl20;
maintainers = [ lib.maintainers.heyimnova ];
maintainers = with lib.maintainers; [ heyimnova lucasew ];
mainProgram = "flet";
};
}