From dbc71b6cbf7bf42b6f223fffbcd7158c41fb9558 Mon Sep 17 00:00:00 2001 From: Naoki Pross Date: Wed, 20 Oct 2021 22:57:30 +0200 Subject: Prepare nix env for dearpygui ui --- src/dearpygui.nix | 37 +++++++++++++++++++++++++++++++++++++ src/demo.py | 12 ++++++++++++ src/shell.nix | 25 +++++++++++++++++++++++++ 3 files changed, 74 insertions(+) create mode 100644 src/dearpygui.nix create mode 100644 src/demo.py create mode 100644 src/shell.nix diff --git a/src/dearpygui.nix b/src/dearpygui.nix new file mode 100644 index 0000000..1b26eaf --- /dev/null +++ b/src/dearpygui.nix @@ -0,0 +1,37 @@ +{ lib, pkgs, buildPythonPackage, fetchPypi, isPy38, autoPatchelfHook }: + +assert isPy38; + +buildPythonPackage rec { + pname = "dearpygui"; + version = "1.0.2"; + format = "wheel"; + + # src = fetchFromGitHub { + # owner = "hoffstadt"; + # repo = "DearPyGui"; + # rev = "v${version}"; + # sha256 = "094s1r1jjgj6512dp5z5gn50m5g5b7qg6c2wgxhjsn38mxivpd2h"; + # fetchSubmodules = true; + # }; + + src = fetchPypi { + inherit pname version format; + python = "cp38"; + abi = "cp38"; + platform = "manylinux1_x86_64"; + sha256 = "10y8a3v135pziknnrzg8x5q5l6p7jvxgva8r8l5vjhdq9p5mxnab"; + }; + + # dontUseCmakeConfigure = false; + # nativeBuildInputs = with pkgs; [ cmake ]; + nativeBuildInputs = [ autoPatchelfHook ]; + + buildInputs = (with pkgs; [ + libGL libGL_driver + ]) ++ (with pkgs.xorg; [ + libX11 libXrandr libXinerama libXcursor libXi + ]); + + meta = with lib; {}; +} diff --git a/src/demo.py b/src/demo.py new file mode 100644 index 0000000..01e2d96 --- /dev/null +++ b/src/demo.py @@ -0,0 +1,12 @@ +from dearpygui import dearpygui as dpg +from dearpygui.demo import show_demo + +dpg.create_context() +dpg.create_viewport() +dpg.setup_dearpygui() + +show_demo() + +dpg.show_viewport() +dpg.start_dearpygui() +dpg.destroy_context() diff --git a/src/shell.nix b/src/shell.nix new file mode 100644 index 0000000..4503a49 --- /dev/null +++ b/src/shell.nix @@ -0,0 +1,25 @@ +# vim: set ts=2 sw=2 et: +with import {}; +let + dearpygui = callPackage ./dearpygui.nix { + buildPythonPackage = pkgs.python38Packages.buildPythonPackage; + fetchPypi = pkgs.python38Packages.fetchPypi; + isPy38 = pkgs.python38Packages.isPy38; + }; + +in mkShell { + buildInputs = [ dearpygui ] ++ (with pkgs; []); +} + +# (pkgs.buildFHSUserEnv { +# name = "pipzone"; +# targetPkgs = pkgs: (with pkgs; [ +# python38 +# python38Packages.pip +# python38Packages.virtualenv +# libGL +# libGL_driver +# xorg.libX11 +# ]); +# runScript = "bash"; +# }).env -- cgit v1.2.1