1{
2 stdenv,
3 lib,
4 fetchFromGitHub,
5 flex,
6 bison,
7 qtbase,
8 qtcharts,
9 qttools,
10 qtsvg,
11 qtwayland,
12 wrapQtAppsHook,
13 libX11,
14 cmake,
15 gperf,
16 adms,
17 ngspice,
18 qucsator-rf,
19 kernels ? [
20 ngspice
21 qucsator-rf
22 ],
23}:
24
25stdenv.mkDerivation rec {
26 pname = "qucs-s";
27 version = "25.1.2";
28
29 src = fetchFromGitHub {
30 owner = "ra3xdh";
31 repo = "qucs_s";
32 rev = version;
33 hash = "sha256-+xPhHmuogNuolmMFcUAP2hMfJh1D+O4DrPkcuR6+mR8=";
34 };
35
36 postPatch = ''
37 # Workaround a CMake bug (we don't generally do distributable bundles in nixpkgs anyway):
38 # warning: cannot resolve item '/usr/lib/libSystem.B.dylib'
39 #
40 # possible problems:
41 # need more directories?
42 # need to use InstallRequiredSystemLibraries?
43 # run in install tree instead of build tree?
44 for filename in \
45 qucs/CMakeLists.txt \
46 qucs-transcalc/CMakeLists.txt \
47 qucs-attenuator/CMakeLists.txt \
48 qucs-s-spar-viewer/CMakeLists.txt \
49 ; do
50 substituteInPlace "$filename" \
51 --replace-fail 'fixup_bundle(' 'message(\"nixpkgs will not fixup_bundle: \" '
52 done
53 '';
54
55 nativeBuildInputs = [
56 flex
57 bison
58 wrapQtAppsHook
59 cmake
60 ];
61 buildInputs = [
62 qtbase
63 qttools
64 qtcharts
65 qtsvg
66 gperf
67 adms
68 ]
69 ++ lib.optionals stdenv.hostPlatform.isLinux [
70 qtwayland
71 libX11
72 ]
73 ++ kernels;
74
75 cmakeFlags = [
76 "-DWITH_QT6=ON"
77 ];
78
79 # Make custom kernels available from qucs-s
80 qtWrapperArgs = [
81 "--prefix"
82 "PATH"
83 ":"
84 (lib.makeBinPath kernels)
85 ];
86
87 QTDIR = qtbase.dev;
88
89 doInstallCheck = true;
90 installCheck = ''
91 $out/bin/qucs-s --version
92 '';
93
94 meta = with lib; {
95 description = "Spin-off of Qucs that allows custom simulation kernels";
96 longDescription = ''
97 Spin-off of Qucs that allows custom simulation kernels.
98 Default version is installed with ngspice.
99 '';
100 homepage = "https://ra3xdh.github.io/";
101 license = licenses.gpl2Plus;
102 mainProgram = "qucs-s";
103 maintainers = with maintainers; [
104 mazurel
105 kashw2
106 thomaslepoix
107 ];
108 platforms = with platforms; unix;
109 };
110}