1{ lib
2, stdenv
3, fetchurl
4, flex
5, bison
6, fftw
7, withNgshared ? true
8, libXaw
9, libXext
10}:
11
12stdenv.mkDerivation rec {
13 pname = "${lib.optionalString withNgshared "lib"}ngspice";
14 version = "42";
15
16 src = fetchurl {
17 url = "mirror://sourceforge/ngspice/ngspice-${version}.tar.gz";
18 hash = "sha256-c3/jhGqyMzolDfrfHtbr4YYK8dil/154A8dyzEJW5Qo=";
19 };
20
21 nativeBuildInputs = [
22 flex
23 bison
24 ];
25
26 buildInputs = [
27 fftw
28 ] ++ lib.optionals (!withNgshared) [
29 libXaw
30 libXext
31 ];
32
33 configureFlags = lib.optionals withNgshared [
34 "--with-ngshared"
35 ] ++ [
36 "--enable-xspice"
37 "--enable-cider"
38 ];
39
40 enableParallelBuilding = true;
41
42 meta = with lib; {
43 description = "The Next Generation Spice (Electronic Circuit Simulator)";
44 mainProgram = "ngspice";
45 homepage = "http://ngspice.sourceforge.net";
46 license = with licenses; [ bsd3 gpl2Plus lgpl2Plus ]; # See https://sourceforge.net/p/ngspice/ngspice/ci/master/tree/COPYING
47 maintainers = with maintainers; [ bgamari rongcuid ];
48 platforms = platforms.unix;
49 };
50}