diff options
Diffstat (limited to 'nixpkgs/pkgs/applications/science/electronics')
75 files changed, 5025 insertions, 0 deletions
diff --git a/nixpkgs/pkgs/applications/science/electronics/adms/default.nix b/nixpkgs/pkgs/applications/science/electronics/adms/default.nix new file mode 100644 index 000000000000..7b7e2a1af63a --- /dev/null +++ b/nixpkgs/pkgs/applications/science/electronics/adms/default.nix @@ -0,0 +1,26 @@ +{ lib, stdenv, fetchFromGitHub, autoreconfHook, flex, bison, gperf, + libxml2, perl, perlPackages, gd }: + +stdenv.mkDerivation rec { + version = "2.3.7"; + pname = "adms"; + + src = fetchFromGitHub { + owner = "Qucs"; + repo = "adms"; + rev = "release-${version}"; + sha256 = "0i37c9k6q1iglmzp9736rrgsnx7sw8xn3djqbbjw29zsyl3pf62c"; + }; + + nativeBuildInputs = [ autoreconfHook ]; + buildInputs = [ flex bison gperf libxml2 perl gd perlPackages.XMLLibXML ]; + configureFlags = [ "--enable-maintainer-mode" ]; + + meta = { + description = "automatic device model synthesizer"; + homepage = "https://github.com/Qucs/adms"; + license = lib.licenses.gpl3; + maintainers = with lib.maintainers; [disassembler]; + platforms = with lib.platforms; linux; + }; +} diff --git a/nixpkgs/pkgs/applications/science/electronics/alliance/default.nix b/nixpkgs/pkgs/applications/science/electronics/alliance/default.nix new file mode 100644 index 000000000000..f4333be8475e --- /dev/null +++ b/nixpkgs/pkgs/applications/science/electronics/alliance/default.nix @@ -0,0 +1,58 @@ +{ lib, stdenv, fetchFromGitLab, xorgproto, motif, libX11, libXt, libXpm, bison +, flex, automake, autoconf, libtool +}: + +stdenv.mkDerivation rec { + pname = "alliance"; + version = "unstable-2022-01-13"; + + src = fetchFromGitLab { + domain = "gitlab.lip6.fr"; + owner = "vlsi-eda"; + repo = "alliance"; + rev = "ebece102e15c110fc79f1da50524c68fd9523f0c"; + hash = "sha256-NGtE3ZmN9LrgXG4NIKrp7dFRVzrKMoudlPUtYYKrZjY="; + }; + + prePatch = "cd alliance/src"; + + nativeBuildInputs = [ libtool automake autoconf flex ]; + buildInputs = [ xorgproto motif libX11 libXt libXpm bison ]; + + # Disable parallel build, errors: + # ./pat_decl_y.y:736:5: error: expected '=', ... + enableParallelBuilding = false; + + ALLIANCE_TOP = placeholder "out"; + + configureFlags = [ + "--prefix=${placeholder "out"}" "--enable-alc-shared" + ]; + + postPatch = '' + # texlive for docs seems extreme + substituteInPlace autostuff \ + --replace "$newdirs documentation" "$newdirs" + + substituteInPlace sea/src/DEF_grammar_lex.l --replace "ifndef FLEX_BETA" \ + "if (YY_FLEX_MAJOR_VERSION <= 2) && (YY_FLEX_MINOR_VERSION < 6)" + + ./autostuff + ''; + + postInstall = '' + sed -i "s|ALLIANCE_TOP|$out|" distrib/*.desktop + mkdir -p $out/share/applications + cp -p distrib/*.desktop $out/share/applications/ + mkdir -p $out/icons/hicolor/48x48/apps/ + cp -p distrib/*.png $out/icons/hicolor/48x48/apps/ + ''; + + meta = with lib; { + description = "(deprecated) Complete set of free CAD tools and portable libraries for VLSI design"; + homepage = "http://coriolis.lip6.fr/"; + license = with licenses; gpl2Plus; + maintainers = with maintainers; [ l-as ]; + platforms = with platforms; linux; + }; +} diff --git a/nixpkgs/pkgs/applications/science/electronics/appcsxcad/default.nix b/nixpkgs/pkgs/applications/science/electronics/appcsxcad/default.nix new file mode 100644 index 000000000000..2e882aff361d --- /dev/null +++ b/nixpkgs/pkgs/applications/science/electronics/appcsxcad/default.nix @@ -0,0 +1,54 @@ +{ lib +, mkDerivation +, fetchFromGitHub +, cmake +, csxcad +, qcsxcad +, hdf5 +, vtkWithQt5 +, qtbase +, fparser +, tinyxml +, cgal +, boost +}: + +mkDerivation { + pname = "appcsxcad"; + version = "unstable-2023-01-06"; + + src = fetchFromGitHub { + owner = "thliebig"; + repo = "AppCSXCAD"; + rev = "379ede4b8e00c11e8d0fb724c35547991b30c423"; + hash = "sha256-L0ZEyovnfMzM7JuITBuhb4tJ2Aqgw52IiKEfEGq7Yo0="; + }; + + nativeBuildInputs = [ + cmake + ]; + + buildInputs = [ + csxcad + qcsxcad + hdf5 + vtkWithQt5 + qtbase + fparser + tinyxml + cgal + boost + ]; + + postFixup = '' + rm $out/bin/AppCSXCAD.sh + ''; + + meta = with lib; { + description = "Minimal Application using the QCSXCAD library"; + homepage = "https://github.com/thliebig/AppCSXCAD"; + license = licenses.gpl3; + maintainers = with maintainers; [ matthuszagh ]; + platforms = platforms.linux; + }; +} diff --git a/nixpkgs/pkgs/applications/science/electronics/archimedes/default.nix b/nixpkgs/pkgs/applications/science/electronics/archimedes/default.nix new file mode 100644 index 000000000000..631f44e80633 --- /dev/null +++ b/nixpkgs/pkgs/applications/science/electronics/archimedes/default.nix @@ -0,0 +1,28 @@ +{ lib, stdenv, fetchurl, fetchpatch }: + +stdenv.mkDerivation rec { + pname = "archimedes"; + version = "2.0.1"; + + src = fetchurl { + url = "mirror://gnu/archimedes/archimedes-${version}.tar.gz"; + sha256 = "0jfpnd3pns5wxcxbiw49v5sgpmm5b4v8s4q1a5292hxxk2hzmb3z"; + }; + + patches = [ + # Pull patch pending upstream inclusion to support c99 toolchains: + # https://savannah.gnu.org/bugs/index.php?62703 + (fetchpatch { + name = "c99.patch"; + url = "https://savannah.gnu.org/bugs/download.php?file_id=53393"; + sha256 = "1xmy1w4ln1gynldk3srdi2h0fxpx465dsa1yxc3rzrrjpxh6087f"; + }) + ]; + + meta = { + description = "GNU package for semiconductor device simulations"; + homepage = "https://www.gnu.org/software/archimedes"; + license = lib.licenses.gpl2Plus; + platforms = with lib.platforms; linux; + }; +} diff --git a/nixpkgs/pkgs/applications/science/electronics/bitscope/common.nix b/nixpkgs/pkgs/applications/science/electronics/bitscope/common.nix new file mode 100644 index 000000000000..6a024748daf2 --- /dev/null +++ b/nixpkgs/pkgs/applications/science/electronics/bitscope/common.nix @@ -0,0 +1,62 @@ +{ atk +, buildFHSEnv +, cairo +, dpkg +, gdk-pixbuf +, glib +, gtk2-x11 +, makeWrapper +, pango +, lib, stdenv +, xorg +}: + +{ src, toolName, version, ... } @ attrs: +let + wrapBinary = libPaths: binaryName: '' + wrapProgram "$out/bin/${binaryName}" \ + --prefix LD_LIBRARY_PATH : "${lib.makeLibraryPath libPaths}" + ''; + pkg = stdenv.mkDerivation (rec { + inherit (attrs) version src; + + name = "${toolName}-${version}"; + + meta = with lib; { + homepage = "http://bitscope.com/software/"; + sourceProvenance = with sourceTypes; [ binaryNativeCode ]; + license = licenses.unfree; + platforms = [ "x86_64-linux" ]; + maintainers = with maintainers; [ + vidbina + ]; + } // (attrs.meta or {}); + + nativeBuildInputs = [ makeWrapper dpkg ]; + + libs = attrs.libs or [ + atk + cairo + gdk-pixbuf + glib + gtk2-x11 + pango + xorg.libX11 + ]; + + dontBuild = true; + + unpackPhase = attrs.unpackPhase or '' + dpkg-deb -x ${attrs.src} ./ + ''; + + installPhase = attrs.installPhase or '' + mkdir -p "$out/bin" + cp -a usr/* "$out/" + ${(wrapBinary libs) attrs.toolName} + ''; + }); +in buildFHSEnv { + name = "${attrs.toolName}-${attrs.version}"; + runScript = "${pkg.outPath}/bin/${attrs.toolName}"; +} // { inherit (pkg) meta name; } diff --git a/nixpkgs/pkgs/applications/science/electronics/bitscope/packages.nix b/nixpkgs/pkgs/applications/science/electronics/bitscope/packages.nix new file mode 100644 index 000000000000..11e1ed524ed2 --- /dev/null +++ b/nixpkgs/pkgs/applications/science/electronics/bitscope/packages.nix @@ -0,0 +1,146 @@ +{ callPackage +, fetchurl +}: + +let + mkBitscope = callPackage (import ./common.nix) { }; +in { + chart = let + toolName = "bitscope-chart"; + version = "2.0.FK22M"; + in mkBitscope { + inherit toolName version; + + meta = { + description = "Multi-channel waveform data acquisition and chart recording application"; + homepage = "http://bitscope.com/software/chart/"; + }; + + src = fetchurl { + url = "http://bitscope.com/download/files/${toolName}_${version}_amd64.deb"; + sha256 = "08mc82pjamyyyhh15sagsv0sc7yx5v5n54bg60fpj7v41wdwrzxw"; + }; + }; + + console = let + toolName = "bitscope-console"; + version = "1.0.FK29A"; + in mkBitscope { + # NOTE: this is meant as a demo by BitScope + inherit toolName version; + + meta = { + description = "Demonstrative communications program designed to make it easy to talk to any model BitScope"; + }; + + src = fetchurl { + url = "http://bitscope.com/download/files/${toolName}_${version}_amd64.deb"; + sha256 = "00b4gxwz7w6pmfrcz14326b24kl44hp0gzzqcqxwi5vws3f0y49d"; + }; + }; + + display = let + toolName = "bitscope-display"; + version = "1.0.EC17A"; + in mkBitscope { + inherit toolName version; + + meta = { + description = "Display diagnostic application for BitScope"; + homepage = "http://bitscope.com/software/display/"; + }; + + src = fetchurl { + url = "http://bitscope.com/download/files/${toolName}_${version}_amd64.deb"; + sha256 = "05xr5mnka1v3ibcasg74kmj6nlv1nmn3lca1wv77whkq85cmz0s1"; + }; + }; + + dso = let + toolName = "bitscope-dso"; + version = "2.8.FE22H"; + in mkBitscope { + inherit toolName version; + + meta = { + description = "Test and measurement software for BitScope"; + homepage = "http://bitscope.com/software/dso/"; + }; + + src = fetchurl { + url = "http://bitscope.com/download/files/${toolName}_${version}_amd64.deb"; + sha256 = "0fc6crfkprj78dxxhvhbn1dx1db5chm0cpwlqpqv8sz6whp12mcj"; + }; + }; + + logic = let + toolName = "bitscope-logic"; + version = "1.2.FC20C"; + in mkBitscope { + inherit toolName version; + + meta = { + description = "Mixed signal logic timing and serial protocol analysis software for BitScope"; + homepage = "http://bitscope.com/software/logic/"; + }; + + src = fetchurl { + url = "http://bitscope.com/download/files/${toolName}_${version}_amd64.deb"; + sha256 = "0lkb7z9gfkiyxdwh4dq1zxfls8gzdw0na1vrrbgnxfg3klv4xns3"; + }; + }; + + meter = let + toolName = "bitscope-meter"; + version = "2.0.FK22G"; + in mkBitscope { + inherit toolName version; + + meta = { + description = "Automated oscilloscope, voltmeter and frequency meter for BitScope"; + homepage = "http://bitscope.com/software/logic/"; + }; + + src = fetchurl { + url = "http://bitscope.com/download/files/${toolName}_${version}_amd64.deb"; + sha256 = "0nirbci6ymhk4h4bck2s4wbsl5r9yndk2jvvv72zwkg21248mnbp"; + }; + }; + + proto = let + toolName = "bitscope-proto"; + version = "0.9.FG13B"; + in mkBitscope { + inherit toolName version; + # NOTE: this is meant as a demo by BitScope + # NOTE: clicking on logo produces error + # TApplication.HandleException Executable not found: "http://bitscope.com/blog/DK/?p=DK15A" + + meta = { + description = "Demonstrative prototype oscilloscope built using the BitScope Library"; + homepage = "http://bitscope.com/blog/DK/?p=DK15A"; + }; + + src = fetchurl { + url = "http://bitscope.com/download/files/${toolName}_${version}_amd64.deb"; + sha256 = "1ybjfbh3narn29ll4nci4b7rnxy0hj3wdfm4v8c6pjr8pfvv9spy"; + }; + }; + + server = let + toolName = "bitscope-server"; + version = "1.0.FK26A"; + in mkBitscope { + inherit toolName version; + + meta = { + description = "Remote access server solution for any BitScope"; + homepage = "http://bitscope.com/software/server/"; + }; + + src = fetchurl { + url = "http://bitscope.com/download/files/${toolName}_${version}_amd64.deb"; + sha256 = "1079n7msq6ks0n4aasx40rd4q99w8j9hcsaci71nd2im2jvjpw9a"; + }; + }; +} diff --git a/nixpkgs/pkgs/applications/science/electronics/caneda/default.nix b/nixpkgs/pkgs/applications/science/electronics/caneda/default.nix new file mode 100644 index 000000000000..1adac4832a13 --- /dev/null +++ b/nixpkgs/pkgs/applications/science/electronics/caneda/default.nix @@ -0,0 +1,24 @@ +{ mkDerivation, lib, fetchFromGitHub, cmake, qtbase, qttools, qtsvg, qwt6_1}: + +mkDerivation rec { + pname = "caneda"; + version = "0.3.1"; + + src = fetchFromGitHub { + owner = "Caneda"; + repo = "Caneda"; + rev = version; + sha256 = "0hx8qid50j9xvg2kpbpqmbdyakgyjn6m373m1cvhp70v2gp1v8l2"; + }; + + nativeBuildInputs = [ cmake ]; + buildInputs = [ qtbase qttools qtsvg qwt6_1 ]; + + meta = { + description = "Open source EDA software focused on easy of use and portability"; + homepage = "http://caneda.org"; + license = lib.licenses.gpl2Plus; + maintainers = with lib.maintainers; [viric]; + platforms = with lib.platforms; linux; + }; +} diff --git a/nixpkgs/pkgs/applications/science/electronics/caneda/gcc6.patch b/nixpkgs/pkgs/applications/science/electronics/caneda/gcc6.patch new file mode 100644 index 000000000000..04c8f4502b2d --- /dev/null +++ b/nixpkgs/pkgs/applications/science/electronics/caneda/gcc6.patch @@ -0,0 +1,13 @@ +diff --git c/src/cgraphicsscene.cpp i/src/cgraphicsscene.cpp +index ac2929a..c399706 100644 +--- c/src/cgraphicsscene.cpp ++++ i/src/cgraphicsscene.cpp +@@ -1436,7 +1436,7 @@ namespace Caneda + QPointF newPos = m_currentWiringWire->mapFromScene(pos); + QPointF refPos = m_currentWiringWire->port1()->pos(); + +- if( abs(refPos.x()-newPos.x()) > abs(refPos.y()-newPos.y()) ) { ++ if( (refPos.x()-newPos.x()) > (refPos.y()-newPos.y()) ) { + m_currentWiringWire->movePort2(QPointF(newPos.x(), refPos.y())); + } + else { diff --git a/nixpkgs/pkgs/applications/science/electronics/csxcad/default.nix b/nixpkgs/pkgs/applications/science/electronics/csxcad/default.nix new file mode 100644 index 000000000000..83ee992f4b28 --- /dev/null +++ b/nixpkgs/pkgs/applications/science/electronics/csxcad/default.nix @@ -0,0 +1,47 @@ +{ lib, stdenv +, fetchFromGitHub +, cmake +, fparser +, tinyxml +, hdf5 +, cgal +, vtk +, boost +, gmp +, mpfr +}: + +stdenv.mkDerivation rec { + pname = "csxcad"; + version = "0.6.3"; + + src = fetchFromGitHub { + owner = "thliebig"; + repo = "CSXCAD"; + rev = "v${version}"; + sha256 = "sha256-SSV5ulx3rCJg99I/oOQbqe+gOSs+BfcCo6UkWHVhnSs="; + }; + + patches = [./searchPath.patch ]; + + buildInputs = [ + cgal + boost + gmp + mpfr + vtk + fparser + tinyxml + hdf5 + ]; + + nativeBuildInputs = [ cmake ]; + + meta = with lib; { + description = "A C++ library to describe geometrical objects"; + homepage = "https://github.com/thliebig/CSXCAD"; + license = licenses.lgpl3; + maintainers = with maintainers; [ matthuszagh ]; + platforms = platforms.linux; + }; +} diff --git a/nixpkgs/pkgs/applications/science/electronics/csxcad/searchPath.patch b/nixpkgs/pkgs/applications/science/electronics/csxcad/searchPath.patch new file mode 100644 index 000000000000..2fc0d77b3202 --- /dev/null +++ b/nixpkgs/pkgs/applications/science/electronics/csxcad/searchPath.patch @@ -0,0 +1,11 @@ +--- CSXCAD/matlab/searchBinary.m 2019-07-14 09:24:02.154291745 -0700 ++++ CSXCAD/matlab/searchBinary.m 2019-07-14 09:20:20.900248280 -0700 +@@ -33,7 +33,7 @@ + + % try all search paths + for n=1:numel(searchpath) +- binary_location = [searchpath{n} name]; ++ binary_location = [searchpath{n} filesep name]; + if exist(binary_location, 'file') + return + end diff --git a/nixpkgs/pkgs/applications/science/electronics/dataexplorer/default.nix b/nixpkgs/pkgs/applications/science/electronics/dataexplorer/default.nix new file mode 100644 index 000000000000..8fd9dcc5eaa8 --- /dev/null +++ b/nixpkgs/pkgs/applications/science/electronics/dataexplorer/default.nix @@ -0,0 +1,66 @@ +{ lib +, stdenv +, fetchurl +, jdk +, ant +, makeWrapper +}: + +stdenv.mkDerivation rec { + pname = "dataexplorer"; + version = "3.8.3"; + + src = fetchurl { + url = "mirror://savannah/dataexplorer/dataexplorer-${version}-src.tar.gz"; + sha256 = "sha256-vU9klb6Mweg8yxnClsIdelG4uW92if64SJ7UHumYYbs="; + }; + + nativeBuildInputs = [ ant makeWrapper ]; + + buildInputs = [ jdk ]; + + buildPhase = '' + ant -f build/build.xml dist + ''; + + doCheck = false; + # Missing dependencies (e.g. junit). Does not work. + #checkPhase = '' + # ant -f build/build.xml check + #''; + + installPhase = '' + ant -Dprefix=$out/share/ -f build/build.xml install + + # The sources contain a wrapper script in $out/share/DataExplorer/DataExplorer + # but it hardcodes bash shebang and does not pin the java path. + # So we create our own wrapper, using similar cmdline args as upstream. + mkdir -p $out/bin + makeWrapper ${jdk}/bin/java $out/bin/DataExplorer \ + --add-flags "-Xms64m -Xmx3092m -jar $out/share/DataExplorer/DataExplorer.jar" \ + --set SWT_GTK3 0 + + makeWrapper ${jdk}/bin/java $out/bin/DevicePropertiesEditor \ + --add-flags "-Xms32m -Xmx512m -classpath $out/share/DataExplorer/DataExplorer.jar gde.ui.dialog.edit.DevicePropertiesEditor" \ + --set SWT_GTK3 0 \ + --set LIBOVERLAY_SCROLLBAR 0 + + install -Dvm644 build/misc/GNU_LINUX_JUNSI_ICHARER_USB_UDEV_RULE/50-Junsi-iCharger-USB.rules \ + $out/etc/udev/rules.d/50-Junsi-iCharger-USB.rules + install -Dvm644 build/misc/GNU_LINUX_SKYRC_UDEV_RULE/50-SkyRC-Charger.rules \ + $out/etc/udev/rules.d/50-SkyRC-Charger.rules + ''; + + meta = with lib; { + description = "Graphical tool to analyze data, gathered from various hardware devices"; + homepage = "https://www.nongnu.org/dataexplorer/index.html"; + license = licenses.gpl3Plus; + maintainers = with maintainers; [ panicgh ]; + platforms = [ "x86_64-linux" ]; + sourceProvenance = with sourceTypes; [ + fromSource + binaryNativeCode # contains RXTXcomm (JNI library with *.so files) + binaryBytecode # contains thirdparty jar files, e.g. javax.json, org.glassfish.json + ]; + }; +} diff --git a/nixpkgs/pkgs/applications/science/electronics/degate/default.nix b/nixpkgs/pkgs/applications/science/electronics/degate/default.nix new file mode 100644 index 000000000000..2aa20aec6503 --- /dev/null +++ b/nixpkgs/pkgs/applications/science/electronics/degate/default.nix @@ -0,0 +1,75 @@ +{ lib +, stdenv +, fetchFromGitHub +, fetchpatch +, cmake +, boost +, qtbase +, qtimageformats +, qttools +, wrapQtAppsHook +}: + +let + boost_static = boost.override { enableStatic = true; }; + +in stdenv.mkDerivation rec { + pname = "degate"; + version = "2.0.0"; + + src = fetchFromGitHub { + owner = "DegateCommunity"; + repo = "Degate"; + rev = "refs/tags/v${version}"; + hash = "sha256-INoA3Z6ya03ZMn6E+nOCkXZLoxoo2WgPDw9v5miI09A="; + }; + + patches = [ + # bump bundled catch2 to avoid incompatibility with modern glibc + (fetchpatch { + name = "catch2-2.13.9.patch"; + url = "https://github.com/DegateCommunity/Degate/commit/06346dde4312cbb867854899eacf58679d6ac7e2.patch"; + includes = [ "tests/catch2/catch.hpp" ]; + hash = "sha256-SbSA813QI8RRVy1lvAOGMGAC2KUQKjwYR2imqX40pvU="; + }) + ]; + + postPatch = '' + sed -i -E '/(_OUTPUT_DIRECTORY|DESTINATION)/s|\bout/||g' CMakeLists.txt + ''; + + nativeBuildInputs = [ + cmake + qttools + wrapQtAppsHook + ]; + + buildInputs = [ + boost_static + qtbase + ]; + + doCheck = true; + checkPhase = '' + runHook preCheck + + ( + cd tests/out/bin + + # provide qtimageformats plugin to allow tests to read tiff files + export QT_PLUGIN_PATH="${qtimageformats}/${qtbase.qtPluginPrefix}" + + ./DegateTests + ) + + runHook postCheck + ''; + + meta = with lib; { + description = "A modern and open-source cross-platform software for chips reverse engineering"; + homepage = "https://degate.readthedocs.io/"; + license = licenses.gpl3; + platforms = platforms.unix; + maintainers = with maintainers; [ ris ]; + }; +} diff --git a/nixpkgs/pkgs/applications/science/electronics/digital/default.nix b/nixpkgs/pkgs/applications/science/electronics/digital/default.nix new file mode 100644 index 000000000000..ed90b03dbc3e --- /dev/null +++ b/nixpkgs/pkgs/applications/science/electronics/digital/default.nix @@ -0,0 +1,67 @@ +{ lib, fetchFromGitHub, makeDesktopItem, copyDesktopItems, makeWrapper +, jre, maven +}: + +let + pkgDescription = "A digital logic designer and circuit simulator."; + version = "0.30"; + buildDate = "2023-02-03T08:00:56+01:00"; # v0.30 commit date + + desktopItem = makeDesktopItem { + type = "Application"; + name = "Digital"; + desktopName = pkgDescription; + comment = "Easy-to-use digital logic designer and circuit simulator"; + exec = "digital"; + icon = "digital"; + categories = [ "Education" "Electronics" ]; + mimeTypes = [ "text/x-digital" ]; + terminal = false; + keywords = [ "simulator" "digital" "circuits" ]; + }; + + # Use the "no-git-rev" maven profile, which deactivates the plugin that + # inspect the .git folder to find the version number we are building, we then + # provide that version number manually as a property. + # (see https://github.com/hneemann/Digital/issues/289#issuecomment-513721481) + # Also use the commit date as a build and output timestamp. + mvnParameters = "-Pno-git-rev -Dgit.commit.id.describe=${version} -Dproject.build.outputTimestamp=${buildDate} -DbuildTimestamp=${buildDate}"; +in +maven.buildMavenPackage rec { + pname = "digital"; + inherit version jre; + + src = fetchFromGitHub { + owner = "hneemann"; + repo = "Digital"; + rev = "v${version}"; + hash = "sha256-cDykYlcFvDLFBy9UnX07iCR2LCq28SNU+h9vRT/AoJM="; + }; + + inherit mvnParameters; + mvnHash = "sha256-wm/axWJucoW9P98dKqHI4bjrUnmBTfosCOdJg9VBJ+4="; + + nativeBuildInputs = [ copyDesktopItems makeWrapper ]; + + installPhase = '' + mkdir -p $out/bin + mkdir -p $out/share/java + + classpath=$(find $mvnDeps/.m2 -name "*.jar" -printf ':%h/%f'); + install -Dm644 target/Digital.jar $out/share/java + + makeWrapper ${jre}/bin/java $out/bin/${pname} \ + --add-flags "-classpath $out/share/java/${pname}-${version}.jar:''${classpath#:}" \ + --add-flags "-jar $out/share/java/Digital.jar" + ''; + + desktopItems = [ desktopItem ]; + + meta = with lib; { + homepage = "https://github.com/hneemann/Digital"; + description = pkgDescription; + license = licenses.gpl3Only; + platforms = [ "x86_64-linux" "x86_64-darwin" ]; + maintainers = with maintainers; [ Dettorer ]; + }; +} diff --git a/nixpkgs/pkgs/applications/science/electronics/diylc/default.nix b/nixpkgs/pkgs/applications/science/electronics/diylc/default.nix new file mode 100644 index 000000000000..8530e6927fe9 --- /dev/null +++ b/nixpkgs/pkgs/applications/science/electronics/diylc/default.nix @@ -0,0 +1,77 @@ +{ lib, stdenv, fetchurl, makeDesktopItem, unzip, bash, jre8 }: + +let + pname = "diylc"; + version = "4.18.0"; + files = { + app = fetchurl { + url = "https://github.com/bancika/diy-layout-creator/releases/download/v${version}/diylc-${version}.zip"; + sha256 = "09fpp3dn086clgnjz5yj4fh5bnjvj6mvxkx9n3zamcwszjmxr40d"; + }; + icon16 = fetchurl { + url = "https://raw.githubusercontent.com/bancika/diy-layout-creator/v${version}/diylc/diylc-core/src/org/diylc/core/images/icon_small.png"; + sha256 = "1is50aidfwzwfzwqv57s2hwhx0r5c21cp77bkl93xkdqkh2wd8x4"; + }; + icon32 = fetchurl { + url = "https://raw.githubusercontent.com/bancika/diy-layout-creator/v${version}/diylc/diylc-core/src/org/diylc/core/images/icon_medium.png"; + sha256 = "0a45p18n84xz1nd3zv3y16jlimvqzhbzg3q3f4lawgx4rcrn2n3d"; + }; + icon48 = fetchurl { + url = "https://raw.githubusercontent.com/bancika/diy-layout-creator/v${version}/diylc/diylc-core/src/org/diylc/core/images/icon_large.png"; + sha256 = "06dkz0dcy8hfmnzr5ri5n1sh8r7mg83kzbvs3zy58wwhgzs1ddk6"; + }; + }; + launcher = makeDesktopItem { + name = "diylc"; + desktopName = "DIY Layout Creator"; + comment = "Multi platform circuit layout and schematic drawing tool"; + exec = "diylc"; + icon = "diylc_icon"; + categories = [ "Development" "Electronics" ]; + }; +in +stdenv.mkDerivation rec { + inherit pname version; + + dontUnpack = true; + + buildInputs = [ jre8 ]; + nativeBuildInputs = [ unzip ]; + + installPhase = '' + runHook preInstall + + mkdir -p $out/share/diylc + unzip -UU ${files.app} -d $out/share/diylc + rm $out/share/diylc/diylc.exe + rm $out/share/diylc/run.sh + + # Nope, the icon cannot be named 'diylc' because KDE does not like it. + install -Dm644 ${files.icon16} $out/share/icons/hicolor/16x16/apps/diylc_icon.png + install -Dm644 ${files.icon32} $out/share/icons/hicolor/32x32/apps/diylc_icon.png + install -Dm644 ${files.icon48} $out/share/icons/hicolor/48x48/apps/diylc_icon.png + + mkdir -p $out/share/applications + ln -s ${launcher}/share/applications/* $out/share/applications/ + + mkdir -p $out/bin + cat <<EOF > $out/bin/diylc + #!${bash}/bin/sh + cd $out/share/diylc + ${jre8}/bin/java -Xms512m -Xmx2048m -Dorg.diylc.scriptRun=true -Dfile.encoding=UTF-8 -cp diylc.jar:lib org.diylc.DIYLCStarter + EOF + chmod +x $out/bin/diylc + + runHook postInstall + ''; + + meta = with lib; { + description = "Multi platform circuit layout and schematic drawing tool"; + homepage = "https://bancika.github.io/diy-layout-creator/"; + changelog = "https://github.com/bancika/diy-layout-creator/releases"; + license = licenses.gpl3Plus; + sourceProvenance = with sourceTypes; [ binaryBytecode ]; + platforms = platforms.linux; + maintainers = with maintainers; [ ]; + }; +} diff --git a/nixpkgs/pkgs/applications/science/electronics/dsview/default.nix b/nixpkgs/pkgs/applications/science/electronics/dsview/default.nix new file mode 100644 index 000000000000..ec53e976aec5 --- /dev/null +++ b/nixpkgs/pkgs/applications/science/electronics/dsview/default.nix @@ -0,0 +1,38 @@ +{ stdenv, lib, fetchFromGitHub, pkg-config, cmake, wrapQtAppsHook +, libzip, boost, fftw, qtbase, qtwayland, qtsvg, libusb1 +, python3, fetchpatch, desktopToDarwinBundle +}: + +stdenv.mkDerivation rec { + pname = "dsview"; + + version = "1.3.1"; + + src = fetchFromGitHub { + owner = "DreamSourceLab"; + repo = "DSView"; + rev = "v${version}"; + sha256 = "sha256-LwrlB+Nwq34YjwGmnbUWS3W//ZHr8Do2Wf2te+2oBeI="; + }; + + patches = [ + # Fix absolute install paths + ./install.patch + ]; + + nativeBuildInputs = [ cmake pkg-config wrapQtAppsHook ] + ++ lib.optional stdenv.isDarwin desktopToDarwinBundle; + + buildInputs = [ + boost fftw qtbase qtsvg libusb1 libzip + python3 + ] ++ lib.optional stdenv.isLinux qtwayland; + + meta = with lib; { + description = "A GUI program for supporting various instruments from DreamSourceLab, including logic analyzer, oscilloscope, etc"; + homepage = "https://www.dreamsourcelab.com/"; + license = licenses.gpl3Plus; + platforms = platforms.unix; + maintainers = with maintainers; [ bachp carlossless ]; + }; +} diff --git a/nixpkgs/pkgs/applications/science/electronics/dsview/install.patch b/nixpkgs/pkgs/applications/science/electronics/dsview/install.patch new file mode 100644 index 000000000000..9fc660bf8148 --- /dev/null +++ b/nixpkgs/pkgs/applications/science/electronics/dsview/install.patch @@ -0,0 +1,23 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index eb9be42..220817c 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -662,16 +662,8 @@ install(FILES DSView/icons/logo.svg DESTINATION share/icons/hicolor/scalable/app + install(FILES DSView/icons/logo.svg DESTINATION share/pixmaps RENAME dsview.svg) + + if(CMAKE_SYSTEM_NAME MATCHES "Linux") +- install(FILES DSView/DSView.desktop DESTINATION /usr/share/applications RENAME dsview.desktop) +- +- if(IS_DIRECTORY /usr/lib/udev/rules.d) +- install(FILES DSView/DreamSourceLab.rules DESTINATION /usr/lib/udev/rules.d RENAME 60-dreamsourcelab.rules) +- elseif(IS_DIRECTORY /lib/udev/rules.d) +- install(FILES DSView/DreamSourceLab.rules DESTINATION /lib/udev/rules.d RENAME 60-dreamsourcelab.rules) +- elseif(IS_DIRECTORY /etc/udev/rules.d) +- install(FILES DSView/DreamSourceLab.rules DESTINATION /etc/udev/rules.d RENAME 60-dreamsourcelab.rules) +- endif() +- ++ install(FILES DSView/DreamSourceLab.rules DESTINATION etc/udev/rules.d RENAME 60-dreamsourcelab.rules) + endif() ++install(FILES DSView/DSView.desktop DESTINATION share/applications RENAME dsview.desktop) + + install(FILES NEWS25 DESTINATION share/DSView RENAME NEWS25) diff --git a/nixpkgs/pkgs/applications/science/electronics/dwfv/default.nix b/nixpkgs/pkgs/applications/science/electronics/dwfv/default.nix new file mode 100644 index 000000000000..ed340271f262 --- /dev/null +++ b/nixpkgs/pkgs/applications/science/electronics/dwfv/default.nix @@ -0,0 +1,20 @@ +{ lib, rustPlatform, fetchCrate }: + +rustPlatform.buildRustPackage rec { + pname = "dwfv"; + version = "0.4.1"; + + src = fetchCrate { + inherit version pname; + sha256 = "0xxgwbbbzaldbl04k5ksk61wa6i4f9mc84q04ljg438z0k8q6cr7"; + }; + + cargoSha256 = "1z51yx3psdxdzmwny0rzlch5hjx2pssll73q79qij2bc7wgyjscy"; + + meta = with lib; { + description = "A simple digital waveform viewer with vi-like key bindings"; + homepage = "https://github.com/psurply/dwfv"; + license = licenses.mit; + maintainers = with maintainers; [ newam ]; + }; +} diff --git a/nixpkgs/pkgs/applications/science/electronics/eagle/eagle.nix b/nixpkgs/pkgs/applications/science/electronics/eagle/eagle.nix new file mode 100644 index 000000000000..6302c2dbfa38 --- /dev/null +++ b/nixpkgs/pkgs/applications/science/electronics/eagle/eagle.nix @@ -0,0 +1,81 @@ +{ lib, stdenv, mkDerivation, fetchurl, makeDesktopItem +, libXrender, libXrandr, libXcursor, libX11, libXext, libXi, libxcb + , libGL, glib, nss, nspr, expat, alsa-lib +, qtbase, qtdeclarative, qtsvg, qtlocation, qtwebchannel, qtwebengine +}: + +let + libPath = lib.makeLibraryPath + [ libXrender libXrandr libXcursor libX11 libXext libXi libxcb + libGL glib nss nspr expat alsa-lib + qtbase qtdeclarative qtsvg qtlocation qtwebchannel qtwebengine + ]; + in + mkDerivation rec { + pname = "eagle"; + version = "9.6.2"; + + src = fetchurl { + url = "https://eagle-updates.circuits.io/downloads/${builtins.replaceStrings ["."] ["_"] version}/Autodesk_EAGLE_${version}_English_Linux_64bit.tar.gz"; + sha256 = "18syygnskl286kn8aqfzzdsyzq59d2w19y1h1ynyxsnrvkyv71h0"; + }; + + desktopItem = makeDesktopItem { + name = "eagle"; + exec = "eagle"; + icon = "eagle"; + comment = "Schematic capture and PCB layout"; + desktopName = "Eagle"; + genericName = "Schematic editor"; + categories = [ "Development" ]; + }; + + buildInputs = + [ libXrender libXrandr libXcursor libX11 libXext libXi libxcb + libGL glib nss nspr expat alsa-lib + qtbase qtdeclarative qtsvg qtlocation qtwebchannel qtwebengine + ]; + + installPhase = '' + # Extract eagle tarball + mkdir "$out" + tar -xzf "$src" -C "$out" + + # Install manpage + mkdir -p "$out"/share/man/man1 + ln -s "$out"/eagle-${version}/doc/eagle.1 "$out"/share/man/man1/eagle.1 + + patchelf \ + --set-interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" \ + --set-rpath "${libPath}:$out/eagle-${version}/lib:${stdenv.cc.cc.lib}/lib" \ + "$out"/eagle-${version}/eagle + + mkdir -p "$out"/bin + ln -s "$out"/eagle-${version}/eagle "$out"/bin/eagle + + # Remove bundled libraries that are available in nixpkgs + # TODO: There still may be unused bundled libraries + rm "$out"/eagle-${version}/lib/libQt5*.so.5 + rm "$out"/eagle-${version}/lib/{libxcb-*.so.*,libX*.so.*,libxshmfence.so.1} + rm "$out"/eagle-${version}/lib/{libEGL.so.1,libglapi.so.0,libgbm.so.1} + + # No longer needed (we don't use the bundled Qt libraries) + rm -r "$out"/eagle-${version}/libexec + rm -r "$out"/eagle-${version}/plugins + + # Make desktop item + mkdir -p "$out"/share/applications + cp "$desktopItem"/share/applications/* "$out"/share/applications/ + mkdir -p "$out"/share/pixmaps + ln -s "$out/eagle-${version}/bin/eagle-logo.png" "$out"/share/pixmaps/eagle.png + ''; + + meta = with lib; { + description = "Schematic editor and PCB layout tool from Autodesk (formerly CadSoft)"; + homepage = "https://www.autodesk.com/products/eagle/overview"; + sourceProvenance = with sourceTypes; [ binaryNativeCode ]; + license = licenses.unfree; + platforms = [ "x86_64-linux" ]; + maintainers = [ ]; + }; + } diff --git a/nixpkgs/pkgs/applications/science/electronics/eagle/eagle7_fixer.c b/nixpkgs/pkgs/applications/science/electronics/eagle/eagle7_fixer.c new file mode 100644 index 000000000000..da9da4dcbd3a --- /dev/null +++ b/nixpkgs/pkgs/applications/science/electronics/eagle/eagle7_fixer.c @@ -0,0 +1,134 @@ +/* + * LD_PRELOAD trick to make Eagle (schematic editor and PCB layout tool from + * CadSoft) work from a read-only installation directory. + * + * When Eagle starts, it looks for the license file in <eagle>/bin/eagle.key + * (where <eagle> is the install path). If eagle.key is not found, Eagle checks + * for write access to <eagle>/bin/, shows a license dialog to the user and + * then attempts to write a license file to <eagle>/bin/. + * + * This will of course fail when Eagle is installed in the read-only Nix store. + * Hence this library that redirects accesses to the those paths in the + * following way: + * + * <eagle>/bin => $HOME + * <eagle>/bin/eagle.key => $HOME/.eagle.key + * + * Also, if copying an example project to ~/eagle/ (in the Eagle GUI), Eagle + * chmod's the destination with read-only permission bits (presumably because + * the source is read-only) and fails to complete the copy operation. + * Therefore, the mode argument in calls to chmod() is OR'ed with the S_IWUSR + * bit (write by owner). + * + * Usage: + * gcc -shared -fPIC -DEAGLE_PATH="$out/eagle-${version}" eagle_fixer.c -o eagle_fixer.so -ldl + * LD_PRELOAD=$PWD/eagle_fixer.so ./result/bin/eagle + * + * To see the paths that are modified at runtime, set the environment variable + * EAGLE_FIXER_DEBUG to 1. + */ + +#define _GNU_SOURCE +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <unistd.h> +#include <fcntl.h> +#include <dlfcn.h> +#include <limits.h> +#include <sys/stat.h> + +#ifndef EAGLE_PATH +#error Missing EAGLE_PATH, path to the eagle-${version} installation directory. +#endif + +typedef FILE *(*fopen_func_t)(const char *path, const char *mode); +typedef int (*access_func_t)(const char *pathname, int mode); +typedef int (*chmod_func_t)(const char *path, mode_t mode); + +/* + * Map <eagle>/bin to $HOME and <eagle>/bin/eagle.key to $HOME/.eagle.key + * + * Path is truncated if bigger than PATH_MAX. It's not threadsafe, but that's + * OK. + */ +static const char *redirect(const char *pathname) +{ + static char buffer[PATH_MAX]; + const char *homepath; + const char *new_path; + static int have_warned; + + homepath = getenv("HOME"); + if (!homepath) { + homepath = "/"; + if (!have_warned && getenv("EAGLE_FIXER_DEBUG")) { + fprintf(stderr, "eagle_fixer: HOME is unset, using \"/\" (root) instead.\n"); + have_warned = 1; + } + } + + new_path = pathname; + if (strcmp(EAGLE_PATH "/bin", pathname) == 0) { + /* redirect to $HOME */ + new_path = homepath; + } else if (strcmp(EAGLE_PATH "/bin/eagle.key", pathname) == 0) { + /* redirect to $HOME/.eagle.key */ + snprintf(buffer, PATH_MAX, "%s/.eagle.key", homepath); + buffer[PATH_MAX-1] = '\0'; + new_path = buffer; + } + + return new_path; +} + +FILE *fopen(const char *pathname, const char *mode) +{ + FILE *fp; + const char *path; + fopen_func_t orig_fopen; + + orig_fopen = (fopen_func_t)dlsym(RTLD_NEXT, "fopen"); + path = redirect(pathname); + fp = orig_fopen(path, mode); + + if (path != pathname && getenv("EAGLE_FIXER_DEBUG")) { + fprintf(stderr, "eagle_fixer: fopen(\"%s\", \"%s\") => \"%s\": fp=%p\n", pathname, mode, path, fp); + } + + return fp; +} + +int access(const char *pathname, int mode) +{ + int ret; + const char *path; + access_func_t orig_access; + + orig_access = (access_func_t)dlsym(RTLD_NEXT, "access"); + path = redirect(pathname); + ret = orig_access(path, mode); + + if (path != pathname && getenv("EAGLE_FIXER_DEBUG")) { + fprintf(stderr, "eagle_fixer: access(\"%s\", %d) => \"%s\": ret=%d\n", pathname, mode, path, ret); + } + + return ret; +} + +int chmod(const char *pathname, mode_t mode) +{ + int ret; + mode_t new_mode; + chmod_func_t orig_chmod; + + orig_chmod = (chmod_func_t)dlsym(RTLD_NEXT, "chmod"); + new_mode = mode | S_IWUSR; + ret = orig_chmod(pathname, new_mode); + + if (getenv("EAGLE_FIXER_DEBUG")) { + fprintf(stderr, "eagle_fixer: chmod(\"%s\", %o) => %o: ret=%d\n", pathname, mode, new_mode, ret); + } + + return ret; +} diff --git a/nixpkgs/pkgs/applications/science/electronics/flatcam/default.nix b/nixpkgs/pkgs/applications/science/electronics/flatcam/default.nix new file mode 100644 index 000000000000..2235cf0b4a33 --- /dev/null +++ b/nixpkgs/pkgs/applications/science/electronics/flatcam/default.nix @@ -0,0 +1,104 @@ +{ lib +, fetchFromBitbucket +, buildPythonApplication +, pyqt5 +, matplotlib +, numpy +, cycler +, python-dateutil +, kiwisolver +, six +, setuptools +, dill +, rtree +, pyopengl +, vispy +, ortools +, svg-path +, simplejson +, shapely +, freetype-py +, fonttools +, rasterio +, lxml +, ezdxf +, qrcode +, reportlab +, svglib +, gdal +, pyserial +, python3 +}: + +buildPythonApplication rec { + pname = "flatcam"; + version = "unstable-2022-02-02"; + + src = fetchFromBitbucket { + owner = "jpcgt"; + repo = pname; + rev = "ebf5cb9e3094362c4b0774a54cf119559c02211d"; # beta branch as of 2022-02-02 + hash = "sha256-QKkBPEM+HVYmSZ83b4JRmOmCMp7C3EUqbJKPqUXMiKE="; + }; + + format = "other"; + + dontBuild = true; + + propagatedBuildInputs = [ + pyqt5 + matplotlib + numpy + cycler + python-dateutil + kiwisolver + six + setuptools + dill + rtree + pyopengl + vispy + ortools + svg-path + simplejson + shapely + freetype-py + fonttools + rasterio + lxml + ezdxf + qrcode + reportlab + svglib + gdal + pyserial + ]; + + preInstall = '' + patchShebangs . + + sed -i "s|/usr/local/bin|$out/bin|" Makefile + + mkdir -p $out/share/{flatcam,applications} + mkdir -p $out/bin + ''; + + installFlags = [ + "USER_ID=0" + "LOCAL_PATH=/build/source/." + "INSTALL_PATH=${placeholder "out"}/share/flatcam" + "APPS_PATH=${placeholder "out"}/share/applications" + ]; + + postInstall = '' + sed -i "s|python3|${python3.withPackages (_: propagatedBuildInputs)}/bin/python3|" $out/bin/flatcam-beta + mv $out/bin/flatcam{-beta,} + ''; + + meta = with lib; { + description = "2-D post processing for PCB fabrication on CNC routers"; + homepage = "https://bitbucket.org/jpcgt/flatcam"; + license = licenses.mit; + maintainers = with maintainers; [ trepetti ]; + }; +} diff --git a/nixpkgs/pkgs/applications/science/electronics/flopoco/default.nix b/nixpkgs/pkgs/applications/science/electronics/flopoco/default.nix new file mode 100644 index 000000000000..7ce1087209e2 --- /dev/null +++ b/nixpkgs/pkgs/applications/science/electronics/flopoco/default.nix @@ -0,0 +1,93 @@ +{ lib +, stdenv +, fetchFromGitLab +, fetchpatch +, cmake +, installShellFiles +, bison +, boost +, flex +, gmp +, libxml2 +, mpfi +, mpfr +, scalp +, sollya +, wcpg +}: + +stdenv.mkDerivation rec { + pname = "flopoco"; + version = "4.1.3"; + + src = fetchFromGitLab { + owner = pname; + repo = pname; + # flopoco-4.1.3 is not tagged on GitLab + rev = "67598298207c9f3261c35679c8a5966480c4343c"; + sha256 = "sha256-0jRjg4/qciqBcjsi6BTbKO4VJkcoEzpC98wFkUOIGbI="; + }; + + patches = [ + (fetchpatch { + name = "fix-clang-error-sin-cos.patch"; + url = "https://gitlab.com/flopoco/flopoco/-/commit/de3aa60ad19333952c176c2a2e51f12653ca736b.patch"; + postFetch = '' + substituteInPlace $out \ + --replace 'FixSinCosCORDIC.hpp' 'CordicSinCos.hpp' + ''; + sha256 = "sha256-BlamA/MZuuqqvGYto+jPeQPop6gwva0y394Odw8pdwg="; + }) + (fetchpatch { + name = "fix-clang-error-atan2.patch"; + url = "https://gitlab.com/flopoco/flopoco/-/commit/a3ffe2436c1b59ee0809b3772b74f2d43c6edb99.patch"; + sha256 = "sha256-dSYcufLHDL0p1V1ghmy6X6xse5f6mjUqckaVqLZnTaA="; + }) + ]; + + postPatch = lib.optionalString (stdenv.isDarwin && stdenv.isx86_64) '' + sed -i "s/-pg//g" {,src/Apps/TaMaDi/}CMakeLists.txt + ''; + + strictDeps = true; + + nativeBuildInputs = [ + bison + cmake + installShellFiles + ]; + + buildInputs = [ + boost + flex + gmp + libxml2 + mpfi + mpfr + scalp + sollya + wcpg + ]; + + postBuild = '' + ./flopoco BuildAutocomplete + ''; + + installPhase = '' + runHook preInstall + + install -Dm755 flopoco $out/bin/flopoco + cp bin* fp* ieee* longacc* $out/bin/ + installShellCompletion --bash flopoco_autocomplete + + runHook postInstall + ''; + + meta = with lib; { + description = "The FloPoCo arithmetic core generator"; + homepage = "https://flopoco.org/"; + license = licenses.unfree; + platforms = platforms.unix; + maintainers = with maintainers; [ wegank ]; + }; +} diff --git a/nixpkgs/pkgs/applications/science/electronics/fparser/default.nix b/nixpkgs/pkgs/applications/science/electronics/fparser/default.nix new file mode 100644 index 000000000000..73db0575d0b1 --- /dev/null +++ b/nixpkgs/pkgs/applications/science/electronics/fparser/default.nix @@ -0,0 +1,26 @@ +{ lib, stdenv +, fetchFromGitHub +, cmake +}: + +stdenv.mkDerivation rec { + pname = "fparser"; + version = "unstable-2015-09-25"; + + src = fetchFromGitHub { + owner = "thliebig"; + repo = "fparser"; + rev = "a59e1f51e32096bfe2a0a2640d5dffc7ae6ba37b"; + sha256 = "0wayml1mlyi922gp6am3fsidhzsilziksdn5kbnpcln01h8555ad"; + }; + + nativeBuildInputs = [ cmake ]; + + meta = with lib; { + description = "C++ Library for Evaluating Mathematical Functions"; + homepage = "https://github.com/thliebig/fparser"; + license = licenses.lgpl3; + maintainers = with maintainers; [ matthuszagh ]; + platforms = platforms.linux; + }; +} diff --git a/nixpkgs/pkgs/applications/science/electronics/fped/default.nix b/nixpkgs/pkgs/applications/science/electronics/fped/default.nix new file mode 100644 index 000000000000..138d45c787cd --- /dev/null +++ b/nixpkgs/pkgs/applications/science/electronics/fped/default.nix @@ -0,0 +1,49 @@ +{ lib, stdenv, fetchgit +, flex, bison, fig2dev, imagemagick, netpbm, gtk2 +, pkg-config +}: + +with lib; +stdenv.mkDerivation { + pname = "fped"; + version = "unstable-2017-05-11"; + + src = fetchgit { + url = "git://projects.qi-hardware.com/fped.git"; + rev = "fa98e58157b6f68396d302c32421e882ac87f45b"; + sha256 = "0xv364a00zwxhd9kg1z9sch5y0cxnrhk546asspyb9bh58sdzfy7"; + }; + + # Workaround build failure on -fno-common toolchains: + # ld: postscript.o:postscript.h:29: multiple definition of + # `postscript_params'; fped.o:postscript.h:29: first defined here + env.NIX_CFLAGS_COMPILE = "-fcommon"; + + # This uses '/bin/bash', '/usr/local' and 'lex' by default + makeFlags = [ + "PREFIX=${placeholder "out"}" + "LEX=flex" + "RGBDEF=${netpbm.out}/share/netpbm/misc/rgb.txt" + ]; + + nativeBuildInputs = [ + flex + bison + pkg-config + imagemagick + fig2dev + netpbm + ]; + + buildInputs = [ + gtk2 + ]; + + meta = { + description = "An editor that allows the interactive creation of footprints electronic components"; + homepage = "http://projects.qi-hardware.com/index.php/p/fped/"; + license = licenses.gpl2; + maintainers = with maintainers; [ expipiplus1 ]; + platforms = platforms.linux; + }; +} diff --git a/nixpkgs/pkgs/applications/science/electronics/fritzing/default.nix b/nixpkgs/pkgs/applications/science/electronics/fritzing/default.nix new file mode 100644 index 000000000000..efe70f125d04 --- /dev/null +++ b/nixpkgs/pkgs/applications/science/electronics/fritzing/default.nix @@ -0,0 +1,111 @@ +{ stdenv +, lib +, fetchFromGitHub +, wrapQtAppsHook +, qmake +, pkg-config +, qtbase +, qtsvg +, qttools +, qtserialport +, qtwayland +, qt5compat +, boost +, libngspice +, libgit2 +, quazip +, clipper +}: + +let + # SHA256 of the fritzing-parts HEAD on the master branch, + # which contains the latest stable parts definitions + partsSha = "015626e6cafb1fc7831c2e536d97ca2275a83d32"; + + parts = fetchFromGitHub { + owner = "fritzing"; + repo = "fritzing-parts"; + rev = partsSha; + hash = "sha256-5jw56cqxpT/8bf1q551WG53J6Lw5pH0HEtRUoNNMc+A="; + }; + + # Header-only library + svgpp = fetchFromGitHub { + owner = "svgpp"; + repo = "svgpp"; + rev = "v1.3.0"; + hash = "sha256-kJEVnMYnDF7bThDB60bGXalYgpn9c5/JCZkRSK5GoE4="; + }; +in + +stdenv.mkDerivation { + pname = "fritzing"; + version = "1.0.2"; + + src = fetchFromGitHub { + owner = "fritzing"; + repo = "fritzing-app"; + rev = "dbdbe34c843677df721c7b3fc3e32c0f737e7e95"; + hash = "sha256-Xi5sPU2RGkqh7T+EOvwxJJKKYDhJfccyEZ8LBBTb2s4="; + }; + + nativeBuildInputs = [ qmake pkg-config qttools wrapQtAppsHook ]; + buildInputs = [ + qtbase + qtsvg + qtserialport + qtwayland + qt5compat + boost + libgit2 + quazip + libngspice + clipper + ]; + + postPatch = '' + # Use packaged quazip, libgit and ngspice + sed -i "/pri\/quazipdetect.pri/d" phoenix.pro + sed -i "/pri\/spicedetect.pri/d" phoenix.pro + substituteInPlace phoenix.pro \ + --replace 'LIBGIT_STATIC = true' 'LIBGIT_STATIC = false' + + #TODO: Do not hardcode SHA. + substituteInPlace src/fapplication.cpp \ + --replace 'PartsChecker::getSha(dir.absolutePath());' '"${partsSha}";' + + substituteInPlace phoenix.pro \ + --replace "6.5.10" "${qtbase.version}" + + mkdir parts + cp -a ${parts}/* parts/ + ''; + + env.NIX_CFLAGS_COMPILE = lib.concatStringsSep " " [ + "-I${lib.getDev quazip}/include/QuaZip-Qt${lib.versions.major qtbase.version}-${quazip.version}" + "-I${svgpp}/include" + "-I${clipper}/include/polyclipping" + ]; + env.NIX_LDFLAGS = "-lquazip1-qt${lib.versions.major qtbase.version}"; + + qmakeFlags = [ + "phoenix.pro" + ]; + + postFixup = '' + # generate the parts.db file + QT_QPA_PLATFORM=offscreen "$out/bin/Fritzing" \ + -db "$out/share/fritzing/parts/parts.db" \ + -pp "$out/share/fritzing/parts" \ + -folder "$out/share/fritzing" + ''; + + meta = with lib; { + description = "An open source prototyping tool for Arduino-based projects"; + homepage = "https://fritzing.org/"; + license = with licenses; [ gpl3 cc-by-sa-30 ]; + maintainers = with maintainers; [ robberer muscaln ]; + platforms = platforms.linux; + mainProgram = "Fritzing"; + }; +} diff --git a/nixpkgs/pkgs/applications/science/electronics/gaw/default.nix b/nixpkgs/pkgs/applications/science/electronics/gaw/default.nix new file mode 100644 index 000000000000..a54602de13f3 --- /dev/null +++ b/nixpkgs/pkgs/applications/science/electronics/gaw/default.nix @@ -0,0 +1,34 @@ +{ stdenv +, fetchurl +, lib +, gtk3 +, pkg-config +}: + +stdenv.mkDerivation rec { + pname = "gaw"; + version = "20220315"; + + src = fetchurl { + url = "https://download.tuxfamily.org/gaw/download/gaw3-${version}.tar.gz"; + sha256 = "0j2bqi9444s1mfbr7x9rqp232xf7ab9z7ifsnl305jsklp6qmrbg"; + }; + + nativeBuildInputs = [ pkg-config ]; + + buildInputs = [ gtk3 ]; + + meta = with lib; { + description = "Gtk Analog Wave viewer"; + longDescription = '' + Gaw is a software tool for displaying analog waveforms from + sampled datas, for example from the output of simulators or + input from sound cards. Data can be imported to gaw using files, + direct tcp/ip connection or directly from the sound card. + ''; + homepage = "http://gaw.tuxfamily.org"; + license = licenses.gpl2Plus; + maintainers = with maintainers; [ fbeffa ]; + platforms = platforms.linux; + }; +} diff --git a/nixpkgs/pkgs/applications/science/electronics/geda/default.nix b/nixpkgs/pkgs/applications/science/electronics/geda/default.nix new file mode 100644 index 000000000000..160928633a3c --- /dev/null +++ b/nixpkgs/pkgs/applications/science/electronics/geda/default.nix @@ -0,0 +1,35 @@ +{ lib, stdenv, fetchurl, fetchpatch, autoreconfHook, groff, pkg-config, guile, gtk2, flex, gawk, perl }: + +stdenv.mkDerivation rec { + pname = "geda"; + version = "1.10.2"; + + src = fetchurl { + url = "http://ftp.geda-project.org/geda-gaf/stable/v${lib.versions.majorMinor version}/${version}/geda-gaf-${version}.tar.gz"; + hash = "sha256-6GKrJBUoU4+jvuJzkmH1aAERArYMXjmi8DWGY8BCyKQ="; + }; + + patches = [ + (fetchpatch { + name = "geda-1.10.2-drop-xorn.patch"; + url = "https://gitweb.gentoo.org/repo/gentoo.git/plain/sci-electronics/geda/files/geda-1.10.2-drop-xorn.patch?id=5589cc7bc6c4f18f75c40725a550b8d76e7f5ca1"; + hash = "sha256-jPQaHjEDwCEfZqDGku+xyIMl5WlWlVcpPv1W6Xf8Grs="; + }) + ]; + + configureFlags = [ + "--disable-update-xdg-database" + "--without-libfam" + ]; + + nativeBuildInputs = [ autoreconfHook groff pkg-config ]; + buildInputs = [ guile gtk2 flex gawk perl ]; + + meta = with lib; { + description = "Full GPL'd suite of Electronic Design Automation tools"; + homepage = "http://www.geda-project.org/"; + maintainers = with maintainers; [ pjones ]; + platforms = platforms.linux; + license = licenses.gpl2; + }; +} diff --git a/nixpkgs/pkgs/applications/science/electronics/gerbv/default.nix b/nixpkgs/pkgs/applications/science/electronics/gerbv/default.nix new file mode 100644 index 000000000000..652a96617cbc --- /dev/null +++ b/nixpkgs/pkgs/applications/science/electronics/gerbv/default.nix @@ -0,0 +1,55 @@ +{ lib +, stdenv +, autoconf +, automake +, autoreconfHook +, cairo +, fetchFromGitHub +, gettext +, gtk2-x11 +, libtool +, pkg-config +}: + +stdenv.mkDerivation rec { + pname = "gerbv"; + version = "2.10.0"; + + src = fetchFromGitHub { + owner = "gerbv"; + repo = pname; + rev = "refs/tags/v${version}"; + hash = "sha256-sr48RGLYcMKuyH9p+5BhnR6QpKBvNOqqtRryw3+pbBk="; + }; + + postPatch = '' + sed -i '/AC_INIT/s/m4_esyscmd.*/${version}])/' configure.ac + ''; + + nativeBuildInputs = [ + autoconf + automake + autoreconfHook + pkg-config + ]; + + buildInputs = [ + cairo + gettext + gtk2-x11 + libtool + ]; + + configureFlags = [ + "--disable-update-desktop-database" + ]; + + meta = with lib; { + description = "A Gerber (RS-274X) viewer"; + homepage = "https://gerbv.github.io/"; + changelog = "https://github.com/gerbv/gerbv/releases/tag/v${version}"; + license = licenses.gpl2Plus; + maintainers = with maintainers; [ mog ]; + platforms = platforms.unix; + }; +} diff --git a/nixpkgs/pkgs/applications/science/electronics/gtkwave/0001-Fix-detection-of-quartz-in-gdk-3.0-target.patch b/nixpkgs/pkgs/applications/science/electronics/gtkwave/0001-Fix-detection-of-quartz-in-gdk-3.0-target.patch new file mode 100644 index 000000000000..b28e0b8e9720 --- /dev/null +++ b/nixpkgs/pkgs/applications/science/electronics/gtkwave/0001-Fix-detection-of-quartz-in-gdk-3.0-target.patch @@ -0,0 +1,40 @@ +From 69a6ab80cf0908c2a44430c297932ef3659a1655 Mon Sep 17 00:00:00 2001 +From: Jiajie Chen <c@jia.je> +Date: Wed, 22 Jun 2022 16:24:10 +0800 +Subject: [PATCH 1/2] Fix detection of quartz in gdk-3.0 target + +The GTK+3 built by Nix targets ``broadway quartz`` instead of only `quartz`, +thus the target check is wrong. The script is modified to look up `quartz` in a +loop. The variable name is renamed to `targets` in `gdk-3.0.pc` as well. + +--- + configure | 6 +++++- + 1 file changed, 5 insertions(+), 1 deletion(-) + +diff --git a/configure b/configure +index 628a80f..9cb88d5 100755 +--- a/configure ++++ b/configure +@@ -7361,7 +7361,10 @@ $as_echo "yes" >&6; } + fi + GTK_VER=`$PKG_CONFIG gtk+-3.0 --modversion` + +- _gdk_tgt=`$PKG_CONFIG --variable=target gdk-3.0` ++ # gdk-3.0 may have multiple targets e.g. "broadway quartz" ++ _gdk_tgts=`$PKG_CONFIG --variable=targets gdk-3.0` ++ for _gdk_tgt in $_gdk_tgts; ++ do + if test "x$_gdk_tgt" = xquartz; then + + pkg_failed=no +@@ -7466,6 +7469,7 @@ fi + COCOA_GTK_LDFLAGS="-framework Cocoa -framework ApplicationServices" + + fi ++ done + + if test x$with_gconf = xyes; then + +-- +2.36.1 + diff --git a/nixpkgs/pkgs/applications/science/electronics/gtkwave/0002-Check-GDK_WINDOWING_X11-macro-when-using-GtkPlug.patch b/nixpkgs/pkgs/applications/science/electronics/gtkwave/0002-Check-GDK_WINDOWING_X11-macro-when-using-GtkPlug.patch new file mode 100644 index 000000000000..456f5fa278f3 --- /dev/null +++ b/nixpkgs/pkgs/applications/science/electronics/gtkwave/0002-Check-GDK_WINDOWING_X11-macro-when-using-GtkPlug.patch @@ -0,0 +1,101 @@ +From 6045177a0d4753bb7a6a6ffc3f1a4a3e96129c6d Mon Sep 17 00:00:00 2001 +From: Jiajie Chen <c@jia.je> +Date: Wed, 22 Jun 2022 17:03:29 +0800 +Subject: [PATCH 2/2] Check GDK_WINDOWING_X11 macro when using GtkPlug + +--- + src/main.c | 5 +++++ + src/twinwave.c | 12 ++++++++++-- + 2 files changed, 15 insertions(+), 2 deletions(-) + +diff --git a/src/main.c b/src/main.c +index 81bf505..b89f629 100644 +--- a/src/main.c ++++ b/src/main.c +@@ -2080,10 +2080,15 @@ if(!GLOBALS->socket_xid) + #ifdef WAVE_USE_XID + else + { ++#ifdef GDK_WINDOWING_X11 + GLOBALS->mainwindow = gtk_plug_new(GLOBALS->socket_xid); + gtk_widget_show(GLOBALS->mainwindow); + + g_signal_connect(XXX_GTK_OBJECT(GLOBALS->mainwindow), "destroy", /* formerly was "destroy" */G_CALLBACK(plug_destroy),"Plug destroy"); ++#else ++ fprintf(stderr, "GTKWAVE | GtkPlug widget is unavailable\n"); ++ exit(1); ++#endif + } + #endif + } +diff --git a/src/twinwave.c b/src/twinwave.c +index 590c7f6..d5c60f2 100644 +--- a/src/twinwave.c ++++ b/src/twinwave.c +@@ -143,15 +143,19 @@ if(GDK_IS_WAYLAND_DISPLAY(gdk_display_get_default())) + use_embedded = 0; + } + #endif ++#if defined(__GTK_SOCKET_H__) && defined(GDK_WINDOWING_X11) + { + xsocket[0] = gtk_socket_new (); + xsocket[1] = gtk_socket_new (); + gtk_widget_show (xsocket[0]); + gtk_widget_show (xsocket[1]); + } ++#endif + ++#if defined(__GTK_SOCKET_H__) && defined(GDK_WINDOWING_X11) + if(!twinwayland) + g_signal_connect(XXX_GTK_OBJECT(xsocket[0]), "plug-removed", G_CALLBACK(plug_removed), NULL); ++#endif + + #if GTK_CHECK_VERSION(3,0,0) + main_vbox = gtk_box_new(GTK_ORIENTATION_VERTICAL, 5); +@@ -208,7 +212,7 @@ if(hMapFile != NULL) + memset(&pi, 0, sizeof(PROCESS_INFORMATION)); + + sprintf(buf, "0+%08X", shmid); +-#ifdef MINGW_USE_XID ++#if defined(MINGW_USE_XID) && defined(__GTK_SOCKET_H__) && defined(GDK_WINDOWING_X11) + sprintf(buf2, "%x", gtk_socket_get_id (GTK_SOCKET(xsocket[0]))); + #else + sprintf(buf2, "%x", 0); +@@ -279,7 +283,7 @@ if(hMapFile != NULL) + memset(&pi, 0, sizeof(PROCESS_INFORMATION)); + + sprintf(buf, "1+%08X", shmid); +-#ifdef MINGW_USE_XID ++#if defined(MINGW_USE_XID) && defined(__GTK_SOCKET_H__) && defined(GDK_WINDOWING_X11) + sprintf(buf2, "%x", gtk_socket_get_id (GTK_SOCKET(xsocket[1]))); + #else + sprintf(buf2, "%x", 0); +@@ -429,10 +433,12 @@ if(shmid >=0) + sprintf(buf, "0+%08X", shmid); + if(use_embedded) + { ++#if defined(__GTK_SOCKET_H__) && defined(GDK_WINDOWING_X11) + #ifdef MAC_INTEGRATION + sprintf(buf2, "%x", gtk_socket_get_id (GTK_SOCKET(xsocket[0]))); + #else + sprintf(buf2, "%lx", (long)gtk_socket_get_id (GTK_SOCKET(xsocket[0]))); ++#endif + #endif + } + else +@@ -467,10 +473,12 @@ if(shmid >=0) + sprintf(buf, "1+%08X", shmid); + if(use_embedded) + { ++#if defined(__GTK_SOCKET_H__) && defined(GDK_WINDOWING_X11) + #ifdef MAC_INTEGRATION + sprintf(buf2, "%x", gtk_socket_get_id (GTK_SOCKET(xsocket[1]))); + #else + sprintf(buf2, "%lx", (long)gtk_socket_get_id (GTK_SOCKET(xsocket[1]))); ++#endif + #endif + } + else +-- +2.36.1 + diff --git a/nixpkgs/pkgs/applications/science/electronics/gtkwave/default.nix b/nixpkgs/pkgs/applications/science/electronics/gtkwave/default.nix new file mode 100644 index 000000000000..7b7b54201bf7 --- /dev/null +++ b/nixpkgs/pkgs/applications/science/electronics/gtkwave/default.nix @@ -0,0 +1,52 @@ +{ bzip2 +, fetchurl +, glib +, gperf +, gtk3 +, gtk-mac-integration +, judy +, lib +, pkg-config +, stdenv +, tcl +, tk +, wrapGAppsHook +, xz +}: + +stdenv.mkDerivation rec { + pname = "gtkwave"; + version = "3.3.118"; + + src = fetchurl { + url = "mirror://sourceforge/gtkwave/${pname}-gtk3-${version}.tar.gz"; + sha256 = "sha256-D0MwwCiiqz0vTUzur222kl2wEMS2/VLRECLQ5d6gSGo="; + }; + + nativeBuildInputs = [ pkg-config wrapGAppsHook ]; + buildInputs = [ bzip2 glib gperf gtk3 judy tcl tk xz ] + ++ lib.optional stdenv.isDarwin gtk-mac-integration; + + # fix compilation under Darwin + # remove these patches upon next release + # https://github.com/gtkwave/gtkwave/pull/136 + patches = [ + ./0001-Fix-detection-of-quartz-in-gdk-3.0-target.patch + ./0002-Check-GDK_WINDOWING_X11-macro-when-using-GtkPlug.patch + ]; + + configureFlags = [ + "--with-tcl=${tcl}/lib" + "--with-tk=${tk}/lib" + "--enable-judy" + "--enable-gtk3" + ]; + + meta = { + description = "VCD/Waveform viewer for Unix and Win32"; + homepage = "https://gtkwave.sourceforge.net"; + license = lib.licenses.gpl2Plus; + maintainers = with lib.maintainers; [ thoughtpolice jiegec jleightcap ]; + platforms = lib.platforms.linux ++ lib.platforms.darwin; + }; +} diff --git a/nixpkgs/pkgs/applications/science/electronics/hal-hardware-analyzer/default.nix b/nixpkgs/pkgs/applications/science/electronics/hal-hardware-analyzer/default.nix new file mode 100644 index 000000000000..6bdc197269cc --- /dev/null +++ b/nixpkgs/pkgs/applications/science/electronics/hal-hardware-analyzer/default.nix @@ -0,0 +1,152 @@ +{ lib +, stdenv +, boost +, cmake +, fetchFromGitHub +, fetchpatch +, graphviz +, igraph +, llvmPackages +, ninja +, pkg-config +, python3Packages +, qtbase +, qtsvg +, quazip +, rapidjson +, spdlog +, suitesparse +, wrapQtAppsHook +, z3 +}: + +let + # hal doesn't work with igraph 0.10.x yet https://github.com/emsec/hal/pull/487 + igraph' = igraph.overrideAttrs (final: prev: { + version = "0.9.10"; + src = fetchFromGitHub { + owner = "igraph"; + repo = final.pname; + rev = final.version; + hash = "sha256-prDadHsNhDRkNp1i0niKIYxE0g85Zs0ngvUy6uK8evk="; + }; + patches = (prev.patches or []) ++ [ + # needed by clang + (fetchpatch { + name = "libxml2-2.11-compat.patch"; + url = "https://github.com/igraph/igraph/commit/5ad464be5ae2f6ebb69c97cb0140c800cc8d97d6.patch"; + hash = "sha256-adU5SctH+H54UaAmr5BZInytD3wjUzLtQbCwngAWs4o="; + }) + ]; + postPatch = prev.postPatch + lib.optionalString stdenv.isAarch64 '' + # https://github.com/igraph/igraph/issues/1694 + substituteInPlace tests/CMakeLists.txt \ + --replace "igraph_scg_grouping3" "" \ + --replace "igraph_scg_semiprojectors2" "" + ''; + NIX_CFLAGS_COMPILE = (prev.NIX_CFLAGS_COMPILE or []) ++ lib.optionals stdenv.cc.isClang [ + "-Wno-strict-prototypes" + "-Wno-unused-but-set-parameter" + "-Wno-unused-but-set-variable" + ]; + # general options brought back from the old 0.9.x package + buildInputs = prev.buildInputs ++ [ suitesparse ]; + cmakeFlags = prev.cmakeFlags ++ [ "-DIGRAPH_USE_INTERNAL_CXSPARSE=OFF" ]; + }); + +in stdenv.mkDerivation rec { + version = "4.2.0"; + pname = "hal-hardware-analyzer"; + + src = fetchFromGitHub { + owner = "emsec"; + repo = "hal"; + rev = "v${version}"; + sha256 = "sha256-Yl86AClE3vWygqj1omCOXX8koJK2SjTkMZFReRThez0="; + }; + + patches = [ + (fetchpatch { + name = "cmake-add-no-vendored-options.patch"; + # https://github.com/emsec/hal/pull/529 + url = "https://github.com/emsec/hal/commit/37d5c1a0eacb25de57cc552c13e74f559a5aa6e8.patch"; + hash = "sha256-a30VjDt4roJOTntisixqnH17wwCgWc4VWeh1+RgqFuY="; + }) + (fetchpatch { + name = "hal-fix-fmt-10.1-compat.patch"; + # https://github.com/emsec/hal/pull/530 + url = "https://github.com/emsec/hal/commit/b639a56b303141afbf6731b70b7cc7452551f024.patch"; + hash = "sha256-a7AyDEKkqdbiHpa4OHTRuP9Yewb3Nxs/j6bwez5m0yU="; + }) + (fetchpatch { + name = "fix-gcc-13-build.patch"; + # https://github.com/emsec/hal/pull/557 + url = "https://github.com/emsec/hal/commit/831b1a7866aa9aabd55ff288c084862dc6a138d8.patch"; + hash = "sha256-kB/sJJtLGl5PUv+mmWVpee/okkJzp5HF0BCiCRCcTKw="; + }) + ]; + + # make sure bundled dependencies don't get in the way - install also otherwise + # copies them in full to the output, bloating the package + postPatch = '' + shopt -s extglob + rm -rf deps/!(abc|sanitizers-cmake|subprocess)/* + shopt -u extglob + ''; + + nativeBuildInputs = [ + cmake + ninja + pkg-config + wrapQtAppsHook + ]; + buildInputs = [ + qtbase + qtsvg + boost + rapidjson + igraph' + spdlog + graphviz + z3 + quazip + ] + ++ (with python3Packages; [ python pybind11 ]) + ++ lib.optional stdenv.cc.isClang llvmPackages.openmp + ; + + cmakeFlags = with lib.versions; [ + "-DHAL_VERSION_RETURN=${version}" + "-DHAL_VERSION_MAJOR=${major version}" + "-DHAL_VERSION_MINOR=${minor version}" + "-DHAL_VERSION_PATCH=${patch version}" + "-DHAL_VERSION_TWEAK=0" + "-DHAL_VERSION_ADDITIONAL_COMMITS=0" + "-DHAL_VERSION_DIRTY=false" + "-DHAL_VERSION_BROKEN=false" + "-DENABLE_INSTALL_LDCONFIG=off" + "-DUSE_VENDORED_PYBIND11=off" + "-DUSE_VENDORED_SPDLOG=off" + "-DUSE_VENDORED_QUAZIP=off" + "-DUSE_VENDORED_IGRAPH=off" + "-DBUILD_ALL_PLUGINS=on" + ]; + # needed for macos build - this is why we use wrapQtAppsHook instead of + # the qt mkDerivation - the latter forcibly overrides this. + cmakeBuildType = "MinSizeRel"; + + # some plugins depend on other plugins and need to be able to load them + postFixup = lib.optionalString stdenv.isLinux '' + find $out/lib/hal_plugins -name '*.so*' | while read -r f ; do + patchelf --set-rpath "$(patchelf --print-rpath "$f"):$out/lib/hal_plugins" "$f" + done + ''; + + meta = with lib; { + description = "A comprehensive reverse engineering and manipulation framework for gate-level netlists"; + homepage = "https://github.com/emsec/hal"; + license = licenses.mit; + platforms = platforms.unix; + maintainers = with maintainers; [ ris shamilton ]; + }; +} diff --git a/nixpkgs/pkgs/applications/science/electronics/horizon-eda/base.nix b/nixpkgs/pkgs/applications/science/electronics/horizon-eda/base.nix new file mode 100644 index 000000000000..8ce75a6ce241 --- /dev/null +++ b/nixpkgs/pkgs/applications/science/electronics/horizon-eda/base.nix @@ -0,0 +1,58 @@ +{ lib +, cppzmq +, curl +, fetchFromGitHub +, glm +, gtkmm3 +, libarchive +, libepoxy +, libgit2 +, librsvg +, libuuid +, opencascade-occt +, pkg-config +, podofo +, sqlite +}: + +# This base is used in horizon-eda and python3Packages.horizon-eda +rec { + pname = "horizon-eda"; + version = "2.5.0"; + + src = fetchFromGitHub { + owner = "horizon-eda"; + repo = "horizon"; + rev = "v${version}"; + hash = "sha256-UcjbDJR6shyETpanNkRoH8LF8r6gFjsyNHVSCMHKqS8="; + }; + + nativeBuildInputs = [ + pkg-config + ]; + + buildInputs = [ + cppzmq + curl + glm + gtkmm3 + libarchive + libepoxy + libgit2 + librsvg + libuuid + opencascade-occt + podofo + sqlite + ]; + + CASROOT = opencascade-occt; + + meta = with lib; { + description = "A free EDA software to develop printed circuit boards"; + homepage = "https://horizon-eda.org"; + maintainers = with maintainers; [ guserav jue89 ]; + license = licenses.gpl3Plus; + platforms = platforms.linux; + }; +} diff --git a/nixpkgs/pkgs/applications/science/electronics/horizon-eda/default.nix b/nixpkgs/pkgs/applications/science/electronics/horizon-eda/default.nix new file mode 100644 index 000000000000..1fbc92f06115 --- /dev/null +++ b/nixpkgs/pkgs/applications/science/electronics/horizon-eda/default.nix @@ -0,0 +1,38 @@ +{ stdenv +, boost +, callPackage +, coreutils +, libspnav +, python3 +, wrapGAppsHook +}: + +let + base = callPackage ./base.nix { }; +in +stdenv.mkDerivation rec { + inherit (base) pname version src meta CASROOT; + + # provide base for python module + passthru = { + inherit base; + }; + + buildInputs = base.buildInputs ++ [ + libspnav + ]; + + nativeBuildInputs = base.nativeBuildInputs ++ [ + boost.dev + wrapGAppsHook + python3 + ]; + + installFlags = [ + "INSTALL=${coreutils}/bin/install" + "DESTDIR=$(out)" + "PREFIX=" + ]; + + enableParallelBuilding = true; +} diff --git a/nixpkgs/pkgs/applications/science/electronics/hyp2mat/default.nix b/nixpkgs/pkgs/applications/science/electronics/hyp2mat/default.nix new file mode 100644 index 000000000000..799af4c43086 --- /dev/null +++ b/nixpkgs/pkgs/applications/science/electronics/hyp2mat/default.nix @@ -0,0 +1,53 @@ +{ lib, stdenv +, fetchFromGitHub +, bison +, flex +, gengetopt +, help2man +, groff +, libharu +, autoreconfHook +, pkg-config +, libpng +, zlib +}: + +stdenv.mkDerivation rec { + pname = "hyp2mat"; + version = "0.0.18"; + + src = fetchFromGitHub { + owner = "koendv"; + repo = "hyp2mat"; + rev = "v${version}"; + sha256 = "03ibk51swxfl7pfrhcrfiffdi4mnf8kla0g1xj1lsrvrjwapfx03"; + }; + + nativeBuildInputs = [ + autoreconfHook + pkg-config + ]; + + buildInputs = [ + libharu + libpng + zlib + bison + flex + gengetopt + help2man + groff + ]; + + configureFlags = [ "--enable-library" ]; + + enableParallelBuilding = true; + + meta = with lib; { + description = "Import Hyperlynx Boardsim files to openEMS, an open source 3D full-wave electromagnetic field solver"; + homepage = "https://github.com/koendv/hyp2mat"; + license = licenses.gpl3Plus; + maintainers = with maintainers; [ matthuszagh ]; + platforms = platforms.linux; + }; +} diff --git a/nixpkgs/pkgs/applications/science/electronics/kicad/addons/default.nix b/nixpkgs/pkgs/applications/science/electronics/kicad/addons/default.nix new file mode 100644 index 000000000000..5170e7efce36 --- /dev/null +++ b/nixpkgs/pkgs/applications/science/electronics/kicad/addons/default.nix @@ -0,0 +1,5 @@ +{ kicad }: +{ + kikit = kicad.callPackage ./kikit.nix { addonName = "kikit"; }; + kikit-library = kicad.callPackage ./kikit.nix { addonName = "kikit-library"; }; +} diff --git a/nixpkgs/pkgs/applications/science/electronics/kicad/addons/kikit.nix b/nixpkgs/pkgs/applications/science/electronics/kicad/addons/kikit.nix new file mode 100644 index 000000000000..6e5fc5ad9678 --- /dev/null +++ b/nixpkgs/pkgs/applications/science/electronics/kicad/addons/kikit.nix @@ -0,0 +1,52 @@ +# For building the multiple addons that are in the kikit repo. +{ stdenv +, bc +, kikit +, zip +, python3 +, addonName +, addonPath +}: +let + # This python is only used when building the package, it's not the python + # environment that will ultimately run the code packaged here. The python env defined + # in KiCad will import the python code packaged here when KiCad starts up. + python = python3.withPackages (ps: with ps; [ click ]); + kikit-module = python3.pkgs.toPythonModule (kikit.override { inherit python3; }); + + # The following different addons can be built from the same source. + targetSpecs = { + "kikit" = { + makeTarget = "pcm-kikit"; + resultZip = "pcm-kikit.zip"; + description = "KiCad plugin and a CLI tool to automate several tasks in a standard KiCad workflow"; + }; + "kikit-library" = { + makeTarget = "pcm-lib"; + resultZip = "pcm-kikit-lib.zip"; + description = "KiKit uses these symbols and footprints to annotate your boards (e.g., to place a tab in a panel)."; + }; + }; + targetSpec = targetSpecs.${addonName}; +in +stdenv.mkDerivation { + name = "kicadaddon-${addonName}"; + inherit (kikit-module) src version; + + nativeBuildInputs = [ python bc zip ]; + propagatedBuildInputs = [ kikit-module ]; + + buildPhase = '' + patchShebangs scripts/setJson.py + make ${targetSpec.makeTarget} + ''; + + installPhase = '' + mkdir $out + mv build/${targetSpec.resultZip} $out/${addonPath} + ''; + + meta = kikit-module.meta // { + description = targetSpec.description; + }; +} diff --git a/nixpkgs/pkgs/applications/science/electronics/kicad/base.nix b/nixpkgs/pkgs/applications/science/electronics/kicad/base.nix new file mode 100644 index 000000000000..bff63f3b2d7e --- /dev/null +++ b/nixpkgs/pkgs/applications/science/electronics/kicad/base.nix @@ -0,0 +1,202 @@ +{ lib +, stdenv +, cmake +, libGLU +, libGL +, zlib +, wxGTK +, gtk3 +, libX11 +, gettext +, glew +, glm +, cairo +, curl +, openssl +, boost +, pkg-config +, doxygen +, graphviz +, pcre +, libpthreadstubs +, libXdmcp +, unixODBC + +, util-linux +, libselinux +, libsepol +, libthai +, libdatrie +, libxkbcommon +, libepoxy +, dbus +, at-spi2-core +, libXtst +, pcre2 +, libdeflate + +, swig4 +, python +, wxPython +, opencascade-occt +, libngspice +, valgrind + +, stable +, testing +, baseName +, kicadSrc +, kicadVersion +, withNgspice +, withScripting +, withI18n +, debug +, sanitizeAddress +, sanitizeThreads +}: + +assert lib.assertMsg (!(sanitizeAddress && sanitizeThreads)) + "'sanitizeAddress' and 'sanitizeThreads' are mutually exclusive, use one."; +assert testing -> !stable + -> throw "testing implies stable and cannot be used with stable = false"; + +let + inherit (lib) optional optionals optionalString; +in +stdenv.mkDerivation rec { + pname = "kicad-base"; + version = if (stable) then kicadVersion else builtins.substring 0 10 src.rev; + + src = kicadSrc; + + patches = [ + # upstream issue 12941 (attempted to upstream, but appreciably unacceptable) + ./writable.patch + # https://gitlab.com/kicad/code/kicad/-/issues/15687 + ./runtime_stock_data_path.patch + ]; + + # tagged releases don't have "unknown" + # kicad testing and nightlies use git describe --dirty + # nix removes .git, so its approximated here + postPatch = lib.optionalString (!stable || testing) '' + substituteInPlace cmake/KiCadVersion.cmake \ + --replace "unknown" "${builtins.substring 0 10 src.rev}" + + substituteInPlace cmake/CreateGitVersionHeader.cmake \ + --replace "0000000000000000000000000000000000000000" "${src.rev}" + ''; + + makeFlags = optionals (debug) [ "CFLAGS+=-Og" "CFLAGS+=-ggdb" ]; + + cmakeFlags = [ + "-DKICAD_USE_EGL=ON" + "-DOCC_INCLUDE_DIR=${opencascade-occt}/include/opencascade" + ] + ++ optionals (stable) [ + # https://gitlab.com/kicad/code/kicad/-/issues/12491 + # should be resolved in the next major? release + "-DCMAKE_CTEST_ARGUMENTS='--exclude-regex;qa_eeschema'" + ] + ++ optional (stable && !withNgspice) "-DKICAD_SPICE=OFF" + ++ optionals (!withScripting) [ + "-DKICAD_SCRIPTING_WXPYTHON=OFF" + ] + ++ optionals (withI18n) [ + "-DKICAD_BUILD_I18N=ON" + ] + ++ optionals (!doInstallCheck) [ + "-DKICAD_BUILD_QA_TESTS=OFF" + ] + ++ optionals (debug) [ + "-DKICAD_STDLIB_DEBUG=ON" + "-DKICAD_USE_VALGRIND=ON" + ] + ++ optionals (sanitizeAddress) [ + "-DKICAD_SANITIZE_ADDRESS=ON" + ] + ++ optionals (sanitizeThreads) [ + "-DKICAD_SANITIZE_THREADS=ON" + ]; + + cmakeBuildType = if debug then "Debug" else "Release"; + + nativeBuildInputs = [ + cmake + doxygen + graphviz + pkg-config + ] + # wanted by configuration on linux, doesn't seem to affect performance + # no effect on closure size + ++ optionals (stdenv.isLinux) [ + util-linux + libselinux + libsepol + libthai + libdatrie + libxkbcommon + libepoxy + dbus + at-spi2-core + libXtst + pcre2 + ]; + + buildInputs = [ + libGLU + libGL + zlib + libX11 + wxGTK + gtk3 + pcre + libXdmcp + gettext + glew + glm + libpthreadstubs + cairo + curl + openssl + boost + swig4 + python + unixODBC + libdeflate + opencascade-occt + ] + ++ optional (withScripting) wxPython + ++ optional (withNgspice) libngspice + ++ optional (debug) valgrind; + + # some ngspice tests attempt to write to $HOME/.cache/ + # this could be and was resolved with XDG_CACHE_HOME = "$TMP"; + # but failing tests still attempt to create $HOME + # and the newer CLI tests seem to also use $HOME... + HOME = "$TMP"; + + # debug builds fail all but the python test + doInstallCheck = !(debug); + installCheckTarget = "test"; + + pythonForTests = python.withPackages(ps: with ps; [ + numpy + pytest + cairosvg + pytest-image-diff + ]); + nativeInstallCheckInputs = optional (!stable) pythonForTests; + + dontStrip = debug; + + meta = { + description = "Just the built source without the libraries"; + longDescription = '' + Just the build products, the libraries are passed via an env var in the wrapper, default.nix + ''; + homepage = "https://www.kicad.org/"; + license = lib.licenses.agpl3; + platforms = lib.platforms.all; + }; +} diff --git a/nixpkgs/pkgs/applications/science/electronics/kicad/default.nix b/nixpkgs/pkgs/applications/science/electronics/kicad/default.nix new file mode 100644 index 000000000000..fa0c7ae7a75e --- /dev/null +++ b/nixpkgs/pkgs/applications/science/electronics/kicad/default.nix @@ -0,0 +1,292 @@ +{ lib, stdenv +, runCommand +, newScope +, fetchFromGitLab +, makeWrapper +, symlinkJoin +, callPackage +, callPackages + +, gnome +, dconf +, gtk3 +, wxGTK32 +, librsvg +, cups +, gsettings-desktop-schemas +, hicolor-icon-theme + +, unzip +, jq + +, pname ? "kicad" +, stable ? true +, testing ? false +, withNgspice ? !stdenv.isDarwin +, libngspice +, withScripting ? true +, python3 +, addons ? [ ] +, debug ? false +, sanitizeAddress ? false +, sanitizeThreads ? false +, with3d ? true +, withI18n ? true +, srcs ? { } +}: + +# `addons`: https://dev-docs.kicad.org/en/addons/ +# +# ```nix +# kicad = pkgs.kicad.override { +# addons = with pkgs.kicadAddons; [ kikit kikit-library ]; +# }; +# ``` + +# The `srcs` parameter can be used to override the kicad source code +# and all libraries, which are otherwise inaccessible +# to overlays since most of the kicad build expression has been +# refactored into base.nix, most of the library build expressions have +# been refactored into libraries.nix. Overrides are only applied when +# building `kicad-unstable`. The `srcs` parameter has +# no effect for stable `kicad`. `srcs` takes an attribute set in which +# any of the following attributes are meaningful (though none are +# mandatory): "kicad", "kicadVersion", "symbols", "templates", +# "footprints", "packages3d", and "libVersion". "kicadVersion" and +# "libVersion" should be set to a string with the desired value for +# the version attribute in kicad's `mkDerivation` and the version +# attribute in any of the library's `mkDerivation`, respectively. +# "kicad", "symbols", "templates", "footprints", and "packages3d" +# should be set to an appropriate fetcher (e.g. `fetchFromGitLab`). +# So, for example, a possible overlay for kicad is: +# +# final: prev: + +# { +# kicad-unstable = (prev.kicad-unstable.override { +# srcs = { +# kicadVersion = "2020-10-08"; +# kicad = prev.fetchFromGitLab { +# group = "kicad"; +# owner = "code"; +# repo = "kicad"; +# rev = "fd22fe8e374ce71d57e9f683ba996651aa69fa4e"; +# sha256 = "sha256-F8qugru/jU3DgZSpQXQhRGNFSk0ybFRkpyWb7HAGBdc="; +# }; +# }; +# }); +# } + +let + baseName = if (testing) then "kicad-testing" + else if (stable) then "kicad" + else "kicad-unstable"; + versionsImport = import ./versions.nix; + + # versions.nix does not provide us with version, src and rev. We + # need to turn this into approprate fetcher calls. + kicadSrcFetch = fetchFromGitLab { + group = "kicad"; + owner = "code"; + repo = "kicad"; + rev = versionsImport.${baseName}.kicadVersion.src.rev; + sha256 = versionsImport.${baseName}.kicadVersion.src.sha256; + }; + + libSrcFetch = name: fetchFromGitLab { + group = "kicad"; + owner = "libraries"; + repo = "kicad-${name}"; + rev = versionsImport.${baseName}.libVersion.libSources.${name}.rev; + sha256 = versionsImport.${baseName}.libVersion.libSources.${name}.sha256; + }; + + # only override `src` or `version` if building `kicad-unstable` with + # the appropriate attribute defined in `srcs`. + srcOverridep = attr: (!stable && builtins.hasAttr attr srcs); + + # use default source and version (as defined in versions.nix) by + # default, or use the appropriate attribute from `srcs` if building + # unstable with `srcs` properly defined. + kicadSrc = + if srcOverridep "kicad" then srcs.kicad + else kicadSrcFetch; + kicadVersion = + if srcOverridep "kicadVersion" then srcs.kicadVersion + else versionsImport.${baseName}.kicadVersion.version; + + libSrc = name: if srcOverridep name then srcs.${name} else libSrcFetch name; + # TODO does it make sense to only have one version for all libs? + libVersion = + if srcOverridep "libVersion" then srcs.libVersion + else versionsImport.${baseName}.libVersion.version; + + wxGTK = wxGTK32; + python = python3; + wxPython = python.pkgs.wxpython; + addonPath = "addon.zip"; + addonsDrvs = map (pkg: pkg.override { inherit addonPath python3; }) addons; + + addonsJoined = + runCommand "addonsJoined" + { + inherit addonsDrvs; + nativeBuildInputs = [ unzip jq ]; + } '' + mkdir $out + + for pkg in $addonsDrvs; do + unzip $pkg/addon.zip -d unpacked + + folder_name=$(jq .identifier unpacked/metadata.json --raw-output | tr . _) + for d in unpacked/*; do + if [ -d "$d" ]; then + dest=$out/share/kicad/scripting/$(basename $d)/$folder_name + mkdir -p $(dirname $dest) + + mv $d $dest + fi + done + rm -r unpacked + done + ''; + + inherit (lib) concatStringsSep flatten optionalString optionals; +in +stdenv.mkDerivation rec { + + # Common libraries, referenced during runtime, via the wrapper. + passthru.libraries = callPackages ./libraries.nix { inherit libSrc; }; + passthru.callPackage = newScope { inherit addonPath python3; }; + base = callPackage ./base.nix { + inherit stable testing baseName; + inherit kicadSrc kicadVersion; + inherit wxGTK python wxPython; + inherit withNgspice withScripting withI18n; + inherit debug sanitizeAddress sanitizeThreads; + }; + + inherit pname; + version = if (stable) then kicadVersion else builtins.substring 0 10 src.src.rev; + + src = base; + dontUnpack = true; + dontConfigure = true; + dontBuild = true; + dontFixup = true; + + pythonPath = optionals (withScripting) + [ wxPython python.pkgs.six python.pkgs.requests ] ++ addonsDrvs; + + nativeBuildInputs = [ makeWrapper ] + ++ optionals (withScripting) + [ python.pkgs.wrapPython ]; + + # KICAD7_TEMPLATE_DIR only works with a single path (it does not handle : separated paths) + # but it's used to find both the templates and the symbol/footprint library tables + # https://gitlab.com/kicad/code/kicad/-/issues/14792 + template_dir = symlinkJoin { + name = "KiCad_template_dir"; + paths = with passthru.libraries; [ + "${templates}/share/kicad/template" + "${footprints}/share/kicad/template" + "${symbols}/share/kicad/template" + ]; + }; + # We are emulating wrapGAppsHook, along with other variables to the wrapper + makeWrapperArgs = with passthru.libraries; [ + "--prefix XDG_DATA_DIRS : ${base}/share" + "--prefix XDG_DATA_DIRS : ${hicolor-icon-theme}/share" + "--prefix XDG_DATA_DIRS : ${gnome.adwaita-icon-theme}/share" + "--prefix XDG_DATA_DIRS : ${gtk3}/share/gsettings-schemas/${gtk3.name}" + "--prefix XDG_DATA_DIRS : ${gsettings-desktop-schemas}/share/gsettings-schemas/${gsettings-desktop-schemas.name}" + # wrapGAppsHook did these two as well, no idea if it matters... + "--prefix XDG_DATA_DIRS : ${cups}/share" + "--prefix GIO_EXTRA_MODULES : ${dconf}/lib/gio/modules" + # required to open a bug report link in firefox-wayland + "--set-default MOZ_DBUS_REMOTE 1" + "--set-default KICAD7_FOOTPRINT_DIR ${footprints}/share/kicad/footprints" + "--set-default KICAD7_SYMBOL_DIR ${symbols}/share/kicad/symbols" + "--set-default KICAD7_TEMPLATE_DIR ${template_dir}" + ] + ++ optionals (addons != [ ]) ( + let stockDataPath = symlinkJoin { + name = "kicad_stock_data_path"; + paths = [ + "${base}/share/kicad" + "${addonsJoined}/share/kicad" + ]; + }; + in + [ "--set-default NIX_KICAD7_STOCK_DATA_PATH ${stockDataPath}" ] + ) + ++ optionals (with3d) + [ + "--set-default KICAD7_3DMODEL_DIR ${packages3d}/share/kicad/3dmodels" + ] + ++ optionals (withNgspice) [ "--prefix LD_LIBRARY_PATH : ${libngspice}/lib" ] + + # infinisil's workaround for #39493 + ++ [ "--set GDK_PIXBUF_MODULE_FILE ${librsvg}/lib/gdk-pixbuf-2.0/2.10.0/loaders.cache" ] + ; + + # why does $makeWrapperArgs have to be added explicitly? + # $out and $program_PYTHONPATH don't exist when makeWrapperArgs gets set? + installPhase = + let + bin = if stdenv.isDarwin then "*.app/Contents/MacOS" else "bin"; + tools = [ "kicad" "pcbnew" "eeschema" "gerbview" "pcb_calculator" "pl_editor" "bitmap2component" ]; + utils = [ "dxf2idf" "idf2vrml" "idfcyl" "idfrect" "kicad-cli" ]; + in + (concatStringsSep "\n" + (flatten [ + "runHook preInstall" + + (optionalString (withScripting) "buildPythonPath \"${base} $pythonPath\" \n") + + # wrap each of the directly usable tools + (map + (tool: "makeWrapper ${base}/${bin}/${tool} $out/bin/${tool} $makeWrapperArgs" + + optionalString (withScripting) " --set PYTHONPATH \"$program_PYTHONPATH\"" + ) + tools) + + # link in the CLI utils + (map (util: "ln -s ${base}/${bin}/${util} $out/bin/${util}") utils) + + "runHook postInstall" + ]) + ) + ; + + postInstall = '' + mkdir -p $out/share + ln -s ${base}/share/applications $out/share/applications + ln -s ${base}/share/icons $out/share/icons + ln -s ${base}/share/mime $out/share/mime + ln -s ${base}/share/metainfo $out/share/metainfo + ''; + + passthru.updateScript = { + command = [ ./update.sh "${pname}" ]; + supportedFeatures = [ "commit" ]; + }; + + meta = rec { + description = (if (stable) + then "Open Source Electronics Design Automation suite" + else if (testing) then "Open Source EDA suite, latest on stable branch" + else "Open Source EDA suite, latest on master branch") + + (lib.optionalString (!with3d) ", without 3D models"); + homepage = "https://www.kicad.org/"; + longDescription = '' + KiCad is an open source software suite for Electronic Design Automation. + The Programs handle Schematic Capture, and PCB Layout with Gerber output. + ''; + license = lib.licenses.gpl3Plus; + maintainers = with lib.maintainers; [ evils ]; + platforms = lib.platforms.all; + broken = stdenv.isDarwin; + mainProgram = "kicad"; + }; +} diff --git a/nixpkgs/pkgs/applications/science/electronics/kicad/libraries.nix b/nixpkgs/pkgs/applications/science/electronics/kicad/libraries.nix new file mode 100644 index 000000000000..327f77d1c42f --- /dev/null +++ b/nixpkgs/pkgs/applications/science/electronics/kicad/libraries.nix @@ -0,0 +1,39 @@ +{ lib, stdenv +, cmake +, gettext +, libSrc +, stepreduce +, parallel +, zip +}: +let + mkLib = name: + stdenv.mkDerivation { + pname = "kicad-${name}"; + version = builtins.substring 0 10 (libSrc name).rev; + + src = libSrc name; + + nativeBuildInputs = [ cmake ] + ++ lib.optionals (name == "packages3d") [ + stepreduce + parallel + zip + ]; + + postInstall = lib.optional (name == "packages3d") '' + find $out -type f -name '*.step' | parallel 'stepreduce {} {} && zip -9 {.}.stpZ {} && rm {}' + ''; + + meta = rec { + license = lib.licenses.cc-by-sa-40; + platforms = lib.platforms.all; + }; + }; +in +{ + symbols = mkLib "symbols"; + templates = mkLib "templates"; + footprints = mkLib "footprints"; + packages3d = mkLib "packages3d"; +} diff --git a/nixpkgs/pkgs/applications/science/electronics/kicad/runtime_stock_data_path.patch b/nixpkgs/pkgs/applications/science/electronics/kicad/runtime_stock_data_path.patch new file mode 100644 index 000000000000..16f7e493c623 --- /dev/null +++ b/nixpkgs/pkgs/applications/science/electronics/kicad/runtime_stock_data_path.patch @@ -0,0 +1,15 @@ +diff --git a/common/paths.cpp b/common/paths.cpp +index a74cdd9..790cc58 100644 +--- a/common/paths.cpp ++++ b/common/paths.cpp +@@ -151,6 +151,10 @@ wxString PATHS::GetStockDataPath( bool aRespectRunFromBuildDir ) + { + wxString path; + ++ if( wxGetEnv( wxT( "NIX_KICAD7_STOCK_DATA_PATH" ), &path ) ) { ++ return path; ++ } ++ + if( aRespectRunFromBuildDir && wxGetEnv( wxT( "KICAD_RUN_FROM_BUILD_DIR" ), nullptr ) ) + { + // Allow debugging from build dir by placing relevant files/folders in the build root diff --git a/nixpkgs/pkgs/applications/science/electronics/kicad/update.sh b/nixpkgs/pkgs/applications/science/electronics/kicad/update.sh new file mode 100755 index 000000000000..b47e2d84b336 --- /dev/null +++ b/nixpkgs/pkgs/applications/science/electronics/kicad/update.sh @@ -0,0 +1,260 @@ +#!/usr/bin/env nix-shell +#!nix-shell -i bash -p coreutils git nix curl jq +# shellcheck shell=bash enable=all + +set -e +shopt -s inherit_errexit + +# this script will generate versions.nix in the right location +# this should contain the versions' revs and hashes +# the stable revs are stored only for ease of skipping + +# by default nix-prefetch-url uses XDG_RUNTIME_DIR as tmp +# which is /run/user/1000, which defaults to 10% of your RAM +# unless you have over 64GB of ram that'll be insufficient +# resulting in "tar: no space left on device" for packages3d +# hence: +export TMPDIR=/tmp + +# if something goes unrepairably wrong, run 'update.sh all clean' + +# TODO +# support parallel instances for each pname +# currently risks reusing old data +# no getting around manually checking if the build product works... +# if there is, default to commiting? +# won't work when running in parallel? +# remove items left in /nix/store? +# reuse hashes of already checked revs (to avoid redownloading testing's packages3d) + +# nixpkgs' update.nix passes in UPDATE_NIX_PNAME to indicate which package is being updated +# assigning a default value to that as shellcheck doesn't like the use of unassigned variables +: "${UPDATE_NIX_PNAME:=""}" +# update.nix can also parse JSON output of this script to formulate a commit +# this requires we collect the version string in the old versions.nix for the updated package +old_version="" +new_version="" + + +# get the latest tag that isn't an RC or *.99 +latest_tags="$(git ls-remote --tags --sort -version:refname https://gitlab.com/kicad/code/kicad.git)" +# using a scratch variable to ensure command failures get caught (SC2312) +scratch="$(grep -o 'refs/tags/[0-9]*\.[0-9]*\.[0-9]*$' <<< "${latest_tags}")" +scratch="$(grep -ve '\.99' -e '\.9\.9' <<< "${scratch}")" +scratch="$(sed -n '1p' <<< "${scratch}")" +latest_tag="$(cut -d '/' -f 3 <<< "${scratch}")" + +# get the latest branch name for testing +branches="$(git ls-remote --heads --sort -version:refname https://gitlab.com/kicad/code/kicad.git)" +scratch="$(grep -o 'refs/heads/[0-9]*\.[0-9]*$' <<< "${branches}")" +scratch="$(sed -n '1p' <<< "${scratch}")" +testing_branch="$(cut -d '/' -f 3 <<< "${scratch}")" + +# "latest_tag" and "master" directly refer to what we want +# "testing" uses "testing_branch" found above +all_versions=( "${latest_tag}" testing master ) + +prefetch="nix-prefetch-url --unpack --quiet" + +clean="" +check_stable="" +check_testing=1 +check_unstable=1 +commit="" + +for arg in "$@" "${UPDATE_NIX_PNAME}"; do + case "${arg}" in + help|-h|--help) echo "Read me!" >&2; exit 1; ;; + kicad|kicad-small|release|tag|stable|5*|6*|7*|8*) check_stable=1; check_testing=""; check_unstable="" ;; + *testing|kicad-testing-small) check_testing=1; check_unstable="" ;; + *unstable|*unstable-small|master|main) check_unstable=1; check_testing="" ;; + latest|now|today) check_unstable=1; check_testing=1 ;; + all|both|full) check_stable=1; check_testing=1; check_unstable=1 ;; + clean|fix|*fuck) check_stable=1; check_testing=1; check_unstable=1; clean=1 ;; + commit) commit=1 ;; + *) ;; + esac +done + +here="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" +commit_date() { + gitlab_json="$(curl -s https://gitlab.com/api/v4/projects/kicad%2Fcode%2Fkicad/repository/commits/"$1")" + commit_created="$(jq .created_at --raw-output <<< "${gitlab_json}")" + date --date="${commit_created}" --iso-8601 --utc +} + +file="${here}/versions.nix" +# just in case this runs in parallel +tmp="${here}/,versions.nix.${RANDOM}" + +libs=( symbols templates footprints packages3d ) + +get_rev() { + git ls-remote "$@" +} + +gitlab="https://gitlab.com/kicad" +# append commit hash or tag +src_pre="https://gitlab.com/api/v4/projects/kicad%2Fcode%2Fkicad/repository/archive.tar.gz?sha=" +lib_pre="https://gitlab.com/api/v4/projects/kicad%2Flibraries%2Fkicad-" +lib_mid="/repository/archive.tar.gz?sha=" + +# number of items updated +count=0 + +printf "Latest tag is %s\n" "${latest_tag}" >&2 + +if [[ ! -f ${file} ]]; then + echo "No existing file, generating from scratch" >&2 + check_stable=1; check_testing=1; check_unstable=1; clean=1 +fi + +printf "Writing %s\n" "${tmp}" >&2 + +# not a dangling brace, grouping the output to redirect to file +{ + +printf "# This file was generated by update.sh\n\n" +printf "{\n" + +for version in "${all_versions[@]}"; do + + src_version=${version}; + lib_version=${version}; + # testing is the stable branch on the main repo + # but the libraries don't have such a branch + # only the latest release tag and a master branch + if [[ ${version} == "testing" ]]; then + src_version=${testing_branch}; + lib_version=${latest_tag}; + fi + + if [[ ${version} == "master" ]]; then + pname="kicad-unstable" + elif [[ ${version} == "testing" ]]; then + pname="kicad-testing" + else + pname="kicad" + fi + + # skip a version if we don't want to check it + if [[ (-n ${check_stable} && ${version} != "master" && ${version} != "testing") \ + || (-n ${check_testing} && ${version} == "testing") \ + || (-n ${check_unstable} && ${version} == "master" ) ]]; then + + now=$(commit_date "${src_version}") + + if [[ ${version} == "master" ]]; then + pname="kicad-unstable" + new_version="${now}" + elif [[ ${version} == "testing" ]]; then + pname="kicad-testing" + new_version="${testing_branch}-${now}" + else + pname="kicad" + new_version="${version}" + fi + + printf "\nChecking %s\n" "${pname}" >&2 + + printf "%2s\"%s\" = {\n" "" "${pname}" + printf "%4skicadVersion = {\n" "" + printf "%6sversion =\t\t\t\"%s\";\n" "" "${new_version}" + printf "%6ssrc = {\n" "" + + echo "Checking src" >&2 + scratch="$(get_rev "${gitlab}"/code/kicad.git "${src_version}")" + src_rev="$(cut -f1 <<< "${scratch}")" + has_rev="$(grep -sm 1 "\"${pname}\"" -A 4 "${file}" | grep -sm 1 "${src_rev}" || true)" + has_hash="$(grep -sm 1 "\"${pname}\"" -A 5 "${file}" | grep -sm 1 "sha256" || true)" + old_version="$(grep -sm 1 "\"${pname}\"" -A 3 "${file}" | grep -sm 1 "version" | awk -F "\"" '{print $2}' || true)" + + if [[ -n ${has_rev} && -n ${has_hash} && -z ${clean} ]]; then + echo "Reusing old ${pname}.src.sha256, already latest .rev at ${old_version}" >&2 + scratch=$(grep -sm 1 "\"${pname}\"" -A 5 "${file}") + grep -sm 1 "rev" -A 1 <<< "${scratch}" + else + prefetched="$(${prefetch} "${src_pre}${src_rev}")" + printf "%8srev =\t\t\t\"%s\";\n" "" "${src_rev}" + printf "%8ssha256 =\t\t\"%s\";\n" "" "${prefetched}" + count=$((count+1)) + fi + printf "%6s};\n" "" + printf "%4s};\n" "" + + printf "%4slibVersion = {\n" "" + printf "%6sversion =\t\t\t\"%s\";\n" "" "${new_version}" + printf "%6slibSources = {\n" "" + + for lib in "${libs[@]}"; do + echo "Checking ${lib}" >&2 + url="${gitlab}/libraries/kicad-${lib}.git" + scratch="$(get_rev "${url}" "${lib_version}")" + scratch="$(cut -f1 <<< "${scratch}")" + lib_rev="$(tail -n1 <<< "${scratch}")" + has_rev="$(grep -sm 1 "\"${pname}\"" -A 19 "${file}" | grep -sm 1 "${lib_rev}" || true)" + has_hash="$(grep -sm 1 "\"${pname}\"" -A 20 "${file}" | grep -sm 1 "${lib}.sha256" || true)" + if [[ -n ${has_rev} && -n ${has_hash} && -z ${clean} ]]; then + echo "Reusing old kicad-${lib}-${new_version}.src.sha256, already latest .rev" >&2 + scratch="$(grep -sm 1 "\"${pname}\"" -A 20 "${file}")" + grep -sm 1 "${lib}" -A 1 <<< "${scratch}" + else + prefetched="$(${prefetch} "${lib_pre}${lib}${lib_mid}${lib_rev}")" + printf "%8s%s.rev =\t" "" "${lib}" + case "${lib}" in + symbols|templates) printf "\t" ;; *) ;; + esac + printf "\"%s\";\n" "${lib_rev}" + printf "%8s%s.sha256 =\t\"%s\";\n" "" "${lib}" "${prefetched}" + count=$((count+1)) + fi + done + printf "%6s};\n" "" + printf "%4s};\n" "" + printf "%2s};\n" "" + else + printf "\nReusing old %s\n" "${pname}" >&2 + grep -sm 1 "\"${pname}\"" -A 21 "${file}" + fi +done +printf "}\n" +} > "${tmp}" + +if grep '""' "${tmp}"; then + echo "empty value detected, out of space?" >&2 + exit "1" +fi + +mv "${tmp}" "${file}" + +printf "\nFinished\nMoved output to %s\n\n" "${file}" >&2 + +if [[ ${count} -gt 0 ]]; then + if [[ ${count} -gt 1 ]]; then s="s"; else s=""; fi + echo "${count} revision${s} changed" >&2 + if [[ -n ${commit} ]]; then + git commit -am "$(printf "kicad: automatic update of %s item%s\n" "${count}" "${s}")" + fi + echo "Please confirm the new versions.nix works before making a PR." >&2 +else + echo "No changes, those checked are up to date" >&2 +fi + +# using UPDATE_NIX_ATTR_PATH to detect if this is being called from update.nix +# and output JSON to describe the changes +if [[ -n ${UPDATE_NIX_ATTR_PATH} ]]; then + + if [[ ${count} -eq 0 ]]; then echo "[{}]"; exit 0; fi + + jq -n \ + --arg attrpath "${UPDATE_NIX_PNAME}" \ + --arg oldversion "${old_version}" \ + --arg newversion "${new_version}" \ + --arg file "${file}" \ +'[{ + "attrPath": $attrpath, + "oldVersion": $oldversion, + "newVersion": $newversion, + "files": [ $file ] +}]' +fi diff --git a/nixpkgs/pkgs/applications/science/electronics/kicad/versions.nix b/nixpkgs/pkgs/applications/science/electronics/kicad/versions.nix new file mode 100644 index 000000000000..11837638e1ab --- /dev/null +++ b/nixpkgs/pkgs/applications/science/electronics/kicad/versions.nix @@ -0,0 +1,70 @@ +# This file was generated by update.sh + +{ + "kicad" = { + kicadVersion = { + version = "7.0.10"; + src = { + rev = "7daac78752749fc919e932be6156914aa83c926f"; + sha256 = "0z459yi0s02mwdgbr3xxw43gn9yjhvfkjnsxmns5mksgzsr5nmhh"; + }; + }; + libVersion = { + version = "7.0.10"; + libSources = { + symbols.rev = "eedf6c9ddac2816023e817d4dc91032f9d7390b9"; + symbols.sha256 = "0nlgmxf9z1vf4g350dfkxql1dawgmw275wqxkgszsfxmhdfpmi9v"; + templates.rev = "9ce98cc45f3778e05c404edebf0f98de5c247ffe"; + templates.sha256 = "0mykfwwik7472i4r0isc5szj3dnmvd0538p0vlmzh4rcgj3pj3vm"; + footprints.rev = "7061fc9847ecc1b838e60dc6826db534028494f6"; + footprints.sha256 = "1az6fzh1lma71mj12bc4bblnmzjayrxhkb8w9rjvlhvvgv33cdmy"; + packages3d.rev = "d7345b34daaa23acf0d4506ed937fb424b5b18cd"; + packages3d.sha256 = "0xzyi4mgyifwc6dppdzh6jq294mkj0a71cwkqw2ymz1kfbksw626"; + }; + }; + }; + "kicad-testing" = { + kicadVersion = { + version = "7.0-2024-01-27"; + src = { + rev = "13fcb571f7e5bf4bf142d151651fc577aca32053"; + sha256 = "0wvk3wx5lm2jvyip6b96ja464hdzp9klb7b7ng5i3mdldabh0jba"; + }; + }; + libVersion = { + version = "7.0-2024-01-27"; + libSources = { + symbols.rev = "eedf6c9ddac2816023e817d4dc91032f9d7390b9"; + symbols.sha256 = "0nlgmxf9z1vf4g350dfkxql1dawgmw275wqxkgszsfxmhdfpmi9v"; + templates.rev = "9ce98cc45f3778e05c404edebf0f98de5c247ffe"; + templates.sha256 = "0mykfwwik7472i4r0isc5szj3dnmvd0538p0vlmzh4rcgj3pj3vm"; + footprints.rev = "7061fc9847ecc1b838e60dc6826db534028494f6"; + footprints.sha256 = "1az6fzh1lma71mj12bc4bblnmzjayrxhkb8w9rjvlhvvgv33cdmy"; + packages3d.rev = "d7345b34daaa23acf0d4506ed937fb424b5b18cd"; + packages3d.sha256 = "0xzyi4mgyifwc6dppdzh6jq294mkj0a71cwkqw2ymz1kfbksw626"; + }; + }; + }; + "kicad-unstable" = { + kicadVersion = { + version = "2023-08-15"; + src = { + rev = "e0d4cf2d5b023a7e5b70d854452376aa3510acd8"; + sha256 = "0666j4q3vz24smcjw9m4ib3ca2dqiqgx2amhv7ys4rzqb6v2pvn2"; + }; + }; + libVersion = { + version = "2023-08-15"; + libSources = { + symbols.rev = "06d20a4b9f7e5375329194d141b096dcdcb7518a"; + symbols.sha256 = "1wr754m4ykidds3i14gqhvyrj3mbkchp2hkfnr0rjsdaqf4zmqdf"; + templates.rev = "867eef383a0f61015cb69677d5c632d78a2ea01a"; + templates.sha256 = "1qi20mrsfn4fxmr1fyphmil2i9p2nzmwk5rlfchc5aq2194nj3lq"; + footprints.rev = "5d2ac73ae72bfe8b8ee9eeb081a7851b2ca84c24"; + footprints.sha256 = "1qg016ysf0ddm3bd5bkjawlrc0z4r3zhmdjkqkwaaaydnpwp23qz"; + packages3d.rev = "f1dae9f95e59216f3b974f585e5b420db853da9e"; + packages3d.sha256 = "0ciri6lhnh0w9i00z167snj5acnjndi1rgmyls08p45zj4rma8y2"; + }; + }; + }; +} diff --git a/nixpkgs/pkgs/applications/science/electronics/kicad/writable.patch b/nixpkgs/pkgs/applications/science/electronics/kicad/writable.patch new file mode 100644 index 000000000000..a2969f26f43b --- /dev/null +++ b/nixpkgs/pkgs/applications/science/electronics/kicad/writable.patch @@ -0,0 +1,49 @@ +commit 6a72fd032405515e468797be91b5a6ebcbbb5fd8 +Author: Evils <evils.devils@protonmail.com> +Date: Wed Nov 23 19:49:13 2022 +0100 + + ensure new projects are writable + +diff --git a/kicad/kicad_manager_frame.cpp b/kicad/kicad_manager_frame.cpp +index 7ee8090858..391514519c 100644 +--- a/kicad/kicad_manager_frame.cpp ++++ b/kicad/kicad_manager_frame.cpp +@@ -638,6 +638,12 @@ void KICAD_MANAGER_FRAME::CreateNewProject( const wxFileName& aProjectFileName, + + // wxFFile dtor will close the file + } ++ ++ if( destFileName.IsOk() && !destFileName.IsFileWritable() ) ++ { ++ destFileName.SetPermissions(0644); ++ } ++ + } + } + +diff --git a/kicad/project_template.cpp b/kicad/project_template.cpp +index bf951fcddb..2bef94326b 100644 +--- a/kicad/project_template.cpp ++++ b/kicad/project_template.cpp +@@ -282,6 +282,21 @@ bool PROJECT_TEMPLATE::CreateProject( wxFileName& aNewProjectPath, wxString* aEr + + result = false; + } ++ else if( !destFile.IsFileWritable() && !destFile.SetPermissions(0644) ) ++ { ++ if( aErrorMsg ) ++ { ++ if( !aErrorMsg->empty() ) ++ *aErrorMsg += "\n"; ++ ++ wxString msg; ++ ++ msg.Printf( _( "Cannot make file writable: '%s'." ), destFile.GetFullPath() ); ++ *aErrorMsg += msg; ++ } ++ ++ result = false; ++ } + } + + return result; diff --git a/nixpkgs/pkgs/applications/science/electronics/kingstvis/default.nix b/nixpkgs/pkgs/applications/science/electronics/kingstvis/default.nix new file mode 100644 index 000000000000..3699aebbbff0 --- /dev/null +++ b/nixpkgs/pkgs/applications/science/electronics/kingstvis/default.nix @@ -0,0 +1,59 @@ +{ buildFHSEnv +, dbus +, fetchzip +, fontconfig +, freetype +, glib +, lib +, libGL +, stdenv +, xkeyboard_config +, xorg +, zlib +}: + +let + name = "kingstvis"; + version = "3.6.1"; + src = fetchzip { + url = "http://res.kingst.site/kfs/KingstVIS_v${version}.tar.gz"; + hash = "sha256-eZJ3RZWdmNx/El3Hh5kUf44pIwdvwOEkRysYBgUkS18="; + }; +in + +buildFHSEnv { + inherit name; + + targetPkgs = pkgs: (with pkgs; [ + dbus + fontconfig + freetype + glib + libGL + xkeyboard_config + xorg.libICE + xorg.libSM + xorg.libX11 + xorg.libXext + xorg.libXi + xorg.libXrender + xorg.libxcb + zlib + ]); + + extraInstallCommands = '' + install -Dvm644 ${src}/Driver/99-Kingst.rules \ + $out/lib/udev/rules.d/99-Kingst.rules + ''; + + runScript = "${src}/KingstVIS"; + + meta = { + description = "Kingst Virtual Instruments Studio, software for logic analyzers"; + homepage = "http://www.qdkingst.com/"; + sourceProvenance = with lib.sourceTypes; [ binaryNativeCode ]; + license = lib.licenses.unfree; + maintainers = [ lib.maintainers.luisdaranda ]; + platforms = [ "x86_64-linux" ]; + }; +} diff --git a/nixpkgs/pkgs/applications/science/electronics/lepton-eda/default.nix b/nixpkgs/pkgs/applications/science/electronics/lepton-eda/default.nix new file mode 100644 index 000000000000..00b0961895d3 --- /dev/null +++ b/nixpkgs/pkgs/applications/science/electronics/lepton-eda/default.nix @@ -0,0 +1,62 @@ +{ stdenv +, lib +, pkg-config +, makeWrapper +, texinfo +, fetchurl +, autoreconfHook +, guile +, flex +, gtk3 +, glib +, gtksheet +, gettext +, gawk +, shared-mime-info +, groff +, libstroke +}: + +stdenv.mkDerivation rec { + pname = "lepton-eda"; + version = "1.9.18-20220529"; + + src = fetchurl { + url = "https://github.com/lepton-eda/lepton-eda/releases/download/${version}/lepton-eda-${builtins.head (lib.splitString "-" version)}.tar.gz"; + hash = "sha256-X9yNuosNR1Jf3gYWQZeOnKdxzJLld29Sn9XYsPGWYYI="; + }; + + nativeBuildInputs = [ pkg-config makeWrapper texinfo autoreconfHook ]; + + propagatedBuildInputs = [ guile flex gtk3 glib gtksheet gettext gawk shared-mime-info groff libstroke ]; + + configureFlags = [ + "--disable-update-xdg-database" + "--with-gtk3" + ]; + + CFLAGS = [ + "-DSCM_DEBUG_TYPING_STRICTNESS=2" + ]; + + postInstall = '' + libs="${lib.makeLibraryPath propagatedBuildInputs}" + for program in $out/bin/*; do + wrapProgram "$program" \ + --prefix LD_LIBRARY_PATH : "$libs" \ + --prefix LTDL_LIBRARY_PATH : "$out/lib" + done + ''; + + meta = with lib; { + homepage = "https://github.com/lepton-eda"; + description = "Lepton Electronic Design Automation"; + longDescription = '' + Lepton EDA is a suite of free software tools for designing electronics. + It provides schematic capture, netlisting into over 30 netlist formats, and many other features. + ''; + license = licenses.gpl2Plus; + platforms = platforms.linux; + maintainers = with maintainers; [ tesq0 ]; + }; +} diff --git a/nixpkgs/pkgs/applications/science/electronics/librepcb/default.nix b/nixpkgs/pkgs/applications/science/electronics/librepcb/default.nix new file mode 100644 index 000000000000..dfd679d4d531 --- /dev/null +++ b/nixpkgs/pkgs/applications/science/electronics/librepcb/default.nix @@ -0,0 +1,28 @@ +{ stdenv, lib, fetchFromGitHub +, qtbase, qttools, qtquickcontrols2, opencascade-occt, libGLU, libSM, freeimage, cmake, wrapQtAppsHook +}: + +stdenv.mkDerivation rec { + pname = "librepcb"; + version = "1.0.0"; + + src = fetchFromGitHub { + owner = pname; + repo = pname; + rev = version; + sha256 = "sha256-2o2Gue/RnDWxe8jk/Ehx9CM+B3ac5rEQn0H7yodUEZ8="; + fetchSubmodules = true; + }; + + nativeBuildInputs = [ cmake qttools wrapQtAppsHook qtquickcontrols2 opencascade-occt libGLU ]; + buildInputs = [ qtbase ]; + propagatedBuildInputs = [ libSM freeimage ]; + + meta = with lib; { + description = "A free EDA software to develop printed circuit boards"; + homepage = "https://librepcb.org/"; + maintainers = with maintainers; [ luz thoughtpolice ]; + license = licenses.gpl3Plus; + platforms = platforms.linux; + }; +} diff --git a/nixpkgs/pkgs/applications/science/electronics/linux-gpib/common.nix b/nixpkgs/pkgs/applications/science/electronics/linux-gpib/common.nix new file mode 100644 index 000000000000..e87751a18860 --- /dev/null +++ b/nixpkgs/pkgs/applications/science/electronics/linux-gpib/common.nix @@ -0,0 +1,24 @@ +{ pname, fetchurl, lib }: rec { + version = "4.3.6"; + inherit pname; + + src = fetchurl { + url = "mirror://sourceforge/project/linux-gpib/linux-gpib%20for%203.x.x%20and%202.6.x%20kernels/${version}/linux-gpib-${version}.tar.gz"; + hash = "sha256-Gze4xrvkhEgn+J5Jhrycezjp2uhlD1v6aX0WGv4J2Jg="; + }; + + unpackPhase = '' + tar xf $src + tar xf linux-gpib-${version}/${pname}-${version}.tar.gz + ''; + + sourceRoot = "${pname}-${version}"; + + meta = with lib; { + description = "Support package for GPIB (IEEE 488) hardware"; + homepage = "https://linux-gpib.sourceforge.io/"; + license = licenses.gpl2Only; + maintainers = with maintainers; [ fsagbuya ]; + platforms = platforms.linux; + }; +} diff --git a/nixpkgs/pkgs/applications/science/electronics/linux-gpib/kernel.nix b/nixpkgs/pkgs/applications/science/electronics/linux-gpib/kernel.nix new file mode 100644 index 000000000000..d64e2fc81fbd --- /dev/null +++ b/nixpkgs/pkgs/applications/science/electronics/linux-gpib/kernel.nix @@ -0,0 +1,23 @@ +{ lib +, stdenv +, fetchurl +, kernel +, pahole +}: + +stdenv.mkDerivation (import ./common.nix { inherit fetchurl lib; pname = "linux-gpib-kernel"; } // { + + postPatch = '' + sed -i 's@/sbin/depmod -A@@g' Makefile + ''; + + buildInputs = [ pahole ] ++ kernel.moduleBuildDependencies; + + makeFlags = [ + "LINUX_SRCDIR=${kernel.dev}/lib/modules/${kernel.modDirVersion}/build" + ]; + + installFlags = [ + "INSTALL_MOD_PATH=$(out)" + ]; +}) diff --git a/nixpkgs/pkgs/applications/science/electronics/linux-gpib/user.nix b/nixpkgs/pkgs/applications/science/electronics/linux-gpib/user.nix new file mode 100644 index 000000000000..f9c9a2e1e6cb --- /dev/null +++ b/nixpkgs/pkgs/applications/science/electronics/linux-gpib/user.nix @@ -0,0 +1,25 @@ +{ lib +, stdenv +, fetchurl +, autoconf +, libtool +, bison +, flex +, automake +}: + +stdenv.mkDerivation (import ./common.nix { inherit fetchurl lib; pname = "linux-gpib-user"; } // { + + nativeBuildInputs = [ + autoconf + libtool + bison + flex + automake + ]; + + configureFlags = [ + "--sysconfdir=$(out)/etc" + "--prefix=$(out)" + ]; +}) diff --git a/nixpkgs/pkgs/applications/science/electronics/magic-vlsi/default.nix b/nixpkgs/pkgs/applications/science/electronics/magic-vlsi/default.nix new file mode 100644 index 000000000000..15130deefc58 --- /dev/null +++ b/nixpkgs/pkgs/applications/science/electronics/magic-vlsi/default.nix @@ -0,0 +1,55 @@ +{ lib, stdenv +, fetchurl +, python3 +, m4 +, cairo +, libX11 +, mesa_glu +, ncurses +, tcl +, tcsh +, tk +}: + +stdenv.mkDerivation rec { + pname = "magic-vlsi"; + version = "8.3.463"; + + src = fetchurl { + url = "http://opencircuitdesign.com/magic/archive/magic-${version}.tgz"; + sha256 = "sha256-ba5kTz5ncsEPTh0a0/tbp37qFogUQ+W4p2rPNFLNIAY="; + }; + + nativeBuildInputs = [ python3 ]; + buildInputs = [ + cairo + libX11 + m4 + mesa_glu + ncurses + tcl + tcsh + tk + ]; + + enableParallelBuilding = true; + + configureFlags = [ + "--with-tcl=${tcl}" + "--with-tk=${tk}" + "--disable-werror" + ]; + + postPatch = '' + patchShebangs scripts/* + ''; + + env.NIX_CFLAGS_COMPILE = "-Wno-implicit-function-declaration"; + + meta = with lib; { + description = "VLSI layout tool written in Tcl"; + homepage = "http://opencircuitdesign.com/magic/"; + license = licenses.mit; + maintainers = with maintainers; [ thoughtpolice AndersonTorres ]; + }; +} diff --git a/nixpkgs/pkgs/applications/science/electronics/nanovna-saver/default.nix b/nixpkgs/pkgs/applications/science/electronics/nanovna-saver/default.nix new file mode 100644 index 000000000000..61788938e40a --- /dev/null +++ b/nixpkgs/pkgs/applications/science/electronics/nanovna-saver/default.nix @@ -0,0 +1,58 @@ +{ + lib, + python3, + fetchFromGitHub, + fetchpatch, + qt6, +}: +python3.pkgs.buildPythonApplication rec { + pname = "nanovna-saver"; + version = "0.6.3"; + + src = fetchFromGitHub { + owner = "NanoVNA-Saver"; + repo = pname; + rev = "refs/tags/v${version}"; + sha256 = "sha256-lL6n3hcsIbLmrRKPi/ckWW2XUAtmBqvMSplkWOF4VKQ="; + }; + + nativeBuildInputs = [ + qt6.wrapQtAppsHook + qt6.qtbase + ]; + + propagatedBuildInputs = with python3.pkgs; [ + cython + scipy + pyqt6 + pyserial + numpy + setuptools + setuptools-scm + ]; + + doCheck = false; + + dontWrapGApps = true; + dontWrapQtApps = true; + + preFixup = '' + makeWrapperArgs+=( + "''${gappsWrapperArgs[@]}" + "''${qtWrapperArgs[@]}" + ) + ''; + + meta = with lib; { + homepage = "https://github.com/NanoVNA-Saver/nanovna-saver"; + description = + "A tool for reading, displaying and saving data from the NanoVNA"; + longDescription = '' + A multiplatform tool to save Touchstone files from the NanoVNA, sweep + frequency spans in segments to gain more than 101 data points, and + generally display and analyze the resulting data. + ''; + license = licenses.gpl3Only; + maintainers = with maintainers; [ zaninime tmarkus ]; + }; +} diff --git a/nixpkgs/pkgs/applications/science/electronics/nvc/default.nix b/nixpkgs/pkgs/applications/science/electronics/nvc/default.nix new file mode 100644 index 000000000000..378daf9c498c --- /dev/null +++ b/nixpkgs/pkgs/applications/science/electronics/nvc/default.nix @@ -0,0 +1,65 @@ +{ lib +, stdenv +, fetchFromGitHub +, autoreconfHook +, check +, flex +, pkg-config +, which +, elfutils +, libffi +, llvm +, zlib +, zstd +}: + +stdenv.mkDerivation rec { + pname = "nvc"; + version = "1.11.3"; + + src = fetchFromGitHub { + owner = "nickg"; + repo = "nvc"; + rev = "r${version}"; + hash = "sha256-Z4YxXPf8uKlASSK9v6fbtHtkUibc9EeA4i+3kD/vBmY="; + }; + + nativeBuildInputs = [ + autoreconfHook + check + flex + pkg-config + which + ]; + + buildInputs = [ + libffi + llvm + zlib + zstd + ] ++ lib.optionals stdenv.isLinux [ + elfutils + ]; + + preConfigure = '' + mkdir build + cd build + ''; + + configureScript = "../configure"; + + configureFlags = [ + "--enable-vhpi" + "--disable-lto" + ]; + + doCheck = true; + + meta = with lib; { + description = "VHDL compiler and simulator"; + homepage = "https://www.nickg.me.uk/nvc/"; + license = licenses.gpl3Plus; + maintainers = with maintainers; [ wegank ]; + platforms = platforms.unix; + }; +} diff --git a/nixpkgs/pkgs/applications/science/electronics/openboardview/default.nix b/nixpkgs/pkgs/applications/science/electronics/openboardview/default.nix new file mode 100644 index 000000000000..9e498881d2e2 --- /dev/null +++ b/nixpkgs/pkgs/applications/science/electronics/openboardview/default.nix @@ -0,0 +1,75 @@ +{ stdenv +, lib +, fetchFromGitHub +, fetchpatch +, gitUpdater +, cmake +, pkg-config +, python3 +, SDL2 +, fontconfig +, gtk3 +, wrapGAppsHook +, darwin +}: + +let + inherit (darwin.apple_sdk.frameworks) Cocoa; +in +stdenv.mkDerivation rec { + pname = "openboardview"; + version = "9.95.0"; + + src = fetchFromGitHub { + owner = "OpenBoardView"; + repo = "OpenBoardView"; + rev = version; + sha256 = "sha256-sKDDOPpCagk7rBRlMlZhx+RYYbtoLzJsrnL8qKZMKW8="; + fetchSubmodules = true; + }; + + patches = [ + # Fix gcc-13 build failure + (fetchpatch { + name = "gcc-13.patch"; + url = "https://github.com/OpenBoardView/OpenBoardView/commit/b03d0f69ec1611f5eb93f81291b4ba8c58cd29eb.patch"; + hash = "sha256-Hp7KgzulPC2bPtRsd6HJrTLu0oVoQEoBHl0p2DcOLQw="; + }) + ]; + + nativeBuildInputs = [ cmake pkg-config python3 wrapGAppsHook ]; + buildInputs = [ SDL2 fontconfig gtk3 ] ++ lib.optionals stdenv.isDarwin [ + Cocoa + ]; + + postPatch = '' + substituteInPlace src/openboardview/CMakeLists.txt \ + --replace "SDL2::SDL2main" "" + substituteInPlace CMakeLists.txt --replace "fixup_bundle" "#fixup_bundle" + ''; + + cmakeFlags = [ + "-DGLAD_REPRODUCIBLE=On" + ]; + + dontWrapGApps = true; + postFixup = lib.optionalString stdenv.isDarwin '' + mkdir -p "$out/Applications" + mv "$out/openboardview.app" "$out/Applications/OpenBoardView.app" + '' + lib.optionalString (!stdenv.isDarwin) '' + wrapGApp "$out/bin/${pname}" \ + --prefix LD_LIBRARY_PATH : ${lib.makeLibraryPath [ gtk3 ]} + ''; + + passthru.updateScript = gitUpdater { + ignoredVersions = ''.*\.90\..*''; + }; + + meta = with lib; { + description = "Linux SDL/ImGui edition software for viewing .brd files"; + homepage = "https://github.com/OpenBoardView/OpenBoardView"; + license = licenses.mit; + platforms = platforms.unix; + maintainers = with maintainers; [ k3a ]; + }; +} diff --git a/nixpkgs/pkgs/applications/science/electronics/openems/default.nix b/nixpkgs/pkgs/applications/science/electronics/openems/default.nix new file mode 100644 index 000000000000..864b120993d9 --- /dev/null +++ b/nixpkgs/pkgs/applications/science/electronics/openems/default.nix @@ -0,0 +1,69 @@ +{ stdenv +, lib +, fetchFromGitHub +, csxcad +, fparser +, tinyxml +, hdf5 +, vtk +, boost +, zlib +, cmake +, octave +, mpi +, withQcsxcad ? true +, withMPI ? false +, withHyp2mat ? true +, qcsxcad +, hyp2mat +}: + +stdenv.mkDerivation rec { + pname = "openems"; + version = "0.0.36"; + + src = fetchFromGitHub { + owner = "thliebig"; + repo = "openEMS"; + rev = "v${version}"; + sha256 = "sha256-wdH+Zw7G2ZigzBMX8p3GKdFVx/AhbTNL+P3w+YjI/dc="; + }; + + nativeBuildInputs = [ + cmake + ]; + + cmakeFlags = lib.optionals withMPI [ "-DWITH_MPI=ON" ]; + + buildInputs = [ + fparser + tinyxml + hdf5 + vtk + boost + zlib + csxcad + (octave.override { inherit hdf5; }) ] + ++ lib.optionals withQcsxcad [ qcsxcad ] + ++ lib.optionals withMPI [ mpi ] + ++ lib.optionals withHyp2mat [ hyp2mat ]; + + postFixup = '' + substituteInPlace $out/share/openEMS/matlab/setup.m \ + --replace /usr/lib ${hdf5}/lib \ + --replace /usr/include ${hdf5}/include + + ${octave}/bin/mkoctfile -L${hdf5}/lib -I${hdf5}/include \ + -lhdf5 $out/share/openEMS/matlab/h5readatt_octave.cc \ + -o $out/share/openEMS/matlab/h5readatt_octave.oct + ''; + + meta = with lib; { + description = "Open Source Electromagnetic Field Solver"; + homepage = "http://openems.de/index.php/Main_Page.html"; + license = licenses.gpl3; + maintainers = with maintainers; [ matthuszagh ]; + platforms = platforms.linux; + badPlatforms = platforms.aarch64; + }; +} diff --git a/nixpkgs/pkgs/applications/science/electronics/openhantek6022/default.nix b/nixpkgs/pkgs/applications/science/electronics/openhantek6022/default.nix new file mode 100644 index 000000000000..b6e5d89a3e97 --- /dev/null +++ b/nixpkgs/pkgs/applications/science/electronics/openhantek6022/default.nix @@ -0,0 +1,31 @@ +{ mkDerivation, lib, fetchFromGitHub, makeWrapper, cmake, qtbase, qttools, fftw, libusb1, libglvnd }: + +mkDerivation rec { + pname = "openhantek6022"; + version = "3.3.3"; + + src = fetchFromGitHub { + owner = "OpenHantek"; + repo = "OpenHantek6022"; + rev = version; + sha256 = "sha256-y2pNLAa0P/r0YEdKjQ3iP66cqtTWERG8lTOZDR64WTk="; + }; + + nativeBuildInputs = [ cmake makeWrapper ]; + buildInputs = [ fftw libusb1 libglvnd qtbase qttools ]; + + postPatch = '' + # Fix up install paths & checks + sed -i 's#if(EXISTS ".*")#if(1)#g' CMakeLists.txt + sed -i 's#/lib/udev#lib/udev#g' CMakeLists.txt + sed -i 's#/usr/share#share#g' CMakeLists.txt + ''; + + meta = with lib; { + description = "Free software for Hantek and compatible (Voltcraft/Darkwire/Protek/Acetech) USB digital signal oscilloscopes"; + homepage = "https://github.com/OpenHantek/OpenHantek6022"; + license = licenses.gpl3; + maintainers = with maintainers; [ baracoder ]; + platforms = qtbase.meta.platforms; + }; +} diff --git a/nixpkgs/pkgs/applications/science/electronics/openroad/0001-Disable-failing-regression-tests.patch b/nixpkgs/pkgs/applications/science/electronics/openroad/0001-Disable-failing-regression-tests.patch new file mode 100644 index 000000000000..e370bc860b55 --- /dev/null +++ b/nixpkgs/pkgs/applications/science/electronics/openroad/0001-Disable-failing-regression-tests.patch @@ -0,0 +1,83 @@ +From dc32aabd50d53aece41d968649b972ee667875bb Mon Sep 17 00:00:00 2001 +From: Tobias Mayer <tobim@fastmail.fm> +Date: Sun, 27 Aug 2023 15:08:50 +0200 +Subject: [PATCH] Disable failing regression tests + +--- + src/drt/test/regression_tests.tcl | 6 +++--- + src/odb/test/regression_tests.tcl | 4 ++-- + src/par/test/regression_tests.tcl | 2 +- + src/pdn/test/regression_tests.tcl | 2 +- + src/rcx/test/regression_tests.tcl | 6 +++--- + 5 files changed, 10 insertions(+), 10 deletions(-) + +diff --git a/src/drt/test/regression_tests.tcl b/src/drt/test/regression_tests.tcl +index 11705562d..15546244a 100644 +--- a/src/drt/test/regression_tests.tcl ++++ b/src/drt/test/regression_tests.tcl +@@ -9,6 +9,6 @@ record_tests { + top_level_term + top_level_term2 + } +-record_pass_fail_tests { +- gc_test +-} ++#record_pass_fail_tests { ++# gc_test ++#} +diff --git a/src/odb/test/regression_tests.tcl b/src/odb/test/regression_tests.tcl +index b8e4f917a..7c6a0223a 100644 +--- a/src/odb/test/regression_tests.tcl ++++ b/src/odb/test/regression_tests.tcl +@@ -34,9 +34,9 @@ record_tests { + } + + record_pass_fail_tests { +- cpp_tests ++ #cpp_tests + dump_netlists + dump_netlists_withfill +- parser_unit_test ++ #parser_unit_test + } + +diff --git a/src/par/test/regression_tests.tcl b/src/par/test/regression_tests.tcl +index 9ff31fb12..63d5d0dae 100644 +--- a/src/par/test/regression_tests.tcl ++++ b/src/par/test/regression_tests.tcl +@@ -1,4 +1,4 @@ + record_tests { + read_part +- partition_gcd ++ #partition_gcd + } +diff --git a/src/pdn/test/regression_tests.tcl b/src/pdn/test/regression_tests.tcl +index 86c334f24..b695c490c 100644 +--- a/src/pdn/test/regression_tests.tcl ++++ b/src/pdn/test/regression_tests.tcl +@@ -10,7 +10,7 @@ record_tests { + max_width + min_spacing + widthtable +- design_width ++ #design_width + offgrid + + core_grid +diff --git a/src/rcx/test/regression_tests.tcl b/src/rcx/test/regression_tests.tcl +index 7070cc45f..72f348d96 100644 +--- a/src/rcx/test/regression_tests.tcl ++++ b/src/rcx/test/regression_tests.tcl +@@ -6,6 +6,6 @@ record_tests { + 45_gcd + names + } +-record_pass_fail_tests { +- rcx_unit_test +-} ++#record_pass_fail_tests { ++# rcx_unit_test ++#} +-- +2.41.0 + diff --git a/nixpkgs/pkgs/applications/science/electronics/openroad/0002-Ignore-warning-on-stderr.patch b/nixpkgs/pkgs/applications/science/electronics/openroad/0002-Ignore-warning-on-stderr.patch new file mode 100644 index 000000000000..f0b0666789a7 --- /dev/null +++ b/nixpkgs/pkgs/applications/science/electronics/openroad/0002-Ignore-warning-on-stderr.patch @@ -0,0 +1,41 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Nicolas Benes <nbenes.gh@xandea.de> +Date: Sun, 2 Apr 2023 04:57:17 +0200 +Subject: [PATCH] Ignore warning on stderr + +The following warning is written to stderr, which causes the overall +test to fail: + +``` +sh: warning: setlocale: LC_ALL: cannot change locale (en_US.UTF-8) +``` + +diff --git a/src/dst/test/cpp_tests.tcl b/src/dst/test/cpp_tests.tcl +index 9087c2c..63d0cb7 100644 +--- a/src/dst/test/cpp_tests.tcl ++++ b/src/dst/test/cpp_tests.tcl +@@ -4,7 +4,7 @@ set test_dir [pwd] + set openroad_dir [file dirname [file dirname [file dirname $test_dir]]] + set tests_path [file join $openroad_dir "build" "src" "dst" "test" "cpp"] + +-set tests_list [split [exec sh -c "find $tests_path -maxdepth 1 -name 'Test*'"] \n] ++set tests_list [split [exec -ignorestderr sh -c "find $tests_path -maxdepth 1 -name 'Test*'"] \n] + + foreach test $tests_list { + set test_name [file tail $test] +diff --git a/src/odb/test/cpp_tests.tcl b/src/odb/test/cpp_tests.tcl +index 091d576..6811760 100644 +--- a/src/odb/test/cpp_tests.tcl ++++ b/src/odb/test/cpp_tests.tcl +@@ -4,7 +4,7 @@ set test_dir [pwd] + set openroad_dir [file dirname [file dirname [file dirname $test_dir]]] + set tests_path [file join $openroad_dir "build" "src" "odb" "test" "cpp"] + +-set tests_list [split [exec sh -c "find $tests_path -maxdepth 1 -name 'Test*' ! -name '*.cmake'"] \n] ++set tests_list [split [exec -ignorestderr sh -c "find $tests_path -maxdepth 1 -name 'Test*' ! -name '*.cmake'"] \n] + + foreach test $tests_list { + set test_name [file tail $test] +-- +2.38.4 + diff --git a/nixpkgs/pkgs/applications/science/electronics/openroad/default.nix b/nixpkgs/pkgs/applications/science/electronics/openroad/default.nix new file mode 100644 index 000000000000..16659892a6ee --- /dev/null +++ b/nixpkgs/pkgs/applications/science/electronics/openroad/default.nix @@ -0,0 +1,133 @@ +{ lib +, mkDerivation +, fetchFromGitHub +, fetchpatch +, bison +, cmake +, doxygen +, flex +, git +, python3 +, swig4 +, boost179 +, cbc # for clp +, cimg +, clp # for or-tools +, eigen +, glpk +, gtest +, lcov +, lemon-graph +, libjpeg +, or-tools +, pcre +, pkg-config +, qtbase +, re2 # for or-tools +, readline +, spdlog +, tcl +, tcllib +, xorg +, yosys +, zlib +}: + +mkDerivation rec { + pname = "openroad"; + version = "unstable-2023-08-26"; + + src = fetchFromGitHub { + owner = "The-OpenROAD-Project"; + repo = "OpenROAD"; + rev = "6dba515c2aacd3fca58ef8135424884146efd95b"; + fetchSubmodules = true; + hash = "sha256-LAj7X+Vq0+H3tIo5zgyUuIjQwTj+2DLL18/KMJ/kf4A="; + }; + + nativeBuildInputs = [ + bison + cmake + doxygen + flex + git + pkg-config + swig4 + ]; + + buildInputs = [ + boost179 + cbc + cimg + clp + eigen + glpk + lcov + lemon-graph + libjpeg + or-tools + pcre + python3 + qtbase + re2 + readline + spdlog + tcl + tcllib + yosys + xorg.libX11 + zlib + ]; + + patches = [ + # https://github.com/The-OpenROAD-Project/OpenROAD/pull/3911 + (fetchpatch { + name = "openroad-fix-fmt-10.patch"; + url = "https://github.com/The-OpenROAD-Project/OpenROAD/commit/9396f07f28e0260cd64acfc51909f6566b70e682.patch"; + hash = "sha256-jy8K8pdhSswVz6V6otk8JAI7nndaFVMuKQ/4A3Kzwns="; + }) + # Upstream is not aware of these failures + ./0001-Disable-failing-regression-tests.patch + # This is an issue we experience in the sandbox, and upstream + # probably wouldn't mind merging this change, but no PR was opened. + ./0002-Ignore-warning-on-stderr.patch + ]; + + postPatch = '' + patchShebangs --build etc/find_messages.py + ''; + + # Enable output images from the placer. + cmakeFlags = [ + # Tries to download gtest 1.13 as part of the build. We currently rely on + # the regression tests so we can get by without building unit tests. + "-DENABLE_TESTS=OFF" + "-DUSE_SYSTEM_BOOST=ON" + "-DUSE_CIMG_LIB=ON" + "-DOPENROAD_VERSION=${src.rev}" + ]; + + # Resynthesis needs access to the Yosys binaries. + qtWrapperArgs = [ "--prefix PATH : ${lib.makeBinPath [ yosys ]}" ]; + + # Upstream uses vendored package versions for some dependencies, so regression testing is prudent + # to see if there are any breaking changes in unstable that should be vendored as well. + doCheck = true; + checkPhase = '' + ../test/regression + ''; + + doInstallCheck = true; + installCheckPhase = '' + $out/bin/openroad -version + $out/bin/sta -version + ''; + + meta = with lib; { + description = "OpenROAD's unified application implementing an RTL-to-GDS flow"; + homepage = "https://theopenroadproject.org"; + license = licenses.bsd3; + maintainers = with maintainers; [ trepetti ]; + platforms = platforms.linux; + }; +} diff --git a/nixpkgs/pkgs/applications/science/electronics/pcb/default.nix b/nixpkgs/pkgs/applications/science/electronics/pcb/default.nix new file mode 100644 index 000000000000..f8623d9a7bf7 --- /dev/null +++ b/nixpkgs/pkgs/applications/science/electronics/pcb/default.nix @@ -0,0 +1,68 @@ +{ lib, stdenv +, fetchurl +, pkg-config +, gtk2 +, bison +, intltool +, flex +, netpbm +, imagemagick +, dbus +, freetype +, fontconfig +, libGLU +, libGL +, shared-mime-info +, tcl +, tk +, gnome2 +, gd +, xorg +}: + +stdenv.mkDerivation rec { + pname = "pcb"; + version = "4.3.0"; + + src = fetchurl { + url = "mirror://sourceforge/pcb/${pname}-${version}.tar.gz"; + sha256 = "sha256-roUvRq+Eq6f1HYE/uRb8f82+6kP3E08VBQcCThdD+14="; + }; + + nativeBuildInputs = [ + pkg-config + bison + intltool + flex + netpbm + imagemagick + ]; + + buildInputs = [ + gtk2 + dbus + xorg.libXrender + freetype + fontconfig + libGLU + libGL + tcl + shared-mime-info + tk + gnome2.gtkglext + gd + xorg.libXmu + ]; + + configureFlags = [ + "--disable-update-desktop-database" + ]; + + meta = with lib; { + description = "Printed Circuit Board editor"; + homepage = "http://pcb.geda-project.org/"; + maintainers = with maintainers; [ mog ]; + platforms = platforms.linux; + license = licenses.gpl2; + }; +} diff --git a/nixpkgs/pkgs/applications/science/electronics/picoscope/default.nix b/nixpkgs/pkgs/applications/science/electronics/picoscope/default.nix new file mode 100644 index 000000000000..c7242117b68c --- /dev/null +++ b/nixpkgs/pkgs/applications/science/electronics/picoscope/default.nix @@ -0,0 +1,139 @@ +{ stdenv, lib, fetchurl, dpkg, makeWrapper , mono, gtk-sharp-3_0 +, glib, libusb1 , zlib, gtk3-x11, callPackage, writeTextDir +, scopes ? [ + "picocv" + "ps2000" + "ps2000a" + "ps3000" + "ps3000a" + "ps4000" + "ps4000a" + "ps5000" + "ps5000a" + "ps6000" + "ps6000a" +] }: + +let + shared_meta = lib: + with lib; { + homepage = "https://www.picotech.com/downloads/linux"; + maintainers = with maintainers; [ expipiplus1 wirew0rm ] ++ teams.lumiguide.members; + platforms = [ "x86_64-linux" ]; + license = licenses.unfree; + }; + + libpicoipp = callPackage ({ stdenv, lib, fetchurl, autoPatchelfHook, dpkg }: + stdenv.mkDerivation rec { + pname = "libpicoipp"; + inherit (sources.libpicoipp) version; + src = fetchurl { inherit (sources.libpicoipp) url sha256; }; + nativeBuildInputs = [ dpkg autoPatchelfHook ]; + buildInputs = [ stdenv.cc.cc.lib ]; + sourceRoot = "."; + unpackCmd = "dpkg-deb -x $src ."; + installPhase = '' + runHook preInstall + mkdir -p $out/lib + cp -d opt/picoscope/lib/* $out/lib + install -Dt $out/usr/share/doc/libpicoipp usr/share/doc/libpicoipp/copyright + runHook postInstall + ''; + meta = with lib; + shared_meta lib // { + sourceProvenance = with sourceTypes; [ binaryNativeCode ]; + description = "library for picotech oscilloscope software"; + }; + }) { }; + + # If we don't have a platform available, put a dummy version here, so at + # least evaluation succeeds. + sources = + (lib.importJSON ./sources.json).${stdenv.system} or { picoscope.version = "unknown"; }; + + scopePkg = name: + { url, version, sha256 }: + stdenv.mkDerivation rec { + pname = "lib${name}"; + inherit version; + src = fetchurl { inherit url sha256; }; + # picoscope does a signature check, so we can't patchelf these + nativeBuildInputs = [ dpkg ]; + sourceRoot = "."; + unpackCmd = "dpkg-deb -x $src ."; + installPhase = '' + runHook preInstall + mkdir -p $out/lib + cp -d opt/picoscope/lib/* $out/lib + runHook postInstall + ''; + meta = with lib; + shared_meta lib // { + description = "library for picotech oscilloscope ${name} series"; + }; + }; + + scopePkgs = lib.mapAttrs scopePkg sources; + +in stdenv.mkDerivation rec { + pname = "picoscope"; + inherit (sources.picoscope) version; + + src = fetchurl { inherit (sources.picoscope) url sha256; }; + + nativeBuildInputs = [ dpkg makeWrapper ]; + buildInputs = [ gtk-sharp-3_0 mono glib libusb1 zlib ]; + + unpackCmd = "dpkg-deb -x $src ."; + sourceRoot = "."; + scopeLibs = lib.attrVals (map (x: "lib${x}") scopes) scopePkgs; + MONO_PATH = "${gtk-sharp-3_0}/lib/mono/gtk-sharp-3.0:" + (lib.makeLibraryPath + ([ + glib + gtk3-x11 + gtk-sharp-3_0 + libusb1 + zlib + libpicoipp + ] ++ scopeLibs)); + + installPhase = '' + runHook preInstall + mkdir -p $out/ + cp -dr usr/share $out/share + cp -dr opt/picoscope/* $out/ + makeWrapper "$(command -v mono)" $out/bin/picoscope \ + --add-flags $out/lib/PicoScope.GTK.exe \ + --prefix MONO_PATH : "$MONO_PATH" \ + --prefix LD_LIBRARY_PATH : "$MONO_PATH" \ + --set LANG C + runHook postInstall + ''; + + # usage: + # services.udev.packages = [ pkgs.picoscope.rules ]; + # users.groups.pico = {}; + # users.users.you.extraGroups = [ "pico" ]; + passthru.rules = writeTextDir "lib/udev/rules.d/95-pico.rules" '' + SUBSYSTEMS=="usb", ATTRS{idVendor}=="0ce9", MODE="664",GROUP="pico" + ''; + + meta = with lib; + shared_meta lib // { + description = + "Oscilloscope application that works with all PicoScope models"; + longDescription = '' + PicoScope for Linux is a powerful oscilloscope application that works + with all PicoScope models. The most important features from PicoScope + for Windows are included—scope, spectrum analyzer, advanced triggers, + automated measurements, interactive zoom, persistence modes and signal + generator control. More features are being added all the time. + + Waveform captures can be saved for off-line analysis, and shared with + PicoScope for Linux, PicoScope for macOS and PicoScope for Windows + users, or exported in text, CSV and MathWorks MATLAB 4 formats. + ''; + sourceProvenance = with sourceTypes; [ binaryBytecode ]; + }; +} + diff --git a/nixpkgs/pkgs/applications/science/electronics/picoscope/sources.json b/nixpkgs/pkgs/applications/science/electronics/picoscope/sources.json new file mode 100644 index 000000000000..6b1d81978b9d --- /dev/null +++ b/nixpkgs/pkgs/applications/science/electronics/picoscope/sources.json @@ -0,0 +1,69 @@ +{ + "x86_64-linux": { + "libpicocv": { + "sha256": "c0c5bec33c2c7fdd0f26b035ed942175f87012e33d6764c3abf1da31b5626037", + "url": "https://labs.picotech.com/rc/picoscope7/debian/pool/main/libp/libpicocv/libpicocv_1.1.34-beta2r172_amd64.deb", + "version": "1.1.34-beta2r172" + }, + "libpicoipp": { + "sha256": "4a84f0af7f4e8cba91fad620eac0cd23c36b2fdda4637904be564286b10ffe1d", + "url": "https://labs.picotech.com/rc/picoscope7/debian/pool/main/libp/libpicoipp/libpicoipp_1.4.0-4r161_amd64.deb", + "version": "1.4.0-4r161" + }, + "libps2000": { + "sha256": "473b065e79a7414c1e2b8c8468c8d2654333ac28f3a8c33b535626b33c60d2ca", + "url": "https://labs.picotech.com/rc/picoscope7/debian/pool/main/libp/libps2000/libps2000_3.0.127-3r5552_amd64.deb", + "version": "3.0.127-3r5552" + }, + "libps2000a": { + "sha256": "8eba0052f9c7ef327710f2fba5aa11bec0c20225b39d77bb7b69cf80055c039c", + "url": "https://labs.picotech.com/rc/picoscope7/debian/pool/main/libp/libps2000a/libps2000a_2.1.127-5r5552_amd64.deb", + "version": "2.1.127-5r5552" + }, + "libps3000": { + "sha256": "4e786036b8de0dd0f922aed947f30a53d31bed46b2df5132e8c9480c8a5d93e9", + "url": "https://labs.picotech.com/rc/picoscope7/debian/pool/main/libp/libps3000/libps3000_4.0.127-3r5552_amd64.deb", + "version": "4.0.127-3r5552" + }, + "libps3000a": { + "sha256": "d2bb1e5bb151b0953ed30ca5421bb93d05dab898c33cdc89927e943ea991867a", + "url": "https://labs.picotech.com/rc/picoscope7/debian/pool/main/libp/libps3000a/libps3000a_2.1.127-6r5552_amd64.deb", + "version": "2.1.127-6r5552" + }, + "libps4000": { + "sha256": "4c127e67949835b5ab5c5c8caa55f73c69df354d761aa53d6df99c8f8ac39009", + "url": "https://labs.picotech.com/rc/picoscope7/debian/pool/main/libp/libps4000/libps4000_2.1.127-2r5552_amd64.deb", + "version": "2.1.127-2r5552" + }, + "libps4000a": { + "sha256": "26df82bc946e5bb30d599c4c365247bdbaa01e830d4d00630b46a6abcc1eef04", + "url": "https://labs.picotech.com/rc/picoscope7/debian/pool/main/libp/libps4000a/libps4000a_2.1.127-2r5552_amd64.deb", + "version": "2.1.127-2r5552" + }, + "libps5000": { + "sha256": "106ef17862e98c3621f95c377f271c843664f481f84ef918d9eadd013561cd1b", + "url": "https://labs.picotech.com/rc/picoscope7/debian/pool/main/libp/libps5000/libps5000_2.1.127-3r5552_amd64.deb", + "version": "2.1.127-3r5552" + }, + "libps5000a": { + "sha256": "fe9def134ef9df6654485911f14ece7b2ee3d79113aeee7826dd6e36bb5de3b4", + "url": "https://labs.picotech.com/rc/picoscope7/debian/pool/main/libp/libps5000a/libps5000a_2.1.127-5r5552_amd64.deb", + "version": "2.1.127-5r5552" + }, + "libps6000": { + "sha256": "9b08c5b7fb2d34b0e2e98f2e0452a59105f612cd445a9e45d3cac14d931d18f2", + "url": "https://labs.picotech.com/rc/picoscope7/debian/pool/main/libp/libps6000/libps6000_2.1.127-6r5552_amd64.deb", + "version": "2.1.127-6r5552" + }, + "libps6000a": { + "sha256": "2a23ccad72b9be83b87d449b6bb8ded23fd29c85ec9f78a45b6d45b38ccf335b", + "url": "https://labs.picotech.com/rc/picoscope7/debian/pool/main/libp/libps6000a/libps6000a_1.0.127-0r5552_amd64.deb", + "version": "1.0.127-0r5552" + }, + "picoscope": { + "sha256": "d95f269171da7273b596dae95452789e889f12ef0f15c3baea26dd1b3a8117fc", + "url": "https://labs.picotech.com/rc/picoscope7/debian/pool/main/p/picoscope/picoscope_7.1.17-1r17318_amd64.deb", + "version": "7.1.17-1r17318" + } + } +} diff --git a/nixpkgs/pkgs/applications/science/electronics/picoscope/update.py b/nixpkgs/pkgs/applications/science/electronics/picoscope/update.py new file mode 100755 index 000000000000..ecbd2292030d --- /dev/null +++ b/nixpkgs/pkgs/applications/science/electronics/picoscope/update.py @@ -0,0 +1,44 @@ +#!/usr/bin/env nix-shell +#!nix-shell --pure -i python3 -p "python3.withPackages (ps: with ps; [ requests ])" +import json +import os +import requests +import sys + +def parse_packages(text): + res = [] + for package in resp.text.split("\n\n"): + if not package: continue + pkg = {} + for field in package.split("\n"): + if field.startswith(" "): # multiline string + pkg[k] += "\n" + field[1:] + else: + [k, v] = field.split(": ", 1) + pkg[k] = v + res.append(pkg) + return res + +def generate_sources(packages): + sources_spec = {} + for pkg in pkgs: + sources_spec[pkg['Package']] = { + "url": "https://labs.picotech.com/rc/picoscope7/debian/" + pkg["Filename"], + "sha256": pkg["SHA256"], + "version": pkg["Version"] + } + return sources_spec + +out = {} +for nix_system, release in {"x86_64-linux": "amd64"}.items(): + resp = requests.get("https://labs.picotech.com/rc/picoscope7/debian//dists/picoscope/main/binary-"+release+"/Packages") + if resp.status_code != 200: + print("error: could not fetch data for release {} (code {})".format(release, resp.code), file=sys.stderr) + sys.exit(1) + pkgs = parse_packages(resp.text) + out[nix_system] = generate_sources(pkgs) + +with open(os.path.dirname(__file__) + "/sources.json", "w") as f: + json.dump(out, f, indent=2, sort_keys=True) + f.write('\n') + diff --git a/nixpkgs/pkgs/applications/science/electronics/pulseview/default.nix b/nixpkgs/pkgs/applications/science/electronics/pulseview/default.nix new file mode 100644 index 000000000000..cab42731c336 --- /dev/null +++ b/nixpkgs/pkgs/applications/science/electronics/pulseview/default.nix @@ -0,0 +1,33 @@ +{ lib, stdenv, fetchgit, pkg-config, cmake, glib, boost, libsigrok +, libsigrokdecode, libserialport, libzip, libftdi1, hidapi, glibmm +, pcre, python3, qtsvg, qttools, bluez +, wrapQtAppsHook, desktopToDarwinBundle +}: + +stdenv.mkDerivation rec { + pname = "pulseview"; + version = "0.4.2-unstable-2024-01-26"; + + src = fetchgit { + url = "git://sigrok.org/pulseview"; + rev = "9b8b7342725491d626609017292fa9259f7d5e0e"; + hash = "sha256-UEJunADzc1WRRfchO/n8qqxnyrSo4id1p7gLkD3CKaM="; + }; + + nativeBuildInputs = [ cmake pkg-config qttools wrapQtAppsHook ] + ++ lib.optional stdenv.isDarwin desktopToDarwinBundle; + + buildInputs = [ + glib boost libsigrok libsigrokdecode libserialport libzip libftdi1 hidapi glibmm + pcre python3 + qtsvg + ] ++ lib.optionals stdenv.isLinux [ bluez ]; + + meta = with lib; { + description = "Qt-based LA/scope/MSO GUI for sigrok (a signal analysis software suite)"; + homepage = "https://sigrok.org/"; + license = licenses.gpl3Plus; + maintainers = with maintainers; [ bjornfor vifino ]; + platforms = platforms.unix; + }; +} diff --git a/nixpkgs/pkgs/applications/science/electronics/qucs-s/default.nix b/nixpkgs/pkgs/applications/science/electronics/qucs-s/default.nix new file mode 100644 index 000000000000..4117638a1fda --- /dev/null +++ b/nixpkgs/pkgs/applications/science/electronics/qucs-s/default.nix @@ -0,0 +1,54 @@ +{ stdenv +, lib +, fetchFromGitHub +, flex +, bison +, qtbase +, qttools +, qtsvg +, qtwayland +, wrapQtAppsHook +, libX11 +, cmake +, gperf +, adms +, ngspice +, kernels ? [ ngspice ] +}: + +stdenv.mkDerivation rec { + pname = "qucs-s"; + version = "24.1.0"; + + src = fetchFromGitHub { + owner = "ra3xdh"; + repo = "qucs_s"; + rev = version; + sha256 = "sha256-ei9CPlJg+Kfjh7vu5VnT6DNLmmnA8wZ2A1jXnm//Fgo="; + }; + + nativeBuildInputs = [ flex bison wrapQtAppsHook cmake ]; + buildInputs = [ qtbase qttools qtsvg qtwayland libX11 gperf adms ] ++ kernels; + + # Make custom kernels avaible from qucs-s + qtWrapperArgs = [ "--prefix" "PATH" ":" (lib.makeBinPath kernels) ]; + + QTDIR = qtbase.dev; + + doInstallCheck = true; + installCheck = '' + $out/bin/qucs-s --version + ''; + + meta = with lib; { + description = "Spin-off of Qucs that allows custom simulation kernels"; + longDescription = '' + Spin-off of Qucs that allows custom simulation kernels. + Default version is installed with ngspice. + ''; + homepage = "https://ra3xdh.github.io/"; + license = licenses.gpl2Plus; + maintainers = with maintainers; [ mazurel kashw2 ]; + platforms = with platforms; linux; + }; +} diff --git a/nixpkgs/pkgs/applications/science/electronics/simulide/default.nix b/nixpkgs/pkgs/applications/science/electronics/simulide/default.nix new file mode 100644 index 000000000000..fbd76a0e0ffc --- /dev/null +++ b/nixpkgs/pkgs/applications/science/electronics/simulide/default.nix @@ -0,0 +1,129 @@ +{ lib +, fetchbzr +, mkDerivation +, qmake +, qtserialport +, qtmultimedia +, qttools +, qtscript +}: + +let + generic = + { version + , release + , branch + , rev + , sha256 + , extraPostPatch ? "" + , extraBuildInputs ? [ ] + , iconPath ? "resources/icons/simulide.png" + , installFiles ? '' + cp -r data examples $out/share/simulide + cp simulide $out/bin/simulide + '' + }: + mkDerivation { + pname = "simulide"; + version = "${version}-${release}"; + + src = fetchbzr { + url = "https://code.launchpad.net/~arcachofo/simulide/${branch}"; + inherit rev sha256; + }; + + postPatch = '' + sed -i resources/simulide.desktop \ + -e "s|^Exec=.*$|Exec=simulide|" \ + -e "s|^Icon=.*$|Icon=simulide|" + + # Note: older versions don't have REV_NO + sed -i SimulIDE.pro \ + -e "s|^VERSION = .*$|VERSION = ${version}|" \ + -e "s|^RELEASE = .*$|RELEASE = -${release}|" \ + -e "s|^REV_NO = .*$|REV_NO = ${rev}|" \ + -e "s|^BUILD_DATE = .*$|BUILD_DATE = ??-??-??|" + + ${extraPostPatch} + ''; + + preConfigure = '' + cd build_XX + ''; + + nativeBuildInputs = [ + qmake + ]; + + buildInputs = [ + qtserialport + qtmultimedia + qttools + ] ++ extraBuildInputs; + + installPhase = '' + runHook preInstall + + install -Dm644 ../resources/simulide.desktop $out/share/applications/simulide.desktop + install -Dm644 ../${iconPath} $out/share/icons/hicolor/256x256/apps/simulide.png + + mkdir -p $out/share/simulide $out/bin + pushd executables/SimulIDE_* + ${installFiles} + popd + + runHook postInstall + ''; + + meta = { + description = "A simple real time electronic circuit simulator"; + longDescription = '' + SimulIDE is a simple real time electronic circuit simulator, intended for hobbyist or students + to learn and experiment with analog and digital electronic circuits and microcontrollers. + It supports PIC, AVR, Arduino and other MCUs and MPUs. + ''; + homepage = "https://simulide.com/"; + license = lib.licenses.gpl3Only; + mainProgram = "simulide"; + maintainers = with lib.maintainers; [ carloscraveiro tomasajt ]; + platforms = [ "x86_64-linux" ]; + }; + }; +in +{ + simulide_0_4_15 = generic { + version = "0.4.15"; + release = "SR10"; + branch = "simulide_0.4.14"; # the branch name does not mach the version for some reason + rev = "291"; + sha256 = "sha256-BBoZr/S2pif0Jft5wrem8y00dXl08jq3kFiIUtOr3LM="; + extraPostPatch = '' + # GCC 13 needs the <cstdint> header explicitly included + sed -i src/gpsim/value.h -e '1i #include <cstdint>' + sed -i src/gpsim/modules/watchdog.h -e '1i #include <cstdint>' + ''; + extraBuildInputs = [ qtscript ]; + iconPath = "resources/icons/hicolor/256x256/simulide.png"; # upstream had a messed up icon path in this release + installFiles = '' + cp -r share/simulide/* $out/share/simulide + cp bin/simulide $out/bin/simulide + ''; + }; + + simulide_1_0_0 = generic { + version = "1.0.0"; + release = "SR2"; + branch = "1.0.0"; + rev = "1449"; + sha256 = "sha256-rJWZvnjVzaKXU2ktbde1w8LSNvu0jWkDIk4dq2l7t5g="; + extraBuildInputs = [ qtscript ]; + }; + + simulide_1_1_0 = generic { + version = "1.1.0"; + release = "RC1"; + branch = "1.1.0"; + rev = "1912"; + sha256 = "sha256-bgRAqt7h2LtU2Ze6Jiz8APhyPcV15v4ofxIilIeZV9E="; + }; +} diff --git a/nixpkgs/pkgs/applications/science/electronics/sv-lang/default.nix b/nixpkgs/pkgs/applications/science/electronics/sv-lang/default.nix new file mode 100644 index 000000000000..58ecf986cf7a --- /dev/null +++ b/nixpkgs/pkgs/applications/science/electronics/sv-lang/default.nix @@ -0,0 +1,75 @@ +{ lib +, stdenv +, fetchFromGitHub +, boost182 +, catch2_3 +, cmake +, ninja +, fmt_9 +, python3 +}: + +let + # dependency for this library has been removed in master (i.e. next release) + unordered_dense = stdenv.mkDerivation rec { + version = "2.0.1"; + pname = "unordered_dense"; + src = fetchFromGitHub { + owner = "martinus"; + repo = pname; + rev = "v${version}"; + sha256 = "sha256-9zlWYAY4lOQsL9+MYukqavBi5k96FvglRgznLIwwRyw="; + }; + nativeBuildInputs = [ + cmake + ]; + }; + +in +stdenv.mkDerivation rec { + pname = "sv-lang"; + version = "3.0"; + + src = fetchFromGitHub { + owner = "MikePopoloski"; + repo = "slang"; + rev = "v${version}"; + sha256 = "sha256-v2sStvukLFMRXGeATxvizmnwEPDE4kwnS06n+37OrJA="; + }; + + cmakeFlags = [ + # fix for https://github.com/NixOS/nixpkgs/issues/144170 + "-DCMAKE_INSTALL_INCLUDEDIR=include" + "-DCMAKE_INSTALL_LIBDIR=lib" + + "-DSLANG_INCLUDE_TESTS=${if doCheck then "ON" else "OFF"}" + ]; + + nativeBuildInputs = [ + cmake + python3 + ninja + + # though only used in tests, cmake will complain its absence when configuring + catch2_3 + ]; + + buildInputs = [ + unordered_dense + boost182 + fmt_9 + ]; + + # TODO: a mysterious linker error occurs when building the unittests on darwin. + # The error occurs when using catch2_3 in nixpkgs, not when fetching catch2_3 using CMake + doCheck = !stdenv.isDarwin; + + meta = with lib; { + description = "SystemVerilog compiler and language services"; + homepage = "https://github.com/MikePopoloski/slang"; + license = licenses.mit; + maintainers = with maintainers; [ sharzy ]; + mainProgram = "slang"; + platforms = platforms.all; + }; +} diff --git a/nixpkgs/pkgs/applications/science/electronics/systemc/default.nix b/nixpkgs/pkgs/applications/science/electronics/systemc/default.nix new file mode 100644 index 000000000000..dc6186841f47 --- /dev/null +++ b/nixpkgs/pkgs/applications/science/electronics/systemc/default.nix @@ -0,0 +1,26 @@ +{ lib, stdenv, fetchFromGitHub, autoreconfHook }: + +stdenv.mkDerivation rec { + pname = "systemc"; + version = "2.3.4"; + + src = fetchFromGitHub { + owner = "accellera-official"; + repo = pname; + rev = version; + sha256 = "0sj8wlkp68cjhmkd9c9lvm3lk3sckczpz7w9vby64inc1f9fnf0b"; + }; + + enableParallelBuilding = true; + nativeBuildInputs = [ autoreconfHook ]; + + configureFlags = [ "--with-unix-layout" ]; + + meta = with lib; { + description = "The language for System-level design, modeling and verification"; + homepage = "https://systemc.org/"; + license = licenses.asl20; + platforms = platforms.linux; + maintainers = with maintainers; [ victormignot amiloradovsky ]; + }; +} diff --git a/nixpkgs/pkgs/applications/science/electronics/tkgate/1.x.nix b/nixpkgs/pkgs/applications/science/electronics/tkgate/1.x.nix new file mode 100644 index 000000000000..f8741cd8d180 --- /dev/null +++ b/nixpkgs/pkgs/applications/science/electronics/tkgate/1.x.nix @@ -0,0 +1,42 @@ +{ lib, stdenv, fetchurl, tcl, tk, libX11, glibc, which, bison, flex, imake, xorgproto, gccmakedep }: + +let + libiconvInc = lib.optionalString stdenv.isLinux "${glibc.dev}/include"; + libiconvLib = lib.optionalString stdenv.isLinux "${glibc.out}/lib"; +in +stdenv.mkDerivation rec { + pname = "tkgate"; + version = "1.8.7"; + + src = fetchurl { + url = "http://www.tkgate.org/downloads/tkgate-${version}.tgz"; + sha256 = "1pqywkidfpdbj18i03h97f4cimld4fb3mqfy8jjsxs12kihm18fs"; + }; + + nativeBuildInputs = [ which bison flex imake gccmakedep ]; + buildInputs = [ tcl tk libX11 xorgproto ]; + dontUseImakeConfigure = true; + + patchPhase = '' + sed -i config.h \ + -e 's|.*#define.*TKGATE_TCLTK_VERSIONS.*|#define TKGATE_TCLTK_VERSIONS "${tcl.release}"|' \ + -e 's|.*#define.*TKGATE_INCDIRS.*|#define TKGATE_INCDIRS "${tcl}/include ${tk}/include ${libiconvInc} ${libX11.dev}/include"|' \ + -e 's|.*#define.*TKGATE_LIBDIRS.*|#define TKGATE_LIBDIRS "${tcl}/lib ${tk}/lib ${libiconvLib} ${libX11.out}/lib"|' \ + \ + -e '20 i #define TCL_LIBRARY "${tcl}/lib"' \ + -e '20 i #define TK_LIBRARY "${tk}/lib/${tk.libPrefix}"' \ + -e '20 i #define USE_ICONV 1' \ + \ + -e "s|.*#define.*TKGATE_HOMEDIRBASE.*|#define TKGATE_HOMEDIRBASE \\\"$out/lib\\\"|" \ + -e "s|.*#define.*TKGATE_BINDIR.*|#define TKGATE_BINDIR \\\"$out/bin\\\"|" \ + -e "s|.*#define.*TKGATE_MANDIR.*|#define TKGATE_MANDIR \\\"$out/share/man/man1\\\"|" \ + -e "s|file:/usr/X11R6/lib/tkgate-|file://$out/lib/tkgate-|" + ''; + + meta = { + description = "Event driven digital circuit simulator with a TCL/TK-based graphical editor"; + homepage = "http://www.tkgate.org/"; + license = lib.licenses.gpl2Plus; + hydraPlatforms = lib.platforms.linux; + }; +} diff --git a/nixpkgs/pkgs/applications/science/electronics/verilator/default.nix b/nixpkgs/pkgs/applications/science/electronics/verilator/default.nix new file mode 100644 index 000000000000..062ba93ca420 --- /dev/null +++ b/nixpkgs/pkgs/applications/science/electronics/verilator/default.nix @@ -0,0 +1,47 @@ +{ lib, stdenv, fetchFromGitHub, perl, flex, bison, python3, autoconf, + which, cmake, ccache, help2man, makeWrapper, glibcLocales, + systemc, git, numactl }: + +stdenv.mkDerivation rec { + pname = "verilator"; + version = "5.022"; + + src = fetchFromGitHub { + owner = pname; + repo = pname; + rev = "v${version}"; + hash = "sha256-Ya3lqK8BfvMVLZUrD2Et6OmptteWXp5VmZb2x2G/V/E="; + }; + + enableParallelBuilding = true; + buildInputs = [ perl python3 systemc ]; # ccache + nativeBuildInputs = [ makeWrapper flex bison autoconf help2man git ]; + nativeCheckInputs = [ which numactl ]; # cmake + + doCheck = stdenv.isLinux; # darwin tests are broken for now... + checkTarget = "test"; + + preConfigure = "autoconf"; + + postPatch = '' + patchShebangs bin/* src/* nodist/* docs/bin/* examples/xml_py/* \ + test_regress/{driver.pl,t/*.{pl,pf}} \ + ci/* ci/docker/run/* ci/docker/run/hooks/* ci/docker/buildenv/build.sh + ''; + # grep '^#!/' -R . | grep -v /nix/store | less + # (in nix-shell after patchPhase) + + postInstall = lib.optionalString stdenv.isLinux '' + for x in $(ls $out/bin/verilator*); do + wrapProgram "$x" --set LOCALE_ARCHIVE "${glibcLocales}/lib/locale/locale-archive" + done + ''; + + meta = with lib; { + description = "Fast and robust (System)Verilog simulator/compiler and linter"; + homepage = "https://www.veripool.org/verilator"; + license = with licenses; [ lgpl3Only artistic2 ]; + platforms = platforms.unix; + maintainers = with maintainers; [ thoughtpolice amiloradovsky ]; + }; +} diff --git a/nixpkgs/pkgs/applications/science/electronics/verilog/default.nix b/nixpkgs/pkgs/applications/science/electronics/verilog/default.nix new file mode 100644 index 000000000000..06e8a94a4c53 --- /dev/null +++ b/nixpkgs/pkgs/applications/science/electronics/verilog/default.nix @@ -0,0 +1,80 @@ +{ lib, stdenv +, fetchFromGitHub +, fetchpatch +, autoconf +, bison +, bzip2 +, flex +, gperf +, ncurses +, perl +, python3 +, readline +, zlib +}: + +stdenv.mkDerivation rec { + pname = "iverilog"; + version = "12.0"; + + src = fetchFromGitHub { + owner = "steveicarus"; + repo = pname; + rev = "v${lib.replaceStrings ["."] ["_"] version}"; + hash = "sha256-J9hedSmC6mFVcoDnXBtaTXigxrSCFa2AhhFd77ueo7I="; + }; + + nativeBuildInputs = [ autoconf bison flex gperf ]; + + CC_FOR_BUILD="${stdenv.cc}/bin/cc"; + CXX_FOR_BUILD="${stdenv.cc}/bin/c++"; + + patches = [ + # NOTE(jleightcap): `-Werror=format-security` warning patched shortly after release, backport the upstream fix + (fetchpatch { + name = "format-security"; + url = "https://github.com/steveicarus/iverilog/commit/23e51ef7a8e8e4ba42208936e0a6a25901f58c65.patch"; + hash = "sha256-fMWfBsCl2fuXe+6AR10ytb8QpC84bXlP5RSdrqsWzEk="; + }) + ]; + + buildInputs = [ bzip2 ncurses readline zlib ]; + + preConfigure = "sh autoconf.sh"; + + enableParallelBuilding = true; + + env = lib.optionalAttrs stdenv.isDarwin { + NIX_CFLAGS_COMPILE = "-Wno-error=implicit-function-declaration"; + }; + + # NOTE(jleightcap): the `make check` target only runs a "Hello, World"-esque sanity check. + # the tests in the doInstallCheck phase run a full regression test suite. + # however, these tests currently fail upstream on aarch64 + # (see https://github.com/steveicarus/iverilog/issues/917) + # so disable the full suite for now. + doCheck = true; + doInstallCheck = !stdenv.isAarch64; + + nativeInstallCheckInputs = [ + perl + (python3.withPackages (pp: with pp; [ + docopt + ])) + ]; + + installCheckPhase = '' + runHook preInstallCheck + export PATH="$PATH:$out/bin" + sh .github/test.sh + runHook postInstallCheck + ''; + + meta = with lib; { + description = "Icarus Verilog compiler"; + homepage = "http://iverilog.icarus.com/"; # https does not work + license = with licenses; [ gpl2Plus lgpl21Plus ]; + maintainers = with maintainers; [ thoughtpolice ]; + platforms = platforms.all; + }; +} diff --git a/nixpkgs/pkgs/applications/science/electronics/vhd2vl/default.nix b/nixpkgs/pkgs/applications/science/electronics/vhd2vl/default.nix new file mode 100644 index 000000000000..0ec14d282b4a --- /dev/null +++ b/nixpkgs/pkgs/applications/science/electronics/vhd2vl/default.nix @@ -0,0 +1,51 @@ +{ lib +, stdenv +, fetchFromGitHub +, fetchpatch +, bison +, flex +, verilog +, which +}: + +stdenv.mkDerivation rec { + pname = "vhd2vl"; + version = "unstable-2022-12-26"; + + src = fetchFromGitHub { + owner = "ldoolitt"; + repo = pname; + rev = "869d442987dff6b9730bc90563ede89c1abfd28f"; + sha256 = "sha256-Hz2XkT5m4ri5wVR2ciL9Gx73zr+RdW5snjWnUg300c8="; + }; + + nativeBuildInputs = [ + bison + flex + which + ]; + + buildInputs = [ + verilog + ]; + + # the "translate" target both (a) builds the software and (b) runs + # the tests (without validating the results) + buildTargets = [ "translate" ]; + + # the "diff" target examines the test results + checkTarget = "diff"; + + installPhase = '' + runHook preInstall + install -D -m755 src/vhd2vl $out/bin/vhd2vl + runHook postInstall + ''; + + meta = with lib; { + description = "VHDL to Verilog converter"; + homepage = "https://github.com/ldoolitt/vhd2vl"; + license = licenses.gpl2Plus; + maintainers = with maintainers; [ matthuszagh ]; + }; +} diff --git a/nixpkgs/pkgs/applications/science/electronics/xcircuit/default.nix b/nixpkgs/pkgs/applications/science/electronics/xcircuit/default.nix new file mode 100644 index 000000000000..61b63ff1d7a4 --- /dev/null +++ b/nixpkgs/pkgs/applications/science/electronics/xcircuit/default.nix @@ -0,0 +1,33 @@ +{ lib, stdenv, fetchFromGitHub, autoreconfHook, automake, pkg-config +, cairo, ghostscript, ngspice, tcl, tk, xorg, zlib }: + +stdenv.mkDerivation rec { + version = "3.10.37"; + pname = "xcircuit"; + + src = fetchFromGitHub { + owner = "RTimothyEdwards"; + repo = "XCircuit"; + rev = "0056213308c92bec909e8469a0fa1515b72fc3d2"; + sha256 = "sha256-LXU5VEkLF1aKYz9ynI1qQjJUwt/zKFMPYj153OgJOOI="; + }; + + nativeBuildInputs = [ autoreconfHook automake pkg-config ]; + hardeningDisable = [ "format" ]; + + configureFlags = [ + "--with-tcl=${tcl}/lib" + "--with-tk=${tk}/lib" + "--with-ngspice=${lib.getBin ngspice}/bin/ngspice" + ]; + + buildInputs = with xorg; [ cairo ghostscript libSM libXt libICE libX11 libXpm tcl tk zlib ]; + + meta = with lib; { + description = "Generic drawing program tailored to circuit diagrams"; + homepage = "http://opencircuitdesign.com/xcircuit"; + license = licenses.gpl2; + platforms = platforms.linux; + maintainers = with maintainers; [ john-shaffer spacefrogg thoughtpolice ]; + }; +} diff --git a/nixpkgs/pkgs/applications/science/electronics/xoscope/default.nix b/nixpkgs/pkgs/applications/science/electronics/xoscope/default.nix new file mode 100644 index 000000000000..9f9224b5543c --- /dev/null +++ b/nixpkgs/pkgs/applications/science/electronics/xoscope/default.nix @@ -0,0 +1,32 @@ +{ lib +, stdenv +, fetchurl +, gtk3 +, gtkdatabox +, fftw +, gnum4 +, comedilib +, alsa-lib +, pkg-config +}: + +stdenv.mkDerivation rec { + pname = "xoscope"; + version = "2.3"; + + src = fetchurl { + url = "mirror://sourceforge/xoscope/${pname}-${version}.tar.gz"; + sha256 = "0a5ycfc1qdmibvagc82r2mhv2i99m6pndy5i6ixas3j2297g6pgq"; + }; + + nativeBuildInputs = [ pkg-config gnum4 ]; + buildInputs = [ gtk3 gtkdatabox fftw comedilib alsa-lib ]; + + meta = { + description = "Oscilloscope through the sound card"; + homepage = "https://xoscope.sourceforge.net"; + license = lib.licenses.gpl2Plus; + maintainers = with lib.maintainers; [viric]; + platforms = with lib.platforms; linux; + }; +} diff --git a/nixpkgs/pkgs/applications/science/electronics/xschem/default.nix b/nixpkgs/pkgs/applications/science/electronics/xschem/default.nix new file mode 100644 index 000000000000..826181139c19 --- /dev/null +++ b/nixpkgs/pkgs/applications/science/electronics/xschem/default.nix @@ -0,0 +1,47 @@ +{ stdenv +, fetchFromGitHub +, lib +, bison +, cairo +, flex +, libX11 +, libXpm +, pkg-config +, tcl +, tk +}: + +stdenv.mkDerivation rec { + pname = "xschem"; + version = "3.4.4"; + + src = fetchFromGitHub { + owner = "StefanSchippers"; + repo = "xschem"; + rev = version; + sha256 = "sha256-1jP1SJeq23XNkOQgcl2X+rBrlka4a04irmfhoKRM1j4="; + }; + + nativeBuildInputs = [ bison flex pkg-config ]; + + buildInputs = [ cairo libX11 libXpm tcl tk ]; + + hardeningDisable = [ "format" ]; + + meta = with lib; { + broken = stdenv.isDarwin; + description = "Schematic capture and netlisting EDA tool"; + longDescription = '' + Xschem is a schematic capture program, it allows creation of + hierarchical representation of circuits with a top down approach. + By focusing on interfaces, hierarchy and instance properties a + complex system can be described in terms of simpler building + blocks. A VHDL or Verilog or Spice netlist can be generated from + the drawn schematic, allowing the simulation of the circuit. + ''; + homepage = "https://xschem.sourceforge.io/stefan/"; + license = licenses.gpl2Plus; + maintainers = with maintainers; [ fbeffa ]; + platforms = platforms.all; + }; +} diff --git a/nixpkgs/pkgs/applications/science/electronics/xyce/default.nix b/nixpkgs/pkgs/applications/science/electronics/xyce/default.nix new file mode 100644 index 000000000000..93c155038a22 --- /dev/null +++ b/nixpkgs/pkgs/applications/science/electronics/xyce/default.nix @@ -0,0 +1,190 @@ +{ stdenv +, fetchFromGitHub +, fetchgit +, lib +, autoconf +, automake +, bison +, blas +, flex +, fftw +, gfortran +, lapack +, libtool_2 +, mpi +, suitesparse +, trilinos +, withMPI ? false + # for doc +, texliveMedium +, pandoc +, enableDocs ? true + # for tests +, bash +, bc +, openssh # required by MPI +, perl +, perlPackages +, python3 +, enableTests ? true +}: + +assert withMPI -> trilinos.withMPI; + +let + version = "7.8.0"; + + # useing fetchurl or fetchFromGitHub doesn't include the manuals + # due to .gitattributes files + xyce_src = fetchgit { + url = "https://github.com/Xyce/Xyce.git"; + rev = "Release-${version}"; + sha256 = "sha256-+aNy2bGuFQ517FZUvU0YqN0gmChRpVuFEmFGTCx9AgY="; + }; + + regression_src = fetchFromGitHub { + owner = "Xyce"; + repo = "Xyce_Regression"; + rev = "Release-${version}"; + sha256 = "sha256-Fxi/NpXXIw/bseWaLi2iQ4sg4S9Z+othGgSvQoxyJ9c="; + }; +in + +stdenv.mkDerivation rec { + pname = "xyce"; + inherit version; + + srcs = [ xyce_src regression_src ]; + + sourceRoot = xyce_src.name; + + preConfigure = "./bootstrap"; + + configureFlags = [ + "CXXFLAGS=-O3" + "--enable-xyce-shareable" + "--enable-shared" + "--enable-stokhos" + "--enable-amesos2" + ] ++ lib.optionals withMPI [ + "--enable-mpi" + "CXX=mpicxx" + "CC=mpicc" + "F77=mpif77" + ]; + + enableParallelBuilding = true; + + nativeBuildInputs = [ + autoconf + automake + gfortran + libtool_2 + ] ++ lib.optionals enableDocs [ + (texliveMedium.withPackages (ps: with ps; [ + enumitem + koma-script + optional + framed + enumitem + multirow + newtx + preprint + ])) + ]; + + buildInputs = [ + bison + blas + flex + fftw + lapack + suitesparse + trilinos + ] ++ lib.optionals withMPI [ mpi ]; + + doCheck = enableTests; + + postPatch = '' + pushd ../${regression_src.name} + find Netlists -type f -regex ".*\.sh\|.*\.pl" -exec chmod ugo+x {} \; + # some tests generate new files, some overwrite netlists + find . -type d -exec chmod u+w {} \; + find . -type f -name "*.cir" -exec chmod u+w {} \; + patchShebangs Netlists/ TestScripts/ + # patch script generating functions + sed -i -E 's|/usr/bin/env perl|${lib.escapeRegex perl.outPath}/bin/perl|' \ + TestScripts/XyceRegression/Testing/Netlists/RunOptions/runOptions.cir.sh + sed -i -E 's|/bin/sh|${lib.escapeRegex bash.outPath}/bin/sh|' \ + TestScripts/XyceRegression/Testing/Netlists/RunOptions/runOptions.cir.sh + popd + ''; + + nativeCheckInputs = [ + bc + perl + (python3.withPackages (ps: with ps; [ numpy scipy ])) + ] ++ lib.optionals withMPI [ mpi openssh ]; + + checkPhase = '' + XYCE_BINARY="$(pwd)/src/Xyce" + EXECSTRING="${lib.optionalString withMPI "mpirun -np 2 "}$XYCE_BINARY" + TEST_ROOT="$(pwd)/../${regression_src.name}" + + # Honor the TMP variable + sed -i -E 's|/tmp|\$TMP|' $TEST_ROOT/TestScripts/suggestXyceTagList.sh + + EXLUDE_TESTS_FILE=$TMP/exclude_tests.$$ + # Gold standard has additional ":R" suffix in result column label + echo "Output/HB/hb-step-tecplot.cir" >> $EXLUDE_TESTS_FILE + # This test makes Xyce access /sys/class/net when run with MPI + ${lib.optionalString withMPI "echo \"CommandLine/command_line.cir\" >> $EXLUDE_TESTS_FILE"} + + $TEST_ROOT/TestScripts/run_xyce_regression \ + --output="$(pwd)/Xyce_Test" \ + --xyce_test="''${TEST_ROOT}" \ + --taglist="$($TEST_ROOT/TestScripts/suggestXyceTagList.sh "$XYCE_BINARY" | sed -E -e 's/TAGLIST=([^ ]+).*/\1/' -e '2,$d')" \ + --resultfile="$(pwd)/test_results" \ + --excludelist="$EXLUDE_TESTS_FILE" \ + "''${EXECSTRING}" + ''; + + outputs = [ "out" "doc" ]; + + postInstall = lib.optionalString enableDocs '' + local docFiles=("doc/Users_Guide/Xyce_UG" + "doc/Reference_Guide/Xyce_RG" + "doc/Release_Notes/Release_Notes_${lib.versions.majorMinor version}/Release_Notes_${lib.versions.majorMinor version}") + + # SANDIA LaTeX class and some organization logos are not publicly available see + # https://groups.google.com/g/xyce-users/c/MxeViRo8CT4/m/ppCY7ePLEAAJ + for img in "snllineblubrd" "snllineblk" "DOEbwlogo" "NNSA_logo"; do + sed -i -E "s/\\includegraphics\[height=(0.[1-9]in)\]\{$img\}/\\mbox\{\\rule\{0mm\}\{\1\}\}/" ''${docFiles[2]}.tex + done + + install -d $doc/share/doc/${pname}-${version}/ + for d in ''${docFiles[@]}; do + # Use a public document class + sed -i -E 's/\\documentclass\[11pt,report\]\{SANDreport\}/\\documentclass\[11pt,letterpaper\]\{scrreprt\}/' $d.tex + sed -i -E 's/\\usepackage\[sand\]\{optional\}/\\usepackage\[report\]\{optional\}/' $d.tex + pushd $(dirname $d) + make + install -t $doc/share/doc/${pname}-${version}/ $(basename $d.pdf) + popd + done + ''; + + meta = with lib; { + broken = (stdenv.isLinux && stdenv.isAarch64) || stdenv.isDarwin; + description = "High-performance analog circuit simulator"; + longDescription = '' + Xyce is a SPICE-compatible, high-performance analog circuit simulator, + capable of solving extremely large circuit problems by supporting + large-scale parallel computing platforms. + ''; + homepage = "https://xyce.sandia.gov"; + license = licenses.gpl3; + maintainers = with maintainers; [ fbeffa ]; + platforms = platforms.all; + }; +} |