clan-app: packaged c webui lib

This commit is contained in:
Qubasa
2024-12-30 18:05:17 +01:00
parent 27511abe4f
commit 323a3a0e92
6 changed files with 102 additions and 2 deletions

View File

@@ -40,6 +40,7 @@ let
libadwaita
webkitgtk_6_0
adwaita-icon-theme
];
# Deps including python packages from the local project

View File

@@ -14,7 +14,7 @@
else
{
devShells.clan-app = pkgs.callPackage ./shell.nix {
inherit (config.packages) clan-app;
inherit (config.packages) clan-app webview-wrapper;
inherit self';
};
packages.clan-app = pkgs.python3.pkgs.callPackage ./default.nix {

View File

@@ -12,6 +12,8 @@
python3,
gtk4,
libadwaita,
webview-wrapper,
clang,
self',
}:
@@ -36,6 +38,8 @@ mkShell {
glib
ruff
gtk4
clang
webview-wrapper
gtk4.dev # has the demo called 'gtk4-widget-factory'
libadwaita.devdoc # has the demo called 'adwaita-1-demo'
]
@@ -51,7 +55,6 @@ mkShell {
export GIT_ROOT=$(git rev-parse --show-toplevel)
export PKG_ROOT=$GIT_ROOT/pkgs/clan-app
export WEBKIT_DISABLE_COMPOSITING_MODE=1
# Add current package to PYTHONPATH
export PYTHONPATH="$PKG_ROOT''${PYTHONPATH:+:$PYTHONPATH:}"

View File

@@ -33,6 +33,7 @@
editor = pkgs.callPackage ./editor/clan-edit-codium.nix { };
classgen = pkgs.callPackage ./classgen { };
zerotierone = pkgs.callPackage ./zerotierone { };
webview-wrapper = pkgs.callPackage ./webview-wrapper { };
};
};
}

View File

@@ -0,0 +1,56 @@
{ lib
, buildPythonPackage
, fetchFromGitHub
# build-system dependencies
, setuptools
, wheel
, webview-wrapper
}:
buildPythonPackage rec {
pname = "python-webui";
version = "main";
src = fetchFromGitHub {
owner = "webui-dev";
repo = "python-webui";
rev = "fa961b5ee0752c9408ac01519097f5481a0fcecf"; # Replace with specific commit hash for reproducibility
# sha256 = "sha256-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA="; # Replace with actual hash via nix-prefetch-git
};
sourceRoot = "PyPI/Package";
# Indicate this is a recent Python project with PEP 517 support (pyproject.toml)
pyproject = true;
# Declare the build system (setuptools and wheel are common)
buildInputs = [
setuptools
wheel
];
# Declare required Python package dependencies
propagatedBuildInputs = [
];
# Native inputs for testing, if tests are included
nativeCheckInputs = [
];
# If tests don't work out of the box or need adjustments, patches can be applied here
postPatch = ''
# Example: Modify or patch some test files
echo "No postPatch modifications applied yet."
'';
meta = with lib; {
description = "A Python library for webui-dev";
homepage = "https://github.com/webui-dev/python-webui";
license = licenses.mit;
maintainers = [ maintainers.yourname ];
};
}

View File

@@ -0,0 +1,39 @@
{ pkgs }:
pkgs.stdenv.mkDerivation rec {
pname = "webui";
version = "nigthly";
src = pkgs.fetchFromGitHub {
owner = "webui-dev";
repo = "python-webui";
rev = "0ff3b1351b9e24be4463b1baf2c26966caeae74a"; # Use a specific commit sha or tag for reproducibility
sha256 = "sha256-xSOnCkW4iZkSSLKzk6r3hewC3bPJlV7L6aoGEchyEys="; # Replace with actual sha256
};
outputs = [ "out" "dev" ];
# Dependencies used during the build process, if any
buildInputs = [
pkgs.gnumake
];
# Commands to build and install the project
buildPhase = ''
make
'';
installPhase = ''
mkdir -p $out/lib
mkdir -p $out/include
cp -r dist/* $out/lib
cp -r include/* $out/include
'';
meta = with pkgs.lib; {
description = "Webui is a UI library for C/C++/Go/Rust to build portable desktop/web apps using WebView";
homepage = "https://github.com/webui-dev/webui";
license = licenses.mit;
platforms = platforms.linux ++ platforms.darwin; # Adjust if needed
};
}