diff --git a/pkgs/applications/science/electronics/ngspice/default.nix b/pkgs/applications/science/electronics/ngspice/default.nix deleted file mode 100644 index 15509a62de53..000000000000 --- a/pkgs/applications/science/electronics/ngspice/default.nix +++ /dev/null @@ -1,36 +0,0 @@ -{ lib, stdenv -, fetchurl -, bison -, flex -, readline -, libX11 -, libICE -, libXaw -, libXmu -, libXext -, libXt -, fftw -}: - -stdenv.mkDerivation rec { - pname = "ngspice"; - version = "37"; - - src = fetchurl { - url = "mirror://sourceforge/ngspice/ngspice-${version}.tar.gz"; - sha256 = "1gpcic6b6xk3g4956jcsqljf33kj5g43cahmydq6m8rn39sadvlv"; - }; - - nativeBuildInputs = [ flex bison ]; - buildInputs = [ readline libX11 libICE libXaw libXmu libXext libXt fftw ]; - - configureFlags = [ "--enable-x" "--with-x" "--with-readline" "--enable-xspice" "--enable-cider" ]; - - meta = with lib; { - description = "The Next Generation Spice (Electronic Circuit Simulator)"; - homepage = "http://ngspice.sourceforge.net"; - license = with licenses; [ "BSD" gpl2 ]; - maintainers = with maintainers; [ bgamari rongcuid ]; - platforms = platforms.unix; - }; -} diff --git a/pkgs/development/libraries/libngspice/default.nix b/pkgs/development/libraries/libngspice/default.nix index d394621be117..5537bb0ca4b1 100644 --- a/pkgs/development/libraries/libngspice/default.nix +++ b/pkgs/development/libraries/libngspice/default.nix @@ -1,26 +1,47 @@ -{lib, stdenv, fetchurl, bison, flex, fftw}: +{ lib +, stdenv +, fetchurl +, flex +, bison +, fftw +, withNgshared ? true +, libXaw +, libXext +}: -# Note that this does not provide the ngspice command-line utility. For that see -# the ngspice derivation. stdenv.mkDerivation rec { - pname = "libngspice"; + pname = "${lib.optionalString withNgshared "lib"}ngspice"; version = "40"; src = fetchurl { url = "mirror://sourceforge/ngspice/ngspice-${version}.tar.gz"; - sha256 = "sha256-4wPKe8D1lOLWqoT2h4VCPmvwyNrQCbsgvk1XQliOiQ0="; + hash = "sha256-4wPKe8D1lOLWqoT2h4VCPmvwyNrQCbsgvk1XQliOiQ0="; }; - nativeBuildInputs = [ flex bison ]; - buildInputs = [ fftw ]; + nativeBuildInputs = [ + flex + bison + ]; - configureFlags = [ "--with-ngshared" "--enable-xspice" "--enable-cider" ]; + buildInputs = [ + fftw + ] ++ lib.optionals (!withNgshared) [ + libXaw + libXext + ]; + + configureFlags = lib.optionals withNgshared [ + "--with-ngshared" + ] ++ [ + "--enable-xspice" + "--enable-cider" + ]; meta = with lib; { description = "The Next Generation Spice (Electronic Circuit Simulator)"; homepage = "http://ngspice.sourceforge.net"; license = with licenses; [ bsd3 gpl2Plus lgpl2Plus ]; # See https://sourceforge.net/p/ngspice/ngspice/ci/master/tree/COPYING - maintainers = with maintainers; [ bgamari ]; + maintainers = with maintainers; [ bgamari rongcuid ]; platforms = platforms.unix; }; } diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 12d50486e9f6..3bf86191ca8b 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -38397,7 +38397,9 @@ with pkgs; librepcb = libsForQt5.callPackage ../applications/science/electronics/librepcb { }; - ngspice = callPackage ../applications/science/electronics/ngspice { }; + ngspice = libngspice.override { + withNgshared = false; + }; nvc = darwin.apple_sdk_11_0.callPackage ../applications/science/electronics/nvc { };