24 , openssh # required by MPI
30 assert withMPI -> trilinos.withMPI;
35 # useing fetchurl or fetchFromGitHub doesn't include the manuals
36 # due to .gitattributes files
38 url = "https://github.com/Xyce/Xyce.git";
39 rev = "Release-${version}";
40 sha256 = "sha256-+aNy2bGuFQ517FZUvU0YqN0gmChRpVuFEmFGTCx9AgY=";
43 regression_src = fetchFromGitHub {
45 repo = "Xyce_Regression";
46 rev = "Release-${version}";
47 sha256 = "sha256-Fxi/NpXXIw/bseWaLi2iQ4sg4S9Z+othGgSvQoxyJ9c=";
51 stdenv.mkDerivation rec {
55 srcs = [ xyce_src regression_src ];
57 sourceRoot = xyce_src.name;
59 preConfigure = "./bootstrap";
63 "--enable-xyce-shareable"
67 ] ++ lib.optionals withMPI [
74 enableParallelBuilding = true;
81 ] ++ lib.optionals enableDocs [
82 (texliveMedium.withPackages (ps: with ps; [
102 ] ++ lib.optionals withMPI [ mpi ];
104 doCheck = enableTests;
107 pushd ../${regression_src.name}
108 find Netlists -type f -regex ".*\.sh\|.*\.pl" -exec chmod ugo+x {} \;
109 # some tests generate new files, some overwrite netlists
110 find . -type d -exec chmod u+w {} \;
111 find . -type f -name "*.cir" -exec chmod u+w {} \;
112 patchShebangs Netlists/ TestScripts/
113 # patch script generating functions
114 sed -i -E 's|/usr/bin/env perl|${lib.escapeRegex perl.outPath}/bin/perl|' \
115 TestScripts/XyceRegression/Testing/Netlists/RunOptions/runOptions.cir.sh
116 sed -i -E 's|/bin/sh|${lib.escapeRegex bash.outPath}/bin/sh|' \
117 TestScripts/XyceRegression/Testing/Netlists/RunOptions/runOptions.cir.sh
121 nativeCheckInputs = [
124 (python3.withPackages (ps: with ps; [ numpy scipy ]))
125 ] ++ lib.optionals withMPI [ mpi openssh ];
128 XYCE_BINARY="$(pwd)/src/Xyce"
129 EXECSTRING="${lib.optionalString withMPI "mpirun -np 2 "}$XYCE_BINARY"
130 TEST_ROOT="$(pwd)/../${regression_src.name}"
132 # Honor the TMP variable
133 sed -i -E 's|/tmp|\$TMP|' $TEST_ROOT/TestScripts/suggestXyceTagList.sh
135 EXLUDE_TESTS_FILE=$TMP/exclude_tests.$$
136 # Gold standard has additional ":R" suffix in result column label
137 echo "Output/HB/hb-step-tecplot.cir" >> $EXLUDE_TESTS_FILE
138 # This test makes Xyce access /sys/class/net when run with MPI
139 ${lib.optionalString withMPI "echo \"CommandLine/command_line.cir\" >> $EXLUDE_TESTS_FILE"}
141 $TEST_ROOT/TestScripts/run_xyce_regression \
142 --output="$(pwd)/Xyce_Test" \
143 --xyce_test="''${TEST_ROOT}" \
144 --taglist="$($TEST_ROOT/TestScripts/suggestXyceTagList.sh "$XYCE_BINARY" | sed -E -e 's/TAGLIST=([^ ]+).*/\1/' -e '2,$d')" \
145 --resultfile="$(pwd)/test_results" \
146 --excludelist="$EXLUDE_TESTS_FILE" \
150 outputs = [ "out" "doc" ];
152 postInstall = lib.optionalString enableDocs ''
153 local docFiles=("doc/Users_Guide/Xyce_UG"
154 "doc/Reference_Guide/Xyce_RG"
155 "doc/Release_Notes/Release_Notes_${lib.versions.majorMinor version}/Release_Notes_${lib.versions.majorMinor version}")
157 # SANDIA LaTeX class and some organization logos are not publicly available see
158 # https://groups.google.com/g/xyce-users/c/MxeViRo8CT4/m/ppCY7ePLEAAJ
159 for img in "snllineblubrd" "snllineblk" "DOEbwlogo" "NNSA_logo"; do
160 sed -i -E "s/\\includegraphics\[height=(0.[1-9]in)\]\{$img\}/\\mbox\{\\rule\{0mm\}\{\1\}\}/" ''${docFiles[2]}.tex
163 install -d $doc/share/doc/${pname}-${version}/
164 for d in ''${docFiles[@]}; do
165 # Use a public document class
166 sed -i -E 's/\\documentclass\[11pt,report\]\{SANDreport\}/\\documentclass\[11pt,letterpaper\]\{scrreprt\}/' $d.tex
167 sed -i -E 's/\\usepackage\[sand\]\{optional\}/\\usepackage\[report\]\{optional\}/' $d.tex
170 install -t $doc/share/doc/${pname}-${version}/ $(basename $d.pdf)
176 broken = (stdenv.hostPlatform.isLinux && stdenv.hostPlatform.isAarch64) || stdenv.hostPlatform.isDarwin;
177 description = "High-performance analog circuit simulator";
179 Xyce is a SPICE-compatible, high-performance analog circuit simulator,
180 capable of solving extremely large circuit problems by supporting
181 large-scale parallel computing platforms.
183 homepage = "https://xyce.sandia.gov";
184 license = licenses.gpl3;
185 maintainers = with maintainers; [ fbeffa ];
186 platforms = platforms.all;