1{
2 lib,
3 python3Packages,
4 fetchPypi,
5 qt6,
6}:
7
8python3Packages.buildPythonApplication rec {
9 pname = "veusz";
10 version = "4.1";
11 format = "setuptools";
12
13 src = fetchPypi {
14 inherit pname version;
15 hash = "sha256-s7TaDnt+nEIAmAqiZf9aYPFWVtSX22Ruz8eMpxMRr0U=";
16 };
17
18 nativeBuildInputs = [
19 python3Packages.sip
20 python3Packages.tomli
21 qt6.qmake
22 qt6.wrapQtAppsHook
23 ];
24
25 dontUseQmakeConfigure = true;
26
27 buildInputs = [ qt6.qtbase ];
28
29 # veusz is a script and not an ELF-executable, so wrapQtAppsHook will not wrap
30 # it automatically -> we have to do it explicitly
31 dontWrapQtApps = true;
32 preFixup = ''
33 wrapQtApp "$out/bin/veusz"
34 '';
35
36 # pyqt_setuptools.py uses the platlib path from sysconfig, but NixOS doesn't
37 # really have a corresponding path, so patching the location of PyQt5 inplace
38 postPatch = ''
39 substituteInPlace pyqt_setuptools.py \
40 --replace-fail "get_path('platlib')" "'${python3Packages.pyqt5}/${python3Packages.python.sitePackages}'"
41 patchShebangs tests/runselftest.py
42 '';
43
44 # you can find these options at
45 # https://github.com/veusz/veusz/blob/53b99dffa999f2bc41fdc5335d7797ae857c761f/pyqtdistutils.py#L71
46 setupPyBuildFlags = [
47 # veusz tries to find a libinfix and fails without one
48 # but we simply don't need a libinfix, so set it to empty here
49 "--qt-libinfix="
50 ];
51
52 dependencies = with python3Packages; [
53 numpy
54 pyqt6
55 # optional requirements:
56 dbus-python
57 h5py
58 # astropy -- fails to build on master
59 # optional TODO: add iminuit, pyemf and sampy
60 ];
61
62 installCheckPhase = ''
63 runHook preInstallCheck
64
65 wrapQtApp "tests/runselftest.py"
66 QT_QPA_PLATFORM=minimal tests/runselftest.py
67
68 runHook postInstallCheck
69 '';
70
71 meta = {
72 description = "Scientific plotting and graphing program with a GUI";
73 mainProgram = "veusz";
74 homepage = "https://veusz.github.io/";
75 license = lib.licenses.gpl2Plus;
76 platforms = lib.platforms.linux;
77 maintainers = with lib.maintainers; [ laikq ];
78 };
79}