nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 lib,
3 stdenv,
4 buildPythonPackage,
5 fetchPypi,
6 libngspice,
7 numpy,
8 ply,
9 scipy,
10 pyyaml,
11 cffi,
12 requests,
13 matplotlib,
14 setuptools,
15}:
16
17buildPythonPackage rec {
18 pname = "pyspice";
19 version = "1.5";
20 format = "setuptools";
21
22 src = fetchPypi {
23 pname = "PySpice";
24 inherit version;
25 sha256 = "d28448accad98959e0f5932af8736e90a1f3f9ff965121c6881d24cdfca23d22";
26 };
27
28 propagatedBuildInputs = [
29 setuptools
30 requests
31 pyyaml
32 cffi
33 matplotlib
34 numpy
35 ply
36 scipy
37 libngspice
38 ];
39
40 doCheck = false;
41 pythonImportsCheck = [ "PySpice" ];
42
43 postPatch = ''
44 substituteInPlace PySpice/Spice/NgSpice/Shared.py --replace \
45 "ffi.dlopen(self.library_path)" \
46 "ffi.dlopen('${libngspice}/lib/libngspice${stdenv.hostPlatform.extensions.sharedLibrary}')"
47 '';
48
49 meta = {
50 description = "Simulate electronic circuit using Python and the Ngspice / Xyce simulators";
51 homepage = "https://github.com/FabriceSalvaire/PySpice";
52 license = lib.licenses.gpl3Only;
53 maintainers = with lib.maintainers; [ matthuszagh ];
54 };
55}