From 78c4dd6b405407a38305be2af030feb6021c37f2 Mon Sep 17 00:00:00 2001 From: Ethan Rooke Date: Thu, 10 Oct 2024 09:02:52 -0500 Subject: [PATCH] cq-editor: init --- flake.nix | 2 +- pkgs/cq-editor/default.nix | 95 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 96 insertions(+), 1 deletion(-) create mode 100644 pkgs/cq-editor/default.nix diff --git a/flake.nix b/flake.nix index 4467103..b14d440 100644 --- a/flake.nix +++ b/flake.nix @@ -17,7 +17,7 @@ overlays.default = overlay; - packages.${system}.default = pkgs.python3.withPackages (ps: [ ps.cadquery ]); + packages.${system}.default = pkgs.cq-editor; checks.${system} = { deadcode = diff --git a/pkgs/cq-editor/default.nix b/pkgs/cq-editor/default.nix new file mode 100644 index 0000000..adfa741 --- /dev/null +++ b/pkgs/cq-editor/default.nix @@ -0,0 +1,95 @@ +{ lib +, fetchFromGitHub +, makeDesktopItem +, copyDesktopItems +, python3Packages +, qt5 +}: +let + rev = "089bb86"; +in +python3Packages.buildPythonApplication { + pname = "cq-editor"; + version = rev; + + src = fetchFromGitHub { + owner = "CadQuery"; + repo = "CQ-editor"; + rev = rev; + hash = "sha256-VYWjOclpH3mfI/6bj4oMKvTj3plAR3mBYTHZE3bkW70="; + }; + + dependencies = with python3Packages; [ + cadquery + logbook + nlopt + pyqt5 + pyparsing + pyqtgraph + cq-kit + cq-warehouse + spyder + pathpy + qtconsole + requests + ]; + + build-system = with python3Packages; [ setuptools ]; + + nativeBuildInputs = [ + copyDesktopItems + qt5.wrapQtAppsHook + ]; + + # cq-editor crashes when trying to use Wayland, so force xcb + qtWrapperArgs = [ "--set QT_QPA_PLATFORM xcb" ]; + + postFixup = '' + wrapQtApp "$out/bin/cq-editor" + ''; + + postInstall = '' + install -Dm644 icons/cadquery_logo_dark.svg $out/share/icons/hicolor/scalable/apps/cadquery.svg + + rm $out/bin/CQ-editor + ''; + + nativeCheckInputs = with python3Packages; [ + pytestCheckHook + pytest-xvfb + pytest-mock + pytestcov + pytest-repeat + pytest-qt + ]; + + # requires X server + doCheck = false; + + desktopItems = [ + (makeDesktopItem { + name = "com.cadquery.CadQuery"; + desktopName = "CadQuery"; + icon = "cadquery"; + exec = "cq-editor %f"; + categories = [ + "Graphics" + "3DGraphics" + "Engineering" + ]; + type = "Application"; + comment = "CadQuery GUI editor based on PyQT"; + }) + ]; + + meta = with lib; { + description = "CadQuery GUI editor based on PyQT"; + homepage = "https://github.com/CadQuery/CQ-editor"; + license = licenses.asl20; + maintainers = with maintainers; [ + costrouc + marcus7070 + ]; + }; + +}