diff options
Diffstat (limited to 'nixpkgs/pkgs/applications/science/electronics')
40 files changed, 2075 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..f55dd2f0528e --- /dev/null +++ b/nixpkgs/pkgs/applications/science/electronics/adms/default.nix @@ -0,0 +1,26 @@ +{ stdenv, fetchFromGitHub, autoreconfHook, flex, bison, gperf, + libxml2, perl, perlPackages, gd }: + +stdenv.mkDerivation rec { + version = "2.3.6"; + pname = "adms"; + + src = fetchFromGitHub { + owner = "Qucs"; + repo = "adms"; + rev = "release-${version}"; + sha256 = "1pcwq5khzdq4x33lid9hq967gv78dr5i4f2sk8m8rwkfqb9vdzrg"; + }; + + 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 = stdenv.lib.licenses.gpl3; + maintainers = with stdenv.lib.maintainers; [disassembler]; + platforms = with stdenv.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..861f6cea0b4b --- /dev/null +++ b/nixpkgs/pkgs/applications/science/electronics/alliance/default.nix @@ -0,0 +1,74 @@ +{ stdenv, fetchurl +, xorgproto, motif, libX11, libXt, libXpm, bison +, flex, automake, autoconf, libtool, runtimeShell +}: + +stdenv.mkDerivation rec { + pname = "alliance"; + version = "5.1.1"; + + src = fetchurl { + url = "http://www-asim.lip6.fr/pub/alliance/distribution/5.0/${pname}-${version}.tar.bz2"; + sha256 = "046c9qwl1vbww0ljm4xyxf5jpz9nq62b2q0wdz9xjimgh4c207w1"; + }; + + + nativeBuildInputs = [ libtool automake autoconf flex ]; + buildInputs = [ xorgproto motif libX11 libXt libXpm bison ]; + + sourceRoot = "alliance/src/"; + + configureFlags = [ + "--prefix=$(out)" + ]; + + preConfigure = '' + mkdir -p $out/etc + + #texlive for docs seems extreme + mkdir -p $out/share/alliance + mv ./documentation $out/share/alliance + substituteInPlace autostuff \ + --replace "$newdirs documentation" "$newdirs" \ + --replace documentation Solaris + + substituteInPlace sea/src/DEF_grammar_lex.l \ + --replace "ifndef FLEX_BETA" "if (YY_FLEX_MAJOR_VERSION <= 2) && (YY_FLEX_MINOR_VERSION < 6)" + ./autostuff + ''; + + allianceInstaller = '' + #!${runtimeShell} + cp -v -r -n --no-preserve=mode $out/etc/* /etc/ > /etc/alliance-install.log + ''; + + allianceUnInstaller = '' + #!${runtimeShell} + awk '{print \$3}' /etc/alliance-install.log | xargs rm + awk '{print \$3}' /etc/alliance-install.log | xargs rmdir + rm /etc/alliance-install.log + ''; + + 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/ + + echo "${allianceInstaller}" > $out/bin/alliance-install + chmod +x $out/bin/alliance-install + + echo "${allianceUnInstaller}" > $out/bin/alliance-uninstall + chmod +x $out/bin/alliance-uninstall + ''; + + meta = with stdenv.lib; { + description = "Complete set of free CAD tools and portable libraries for VLSI design"; + homepage = "http://www-asim.lip6.fr/recherche/alliance/"; + license = with licenses; gpl2Plus; + maintainers = with maintainers; [ ]; + platforms = with platforms; linux; + broken = true; + }; +} 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..1377231c152b --- /dev/null +++ b/nixpkgs/pkgs/applications/science/electronics/archimedes/default.nix @@ -0,0 +1,17 @@ +{stdenv, fetchurl}: + +stdenv.mkDerivation rec { + name = "archimedes-2.0.1"; + + src = fetchurl { + url = "mirror://gnu/archimedes/${name}.tar.gz"; + sha256 = "0jfpnd3pns5wxcxbiw49v5sgpmm5b4v8s4q1a5292hxxk2hzmb3z"; + }; + + meta = { + description = "GNU package for semiconductor device simulations"; + homepage = "https://www.gnu.org/software/archimedes"; + license = stdenv.lib.licenses.gpl2Plus; + platforms = with stdenv.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..acbdeb8cfaa2 --- /dev/null +++ b/nixpkgs/pkgs/applications/science/electronics/bitscope/common.nix @@ -0,0 +1,64 @@ +{ atk +, buildFHSUserEnv +, cairo +, dpkg +, gdk-pixbuf +, glib +, gtk2-x11 +, makeWrapper +, pango +, stdenv +, xorg +}: + +{ src, toolName, version, ... } @ attrs: +let + wrapBinary = libPaths: binaryName: '' + wrapProgram "$out/bin/${binaryName}" \ + --prefix LD_LIBRARY_PATH : "${stdenv.lib.makeLibraryPath libPaths}" + ''; + pkg = stdenv.mkDerivation (rec { + inherit (attrs) version src; + + name = "${toolName}-${version}"; + + meta = with stdenv.lib; { + homepage = "http://bitscope.com/software/"; + license = licenses.unfree; + platforms = [ "x86_64-linux" ]; + maintainers = with maintainers; [ + vidbina + ]; + } // (attrs.meta or {}); + + buildInputs = [ + dpkg + makeWrapper + ]; + + 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 buildFHSUserEnv { + 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..6f832013e8ca --- /dev/null +++ b/nixpkgs/pkgs/applications/science/electronics/caneda/default.nix @@ -0,0 +1,26 @@ +{stdenv, fetchFromGitHub, cmake, qtbase, qttools, qtsvg, qwt }: + +stdenv.mkDerivation rec { + pname = "caneda"; + version = "0.3.1"; + + src = fetchFromGitHub { + owner = "Caneda"; + repo = "Caneda"; + rev = version; + sha256 = "0hx8qid50j9xvg2kpbpqmbdyakgyjn6m373m1cvhp70v2gp1v8l2"; + }; + + nativeBuildInputs = [ cmake ]; + buildInputs = [ qtbase qttools qtsvg qwt ]; + + enableParallelBuilding = true; + + meta = { + description = "Open source EDA software focused on easy of use and portability"; + homepage = "http://caneda.org"; + license = stdenv.lib.licenses.gpl2Plus; + maintainers = with stdenv.lib.maintainers; [viric]; + platforms = with stdenv.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/dsview/default.nix b/nixpkgs/pkgs/applications/science/electronics/dsview/default.nix new file mode 100644 index 000000000000..4d3acb331d5d --- /dev/null +++ b/nixpkgs/pkgs/applications/science/electronics/dsview/default.nix @@ -0,0 +1,42 @@ +{ stdenv, fetchFromGitHub, pkgconfig, cmake, +libzip, boost, fftw, qtbase, +libusb1, wrapQtAppsHook, libsigrok4dsl, libsigrokdecode4dsl +}: + +stdenv.mkDerivation rec { + pname = "dsview"; + + version = "0.99"; + + src = fetchFromGitHub { + owner = "DreamSourceLab"; + repo = "DSView"; + rev = version; + sha256 = "189i3baqgn8k3aypalayss0g489xi0an9hmvyggvxmgg1cvcwka2"; + }; + + postUnpack = '' + export sourceRoot=$sourceRoot/DSView + ''; + + patches = [ + # Fix absolute install paths + ./install.patch + ]; + + nativeBuildInputs = [ cmake pkgconfig wrapQtAppsHook ]; + + buildInputs = [ + boost fftw qtbase libusb1 libzip libsigrokdecode4dsl libsigrok4dsl + ]; + + enableParallelBuilding = true; + + meta = with stdenv.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.linux; + maintainers = [ maintainers.bachp ]; + }; +} 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..e30a28d80fa3 --- /dev/null +++ b/nixpkgs/pkgs/applications/science/electronics/dsview/install.patch @@ -0,0 +1,15 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index c1c33e1..208a184 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -403,8 +403,8 @@ install(DIRECTORY res DESTINATION share/${PROJECT_NAME}) + install(FILES icons/logo.png DESTINATION share/${PROJECT_NAME} RENAME logo.png) + install(FILES ../NEWS DESTINATION share/${PROJECT_NAME} RENAME NEWS) + install(FILES ../ug.pdf DESTINATION share/${PROJECT_NAME} RENAME ug.pdf) +-install(FILES DreamSourceLab.rules DESTINATION /etc/udev/rules.d/) +-install(FILES DSView.desktop DESTINATION /usr/share/applications/) ++install(FILES DreamSourceLab.rules DESTINATION etc/udev/rules.d/) ++install(FILES DSView.desktop DESTINATION share/applications/) + + #=============================================================================== + #= Packaging (handled by CPack) diff --git a/nixpkgs/pkgs/applications/science/electronics/dsview/libsigrok4dsl.nix b/nixpkgs/pkgs/applications/science/electronics/dsview/libsigrok4dsl.nix new file mode 100644 index 000000000000..7915cb0ba4ae --- /dev/null +++ b/nixpkgs/pkgs/applications/science/electronics/dsview/libsigrok4dsl.nix @@ -0,0 +1,28 @@ +{ stdenv, pkgconfig, autoreconfHook, +glib, libzip, libserialport, check, libusb1, libftdi, +systemd, alsaLib, dsview +}: + +stdenv.mkDerivation { + inherit (dsview) version src; + + pname = "libsigrok4dsl"; + + postUnpack = '' + export sourceRoot=$sourceRoot/libsigrok4DSL + ''; + + nativeBuildInputs = [ pkgconfig autoreconfHook ]; + + buildInputs = [ + glib libzip libserialport libusb1 libftdi systemd check alsaLib + ]; + + meta = with stdenv.lib; { + description = "A fork of the sigrok library for usage with DSView"; + homepage = "https://www.dreamsourcelab.com/"; + license = licenses.gpl3Plus; + platforms = platforms.linux; + maintainers = [ maintainers.bachp ]; + }; +} diff --git a/nixpkgs/pkgs/applications/science/electronics/dsview/libsigrokdecode4dsl.nix b/nixpkgs/pkgs/applications/science/electronics/dsview/libsigrokdecode4dsl.nix new file mode 100644 index 000000000000..72b2fa1b6854 --- /dev/null +++ b/nixpkgs/pkgs/applications/science/electronics/dsview/libsigrokdecode4dsl.nix @@ -0,0 +1,27 @@ +{ stdenv, pkgconfig, autoreconfHook, +glib, check, python3, dsview +}: + +stdenv.mkDerivation { + inherit (dsview) version src; + + pname = "libsigrokdecode4dsl"; + + postUnpack = '' + export sourceRoot=$sourceRoot/libsigrokdecode4DSL + ''; + + nativeBuildInputs = [ pkgconfig autoreconfHook ]; + + buildInputs = [ + python3 glib check + ]; + + meta = with stdenv.lib; { + description = "A fork of the sigrokdecode library for usage with DSView"; + homepage = "https://www.dreamsourcelab.com/"; + license = licenses.gpl3Plus; + platforms = platforms.linux; + maintainers = [ maintainers.bachp ]; + }; +} 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..7c5942d825a9 --- /dev/null +++ b/nixpkgs/pkgs/applications/science/electronics/eagle/eagle.nix @@ -0,0 +1,80 @@ +{ stdenv, mkDerivation, fetchurl, makeDesktopItem +, libXrender, libXrandr, libXcursor, libX11, libXext, libXi, libxcb + , libGL, glib, nss, nspr, expat, alsaLib +, qtbase, qtdeclarative, qtsvg, qtlocation, qtwebchannel, qtwebengine +}: + +let + libPath = stdenv.lib.makeLibraryPath + [ libXrender libXrandr libXcursor libX11 libXext libXi libxcb + libGL glib nss nspr expat alsaLib + qtbase qtdeclarative qtsvg qtlocation qtwebchannel qtwebengine + ]; + in + mkDerivation rec { + pname = "eagle"; + version = "9.6.0"; + + src = fetchurl { + url = "https://eagle-updates.circuits.io/downloads/${builtins.replaceStrings ["."] ["_"] version}/Autodesk_EAGLE_${version}_English_Linux_64bit.tar.gz"; + sha256 = "1crkyc7ws2zz5dfs00h6rj4z2hyqb97kp6r4hxhmcgg5647ij4z8"; + }; + + desktopItem = makeDesktopItem { + name = "eagle"; + exec = "eagle"; + icon = "eagle"; + comment = "Schematic capture and PCB layout"; + desktopName = "Eagle"; + genericName = "Schematic editor"; + categories = "Application;Development;"; + }; + + buildInputs = + [ libXrender libXrandr libXcursor libX11 libXext libXi libxcb + libGL glib nss nspr expat alsaLib + 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/icons + ln -s "$out/eagle-${version}/bin/eagle-logo.png" "$out"/share/icons/eagle.png + ''; + + meta = with stdenv.lib; { + description = "Schematic editor and PCB layout tool from Autodesk (formerly CadSoft)"; + homepage = "https://www.autodesk.com/products/eagle/overview"; + license = licenses.unfree; + platforms = [ "x86_64-linux" ]; + maintainers = [ maintainers.rittelle ]; + }; + } diff --git a/nixpkgs/pkgs/applications/science/electronics/eagle/eagle7.nix b/nixpkgs/pkgs/applications/science/electronics/eagle/eagle7.nix new file mode 100644 index 000000000000..af0fb675880e --- /dev/null +++ b/nixpkgs/pkgs/applications/science/electronics/eagle/eagle7.nix @@ -0,0 +1,97 @@ +{ stdenv, fetchurl, makeDesktopItem, patchelf, zlib, freetype, fontconfig +, openssl, libXrender, libXrandr, libXcursor, libX11, libXext, libXi +, libxcb, cups, xkeyboardconfig, runtimeShell +}: + +let + + libPath = stdenv.lib.makeLibraryPath + [ zlib freetype fontconfig openssl libXrender libXrandr libXcursor libX11 + libXext libXi libxcb cups + ]; + +in + +stdenv.mkDerivation rec { + pname = "eagle"; + version = "7.7.0"; + + src = + if stdenv.hostPlatform.system == "i686-linux" then + fetchurl { + url = "ftp://ftp.cadsoft.de/eagle/program/7.7/eagle-lin32-${version}.run"; + sha256 = "16fa66p77xigc7zvzfm7737mllrcs6nrgk2p7wvkjw3p9lvbz7z1"; + } + else if stdenv.hostPlatform.system == "x86_64-linux" then + fetchurl { + url = "ftp://ftp.cadsoft.de/eagle/program/7.7/eagle-lin64-${version}.run"; + sha256 = "18dcn6wqph1sqh0ah98qzfi05wip8a8ifbkaq79iskbrsi8iqnrg"; + } + else + throw "Unsupported system: ${stdenv.hostPlatform.system}"; + + desktopItem = makeDesktopItem { + name = "eagle"; + exec = "eagle"; + icon = "eagle"; + comment = "Schematic capture and PCB layout"; + desktopName = "Eagle"; + genericName = "Schematic editor"; + categories = "Application;Development;"; + }; + + buildInputs = + [ patchelf zlib freetype fontconfig openssl libXrender libXrandr libXcursor + libX11 libXext libXi + ]; + + phases = [ "installPhase" ]; + + # NOTES: + # Eagle for Linux comes as a self-extracting shell script with embedded + # tarball. The tarball data (.tar.bz2) starts after a __DATA__ marker. + # + # Eagle apparently doesn't like binary patching. This is what happens: + # $ ./result/eagle-6.4.0/bin/eagle + # argv[0] (/home/bfo/nixpkgs/result/eagle-6.4.0/bin/eagle) is not the currently executed program version! + installPhase = '' + # Extract eagle tarball + mkdir "$out" + sed '1,/^__DATA__$/d' "$src" | tar -xjf - -C "$out" + + # Install manpage + mkdir -p "$out"/share/man/man1 + ln -s "$out"/eagle-${version}/doc/eagle.1 "$out"/share/man/man1/eagle.1 + + # Build LD_PRELOAD library that redirects license file access to the home + # directory of the user + mkdir -p "$out"/lib + gcc -shared -fPIC -DEAGLE_PATH=\"$out/eagle-${version}\" ${./eagle7_fixer.c} -o "$out"/lib/eagle_fixer.so -ldl + + # Make wrapper script + dynlinker="$(cat $NIX_CC/nix-support/dynamic-linker)" + mkdir -p "$out"/bin + cat > "$out"/bin/eagle << EOF + #!${runtimeShell} + export LD_LIBRARY_PATH="${stdenv.cc.cc.lib}/lib:${libPath}" + export LD_PRELOAD="$out/lib/eagle_fixer.so" + export QT_XKB_CONFIG_ROOT="${xkeyboardconfig}/share/X11/xkb" + exec "$dynlinker" "$out/eagle-${version}/bin/eagle" "\$@" + EOF + chmod a+x "$out"/bin/eagle + + # Make desktop item + mkdir -p "$out"/share/applications + cp "$desktopItem"/share/applications/* "$out"/share/applications/ + mkdir -p "$out"/share/icons + ln -s "$out/eagle-${version}/bin/eagleicon50.png" "$out"/share/icons/eagle.png + ''; + + meta = with stdenv.lib; { + description = "Schematic editor and PCB layout tool from CadSoft"; + homepage = "http://www.cadsoftusa.com/"; + license = licenses.unfree; + platforms = platforms.linux; + maintainers = [ maintainers.bjornfor ]; + }; +} 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/fparser/default.nix b/nixpkgs/pkgs/applications/science/electronics/fparser/default.nix new file mode 100644 index 000000000000..55e40ca2b00b --- /dev/null +++ b/nixpkgs/pkgs/applications/science/electronics/fparser/default.nix @@ -0,0 +1,26 @@ +{ 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 stdenv.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..9ef47ae26346 --- /dev/null +++ b/nixpkgs/pkgs/applications/science/electronics/fped/default.nix @@ -0,0 +1,44 @@ +{ lib, stdenv, fetchgit +, flex, bison, fig2dev, imagemagick, netpbm, gtk2 +, pkgconfig +}: + +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"; + }; + + # 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 + pkgconfig + 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..a0442db7fed2 --- /dev/null +++ b/nixpkgs/pkgs/applications/science/electronics/fritzing/default.nix @@ -0,0 +1,46 @@ +{ stdenv, fetchpatch, fetchFromGitHub, qmake, pkgconfig +, qtbase, qtsvg, qtserialport, boost, libgit2 +}: + +stdenv.mkDerivation rec { + pname = "fritzing"; + version = "0.9.3b"; + + src = fetchFromGitHub { + owner = "fritzing"; + repo = "fritzing-app"; + rev = version; + sha256 = "0hpyc550xfhr6gmnc85nq60w00rm0ljm0y744dp0z88ikl04f4s3"; + }; + + parts = fetchFromGitHub { + owner = "fritzing"; + repo = "fritzing-parts"; + rev = version; + sha256 = "1d2v8k7p176j0lczx4vx9n9gbg3vw09n2c4b6w0wj5wqmifywhc1"; + }; + + patches = [(fetchpatch { + name = "0001-Squashed-commit-of-the-following.patch"; + url = "https://aur.archlinux.org/cgit/aur.git/plain/0001-Squashed-commit-of-the-following.patch?h=fritzing"; + sha256 = "1cv6myidxhy28i8m8v13ghzkvx5978p9dcd8v7885y0l1h3108mf"; + })]; + + buildInputs = [ qtbase qtsvg qtserialport boost libgit2 ]; + + nativeBuildInputs = [ qmake pkgconfig ]; + + qmakeFlags = [ "phoenix.pro" ]; + + preConfigure = '' + ln -s "$parts" parts + ''; + + meta = { + description = "An open source prototyping tool for Arduino-based projects"; + homepage = "http://fritzing.org/"; + license = stdenv.lib.licenses.gpl3; + maintainers = [ stdenv.lib.maintainers.robberer ]; + platforms = stdenv.lib.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..54ab7ec57e27 --- /dev/null +++ b/nixpkgs/pkgs/applications/science/electronics/geda/default.nix @@ -0,0 +1,25 @@ +{ stdenv, fetchurl, pkgconfig, guile, gtk2, flex, gawk, perl }: + +stdenv.mkDerivation { + pname = "geda"; + version = "1.8.2-20130925"; + + src = fetchurl { + url = "http://ftp.geda-project.org/geda-gaf/stable/v1.8/1.8.2/geda-gaf-1.8.2.tar.gz"; + sha256 = "08dpa506xk4gjbbi8vnxcb640wq4ihlgmhzlssl52nhvxwx7gx5v"; + }; + + configureFlags = [ + "--disable-update-xdg-database" + ]; + nativeBuildInputs = [ pkgconfig ]; + buildInputs = [ guile gtk2 flex gawk perl ]; + + meta = with stdenv.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..b0317551df8d --- /dev/null +++ b/nixpkgs/pkgs/applications/science/electronics/gerbv/default.nix @@ -0,0 +1,25 @@ +{ stdenv, fetchgit, pkgconfig, gettext, libtool, automake, autoconf, cairo, gtk2, autoreconfHook }: + +stdenv.mkDerivation { + pname = "gerbv"; + version = "2015-10-08"; + + src = fetchgit { + url = "git://git.geda-project.org/gerbv.git"; + rev = "76b8b67bfa10823ce98f1c4c3b49a2afcadf7659"; + sha256 = "00jn1xhf6kblxc5gac1wvk8zm12fy6sk81nj3jwdag0z6wk3z446"; + }; + + nativeBuildInputs = [ autoreconfHook pkgconfig ]; + buildInputs = [ gettext libtool automake autoconf cairo gtk2 ]; + + configureFlags = ["--disable-update-desktop-database"]; + + meta = with stdenv.lib; { + description = "A Gerber (RS-274X) viewer"; + homepage = "http://gerbv.geda-project.org/"; + maintainers = with maintainers; [ mog ]; + platforms = platforms.linux; + license = licenses.gpl2; + }; +} 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..3d75780936e1 --- /dev/null +++ b/nixpkgs/pkgs/applications/science/electronics/gtkwave/default.nix @@ -0,0 +1,29 @@ +{ stdenv, fetchurl, glib, gtk3, gperf, pkgconfig, bzip2, tcl, tk, wrapGAppsHook, judy, xz }: + +stdenv.mkDerivation rec { + pname = "gtkwave"; + version = "3.3.104"; + + src = fetchurl { + url = "mirror://sourceforge/gtkwave/${pname}-gtk3-${version}.tar.gz"; + sha256 = "1qvldbnlp3wkqr5ff93f6pdvv9yzij7lxfhpqlizakz08l1xb391"; + }; + + nativeBuildInputs = [ pkgconfig wrapGAppsHook ]; + buildInputs = [ glib gtk3 gperf bzip2 tcl tk judy xz ]; + + configureFlags = [ + "--with-tcl=${tcl}/lib" + "--with-tk=${tk}/lib" + "--enable-judy" + "--enable-gtk3" + ]; + + meta = { + description = "VCD/Waveform viewer for Unix and Win32"; + homepage = "http://gtkwave.sourceforge.net"; + license = stdenv.lib.licenses.gpl2Plus; + maintainers = with stdenv.lib.maintainers; [ thoughtpolice ]; + platforms = stdenv.lib.platforms.linux; + }; +} 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..6bc665962297 --- /dev/null +++ b/nixpkgs/pkgs/applications/science/electronics/kicad/base.nix @@ -0,0 +1,130 @@ +{ lib, stdenv, fetchFromGitLab, cmake, libGLU, libGL, zlib, wxGTK +, libX11, gettext, glew, glm, cairo, curl, openssl, boost, pkgconfig +, doxygen, pcre, libpthreadstubs, libXdmcp, fetchpatch, lndir, callPackages + +, pname ? "kicad" +, stable ? true +, baseName ? "kicad" +, versions ? { } +, oceSupport ? false, opencascade +, withOCCT ? true, opencascade-occt +, ngspiceSupport ? true, libngspice +, scriptingSupport ? true, swig, python, pythonPackages, wxPython +, debug ? false, valgrind +, withI18n ? true +}: + +assert ngspiceSupport -> libngspice != null; + +with lib; +let + + versionConfig = versions.${baseName}; + baseVersion = "${versions.${baseName}.kicadVersion.version}"; + + # oce on aarch64 fails a test + withOCE = oceSupport && !stdenv.isAarch64; + withOCC = (withOCCT && !withOCE) || (oceSupport && stdenv.isAarch64); + + kicad-libraries = callPackages ./libraries.nix versionConfig.libVersion; + +in +stdenv.mkDerivation rec { + + inherit pname; + version = "base-${baseVersion}"; + + src = fetchFromGitLab ( + { + group = "kicad"; + owner = "code"; + repo = "kicad"; + rev = baseVersion; + } // versionConfig.kicadVersion.src + ); + + # quick fix for #72248 + # should be removed if a a more permanent fix is published + patches = [ + ( + fetchpatch { + url = "https://github.com/johnbeard/kicad/commit/dfb1318a3989e3d6f9f2ac33c924ca5030ea273b.patch"; + sha256 = "00ifd3fas8lid8svzh1w67xc8kyx89qidp7gm633r014j3kjkgcd"; + } + ) + ]; + + # tagged releases don't have "unknown" + # kicad nightlies use git describe --dirty + # nix removes .git, so its approximated here + postPatch = '' + substituteInPlace CMakeModules/KiCadVersion.cmake \ + --replace "unknown" ${builtins.substring 0 10 src.rev} + ''; + + makeFlags = optional (debug) [ "CFLAGS+=-Og" "CFLAGS+=-ggdb" ]; + + cmakeFlags = + optionals (scriptingSupport) [ + "-DKICAD_SCRIPTING=ON" + "-DKICAD_SCRIPTING_MODULES=ON" + "-DKICAD_SCRIPTING_PYTHON3=ON" + "-DKICAD_SCRIPTING_WXPYTHON_PHOENIX=ON" + ] + ++ optional (!scriptingSupport) + "-DKICAD_SCRIPTING=OFF" + ++ optional (ngspiceSupport) "-DKICAD_SPICE=ON" + ++ optional (!withOCE) "-DKICAD_USE_OCE=OFF" + ++ optional (!withOCC) "-DKICAD_USE_OCC=OFF" + ++ optionals (withOCE) [ + "-DKICAD_USE_OCE=ON" + "-DOCE_DIR=${opencascade}" + ] + ++ optionals (withOCC) [ + "-DKICAD_USE_OCC=ON" + "-DOCC_INCLUDE_DIR=${opencascade-occt}/include/opencascade" + ] + ++ optionals (debug) [ + "-DCMAKE_BUILD_TYPE=Debug" + "-DKICAD_STDLIB_DEBUG=ON" + "-DKICAD_USE_VALGRIND=ON" + ] + ; + + nativeBuildInputs = [ cmake doxygen pkgconfig lndir ]; + + buildInputs = [ + libGLU libGL zlib libX11 wxGTK pcre libXdmcp gettext + glew glm libpthreadstubs cairo curl openssl boost + ] + ++ optionals (scriptingSupport) [ swig python wxPython ] + ++ optional (ngspiceSupport) libngspice + ++ optional (withOCE) opencascade + ++ optional (withOCC) opencascade-occt + ++ optional (debug) valgrind + ; + + # debug builds fail all but the python test + # 5.1.x fails the eeschema test + doInstallCheck = !debug && !stable; + installCheckTarget = "test"; + + dontStrip = debug; + + postInstall = optional (withI18n) '' + mkdir -p $out/share + lndir ${kicad-libraries.i18n}/share $out/share + ''; + + meta = { + description = "Just the built source without the libraries"; + longDescription = '' + Just the build products, optionally with the i18n linked in + the libraries are passed via an env var in the wrapper, default.nix + ''; + homepage = "https://www.kicad-pcb.org/"; + license = licenses.agpl3; + maintainers = with maintainers; [ evils kiwi berce ]; + platforms = with platforms; linux; + }; +} 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..f03a0a0cceff --- /dev/null +++ b/nixpkgs/pkgs/applications/science/electronics/kicad/default.nix @@ -0,0 +1,145 @@ +{ lib, stdenv, gnome3, pkgs, wxGTK30, wxGTK31 +, gsettings-desktop-schemas, hicolor-icon-theme +, callPackage, callPackages +, librsvg, cups + +, pname ? "kicad" +, oceSupport ? false, opencascade +, withOCCT ? true, opencascade-occt +, ngspiceSupport ? true, libngspice +, scriptingSupport ? true, swig, python3, python3Packages +, debug ? false, valgrind +, with3d ? true +, withI18n ? true +}: + +assert ngspiceSupport -> libngspice != null; + +with lib; +let + + stable = pname != "kicad-unstable"; + baseName = if (stable) then "kicad" else "kicad-unstable"; + + versions = import ./versions.nix; + versionConfig = versions.${baseName}; + + wxGTK = if (stable) + # wxGTK3x may default to withGtk2 = false, see #73145 + then wxGTK30.override { withGtk2 = false; } + # wxGTK31 currently introduces an issue with opening the python interpreter in pcbnew + # but brings high DPI support? + else wxGTK31.override { withGtk2 = false; }; + + pythonPackages = python3Packages; + python = python3; + wxPython = python3Packages.wxPython_4_0; + + libraries = callPackages ./libraries.nix versionConfig.libVersion; + base = callPackage ./base.nix { + pname = baseName; + inherit versions stable baseName; + inherit wxGTK python wxPython; + inherit debug withI18n withOCCT oceSupport ngspiceSupport scriptingSupport; + }; + +in +stdenv.mkDerivation rec { + + inherit pname; + version = versions.${baseName}.kicadVersion.version; + + src = base; + dontUnpack = true; + dontConfigure = true; + dontBuild = true; + dontFixup = true; + + pythonPath = optionals (scriptingSupport) + [ wxPython pythonPackages.six ]; + + nativeBuildInputs = optionals (scriptingSupport) + [ pythonPackages.wrapPython ]; + + # wrapGAppsHook added the equivalent to ${base}/share + # though i noticed no difference without it + makeWrapperArgs = [ + "--prefix XDG_DATA_DIRS : ${base}/share" + "--prefix XDG_DATA_DIRS : ${hicolor-icon-theme}/share" + "--prefix XDG_DATA_DIRS : ${gnome3.defaultIconTheme}/share" + "--prefix XDG_DATA_DIRS : ${wxGTK.gtk}/share/gsettings-schemas/${wxGTK.gtk.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 : ${gnome3.dconf}/lib/gio/modules" + + "--set KISYSMOD ${libraries.footprints}/share/kicad/modules" + "--set KICAD_SYMBOL_DIR ${libraries.symbols}/share/kicad/library" + "--set KICAD_TEMPLATE_DIR ${libraries.templates}/share/kicad/template" + "--prefix KICAD_TEMPLATE_DIR : ${libraries.symbols}/share/kicad/template" + "--prefix KICAD_TEMPLATE_DIR : ${libraries.footprints}/share/kicad/template" + ] + ++ optionals (with3d) [ "--set KISYS3DMOD ${libraries.packages3d}/share/kicad/modules/packages3d" ] + ++ optionals (ngspiceSupport) [ "--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" ] + ; + + # dunno why i have to add $makeWrapperArgs manually... + # $out and $program_PYTHONPATH don't exist when makeWrapperArgs gets set? + # not sure if anything has to be done with the other stuff in base/bin + # dxf2idf, idf2vrml, idfcyl, idfrect, kicad2step, kicad-ogltest + installPhase = + optionalString (scriptingSupport) '' buildPythonPath "${base} $pythonPath" + '' + + '' makeWrapper ${base}/bin/kicad $out/bin/kicad $makeWrapperArgs '' + + optionalString (scriptingSupport) '' --set PYTHONPATH "$program_PYTHONPATH" + '' + + '' makeWrapper ${base}/bin/pcbnew $out/bin/pcbnew $makeWrapperArgs '' + + optionalString (scriptingSupport) '' --set PYTHONPATH "$program_PYTHONPATH" + '' + + '' makeWrapper ${base}/bin/eeschema $out/bin/eeschema $makeWrapperArgs '' + + optionalString (scriptingSupport) '' --set PYTHONPATH "$program_PYTHONPATH" + '' + + '' makeWrapper ${base}/bin/gerbview $out/bin/gerbview $makeWrapperArgs '' + + optionalString (scriptingSupport) '' --set PYTHONPATH "$program_PYTHONPATH" + '' + + '' makeWrapper ${base}/bin/pcb_calculator $out/bin/pcb_calculator $makeWrapperArgs '' + + optionalString (scriptingSupport) '' --set PYTHONPATH "$program_PYTHONPATH" + '' + + '' makeWrapper ${base}/bin/pl_editor $out/bin/pl_editor $makeWrapperArgs '' + + optionalString (scriptingSupport) '' --set PYTHONPATH "$program_PYTHONPATH" + '' + + '' makeWrapper ${base}/bin/bitmap2component $out/bin/bitmap2component $makeWrapperArgs '' + + optionalString (scriptingSupport) '' --set PYTHONPATH "$program_PYTHONPATH" + '' + ; + + # can't run this for each pname + # stable and unstable are in the same versions.nix + # and kicad-small reuses stable + # with "all" it updates both, run it manually if you don't want that + # and can't git commit if this could be running in parallel with other scripts + passthru.updateScript = [ ./update.sh "all" ]; + + meta = { + description = if (stable) + then "Open Source Electronics Design Automation Suite" + else "Open Source EDA Suite, Development Build"; + homepage = "https://www.kicad-pcb.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 = licenses.agpl3; + # berce seems inactive... + maintainers = with maintainers; [ evils kiwi berce ]; + # kicad's cross-platform, not sure what to fill in here + platforms = with platforms; linux; + } // optionalAttrs with3d { + # We can't download the 3d models on Hydra - they are a ~1 GiB download and + # they occupy ~5 GiB in store. + hydraPlatforms = []; + }; +} 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..7cdf9373e087 --- /dev/null +++ b/nixpkgs/pkgs/applications/science/electronics/kicad/libraries.nix @@ -0,0 +1,61 @@ +{ lib, stdenv, cmake, gettext +, fetchFromGitHub, fetchFromGitLab +, version, libSources +}: + +# callPackage libraries { +# version = "unstable"; +# libs.symbols = { +# rev = "09f9.."; +# sha256 = "..."; +# }; +# }; +with lib; +let + mkLib = name: + stdenv.mkDerivation + { + pname = "kicad-${name}"; + version = "${version}"; + src = fetchFromGitHub ( + { + owner = "KiCad"; + repo = "kicad-${name}"; + rev = version; + inherit name; + } // (libSources.${name} or { }) + ); + nativeBuildInputs = [ cmake ]; + meta.license = licenses.cc-by-sa-40; + }; +in +{ + symbols = mkLib "symbols"; + templates = mkLib "templates"; + footprints = mkLib "footprints"; + packages3d = mkLib "packages3d"; + + # i18n is a special case, not actually a library + # more a part of kicad proper, but also optional and separate + # since their move to gitlab they're keeping it in a separate path + # kicad has no way to find i18n except through a path relative to its install path + # therefore this is being linked into ${kicad-base}/share/ + # and defined here to make use of the rev & sha256's brought here for the libs + i18n = let name = "i18n"; in + stdenv.mkDerivation { + pname = "kicad-${name}"; + version = "${version}"; + src = fetchFromGitLab ( + { + group = "kicad"; + owner = "code"; + repo = "kicad-${name}"; + rev = version; + inherit name; + } // (libSources.${name} or { }) + ); + buildInputs = [ gettext ]; + nativeBuildInputs = [ cmake ]; + meta.license = licenses.gpl2; # https://github.com/KiCad/kicad-i18n/issues/3 + }; +} 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..7dc0b008b6c2 --- /dev/null +++ b/nixpkgs/pkgs/applications/science/electronics/kicad/update.sh @@ -0,0 +1,191 @@ +#!/usr/bin/env nix-shell +#!nix-shell -i bash -p coreutils git nix curl + +# 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? + +# get the latest tag that isn't an RC or *.99 +latest_tag="$(git ls-remote --tags --sort -version:refname \ + https://gitlab.com/kicad/code/kicad.git \ + | grep -o 'refs/tags/[0-9]*\.[0-9]*\.[0-9]*$' \ + | grep -v ".99" | head -n 1 | cut -d '/' -f 3)" + +all_versions=( "${latest_tag}" master ) + +prefetch="nix-prefetch-url --unpack --quiet" + +clean="" +check_stable="" +check_unstable=1 +commit="" + +for arg in "$@"; do + case "${arg}" in + help|-h|--help) echo "Read me!" >&2; exit 1; ;; + kicad|release|tag|stable|*small|5*|6*) check_stable=1; check_unstable="" ;; + all|both|full) check_stable=1; check_unstable=1 ;; + commit) commit=1 ;; + clean|fix|*fuck) check_stable=1; check_unstable=1; clean=1 ;; + master|*unstable|latest|now|today) check_unstable=1 ;; + *) ;; + esac +done + +here="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" +now=$(date --iso-8601) + +file="${here}/versions.nix" +# just in case this runs in parallel +rand="$(head -c 3 /dev/urandom | base64)" +tmp="${here}/,versions.nix.${rand}" + +# libraries currently on github, move to $gitlab/libraries planned +libs=( symbols templates footprints packages3d ) + +get_rev="git ls-remote --heads --tags" + +gitlab="https://gitlab.com/kicad" +# append commit hash or tag +gitlab_pre="https://gitlab.com/api/v4/projects/kicad%2Fcode%2Fkicad/repository/archive.tar.gz?sha=" + +# append "-$lib/archive/[hash or tag].tar.gz +github="https://github.com/kicad/kicad" + +# not a lib, but separate and already moved to gitlab +i18n="${gitlab}/code/kicad-i18n.git" +i18n_pre="https://gitlab.com/api/v4/projects/kicad%2Fcode%2Fkicad-i18n/repository/archive.tar.gz?sha=" + +count=0 + +printf "Latest tag is\t%s\n" "${latest_tag}" >&2 + +if [[ ! -f ${file} ]]; then + echo "No existing file, generating from scratch" >&2 + check_stable=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 + + if [[ ${version} == "master" ]]; then + pname="kicad-unstable" + today="${now}" + else + pname="kicad" + today="${version}" + fi + # skip a version if we don't want to check it + if [[ (${version} != "master" && -n ${check_stable}) \ + || (${version} == "master" && -n ${check_unstable}) ]]; then + + printf "\nChecking %s\n" "${pname}" >&2 + + printf "%2s\"%s\" = {\n" "" "${pname}" + printf "%4skicadVersion = {\n" "" + printf "%6sversion =\t\t\t\"%s\";\n" "" "${today}" + printf "%6ssrc = {\n" "" + + echo "Checking src" >&2 + src_rev="$(${get_rev} "${gitlab}"/code/kicad.git "${version}" | cut -f1)" + ret="$(grep -sm 1 "\"${pname}\"" -A 4 "${file}" | grep -sm 1 "${src_rev}")" + has_hash="$(grep -sm 1 "\"${pname}\"" -A 5 "${file}" | grep -sm 1 "sha256")" + if [[ -n ${ret} && -n ${has_hash} && -z ${clean} ]]; then + echo "Reusing old ${pname}.src.sha256, already latest .rev" >&2 + grep -sm 1 "\"${pname}\"" -A 5 "${file}" | grep -sm 1 "rev" -A 1 + else + printf "%8srev =\t\t\t\"%s\";\n" "" "${src_rev}" + printf "%8ssha256 =\t\t\"%s\";\n" \ + "" "$(${prefetch} "${gitlab_pre}${src_rev}")" + (( count++ )) + fi + printf "%6s};\n" "" + printf "%4s};\n" "" + + printf "%4slibVersion = {\n" "" + printf "%6sversion =\t\t\t\"%s\";\n" "" "${today}" + printf "%6slibSources = {\n" "" + + echo "Checking i18n" >&2 + i18n_rev="$(${get_rev} "${i18n}" "${version}" | cut -f1)" + ret="$(grep -sm 1 "\"${pname}\"" -A 11 "${file}" | grep -sm 1 "${i18n_rev}")" + has_hash="$(grep -sm 1 "\"${pname}\"" -A 12 "${file}" | grep -sm 1 "i18n.sha256")" + if [[ -n ${ret} && -n ${has_hash} && -z ${clean} ]]; then + echo "Reusing old kicad-i18n-${today}.src.sha256, already latest .rev" >&2 + grep -sm 1 "\"${pname}\"" -A 12 "${file}" | grep -sm 1 "i18n" -A 1 + else + printf "%8si18n.rev =\t\t\"%s\";\n" "" "${i18n_rev}" + printf "%8si18n.sha256 =\t\t\"%s\";\n" "" \ + "$(${prefetch} "${i18n_pre}${i18n_rev}")" + (( count++ )) + fi + + for lib in "${libs[@]}"; do + echo "Checking ${lib}" >&2 + url="${github}-${lib}.git" + lib_rev="$(${get_rev} "${url}" "${version}" | cut -f1)" + ret="$(grep -sm 1 "\"${pname}\"" -A 19 "${file}" | grep -sm 1 "${lib_rev}" -A 1)" + has_hash="$(grep -sm 1 "\"${pname}\"" -A 20 "${file}" | grep -sm 1 "${lib}.sha256")" + if [[ -n ${ret} && -n ${has_hash} && -z ${clean} ]]; then + echo "Reusing old kicad-${lib}-${today}.src.sha256, already latest .rev" >&2 + grep -sm 1 "\"${pname}\"" -A 20 "${file}" | grep -sm 1 "${lib}" -A 1 + else + 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}" "$(${prefetch} "${github}-${lib}/archive/${lib_rev}.tar.gz")" + (( count++ )) + fi + done + printf "%6s};\n" "" + printf "%4s};\n" "" + printf "%2s};\n" "" + else + printf "\nReusing old %s\n" "${pname}" >&2 + grep -sm 1 "\"${pname}\"" -A 23 "${file}" + fi +done +printf "}\n" +} > "${tmp}" + +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 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..6b9a981a87c4 --- /dev/null +++ b/nixpkgs/pkgs/applications/science/electronics/kicad/versions.nix @@ -0,0 +1,52 @@ +# This file was generated by update.sh + +{ + "kicad" = { + kicadVersion = { + version = "5.1.5"; + src = { + rev = "52549c5d09cbfb0e807fcbcb07819bc9f7861544"; + sha256 = "15h3rwisjss3fdc9bam9n2wq94slhacc3fbg14bnzf4n5agsnv5b"; + }; + }; + libVersion = { + version = "5.1.5"; + libSources = { + i18n.rev = "5122cbec6563fb7c8d6f960a639ac470353af91b"; + i18n.sha256 = "1rfpifl8vky1gba2angizlb2n7mwmsiai3r6ip6qma60wdj8sbd3"; + symbols.rev = "dd122ec170b49e032179511c9d263126f52f4020"; + symbols.sha256 = "048b07ffsaav1ssrchw2p870lvb4rsyb5vnniy670k7q9p16qq6h"; + templates.rev = "94761f10d06582b33cd55ea2149d72f269f65580"; + templates.sha256 = "0cs3bm3zb5ngw5ldn0lzw5bvqm4kvcidyrn76438alffwiz2b15g"; + footprints.rev = "e076f8f271f8db96d5fec45616b7554caebb7ef7"; + footprints.sha256 = "1c4whgn14qhz4yqkl46w13p6rpv1k0hsc9s9h9368fxfcz9knb2j"; + packages3d.rev = "8d233cdcb109aa1c3b8ba4c934ee31f6a3b6e1f4"; + packages3d.sha256 = "0cff2ms1bsw530kqb1fr1m2pjixyxzwa81mxgac3qpbcf8fnpvaz"; + }; + }; + }; + "kicad-unstable" = { + kicadVersion = { + version = "2020-02-10"; + src = { + rev = "1190e60dd426d246661e478db3287f266ec6cda2"; + sha256 = "0cgfad07j69cks97llj4hf3kga0d5qf728s89xwxrzcwm06k62bi"; + }; + }; + libVersion = { + version = "2020-02-10"; + libSources = { + i18n.rev = "26786c4ca804bad7eb072f1ef381f00b5a2ff3ee"; + i18n.sha256 = "0iqr1xfw4s677afjy9bn5y41z4isp327f9y90wypkxiwwq3dfkfl"; + symbols.rev = "35b7da2d211d7cc036b37ad7f5e40ef03faa1bc7"; + symbols.sha256 = "0wbfw1swbfvfp47cn48pxpqlygjs3xh568ydrrs51v3w102x8y64"; + templates.rev = "0c0490897f803ab8b7c3dad438b7eb1f80e0417c"; + templates.sha256 = "0cs3bm3zb5ngw5ldn0lzw5bvqm4kvcidyrn76438alffwiz2b15g"; + footprints.rev = "9357b6f09312966c57fec9f66a516941d79c3038"; + footprints.sha256 = "0cgah1q0h012ffwfl220k7qb6hgbs0i91spq2j4v3lgpfr4g638d"; + packages3d.rev = "de368eb739abe41dfc3163e0e370477e857f9cc1"; + packages3d.sha256 = "0b3p5v8g24h6l7q3sbqz7ns0gnrf9l89glj86m5ybhizvls9vrrs"; + }; + }; + }; +} 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..7e0894fb337d --- /dev/null +++ b/nixpkgs/pkgs/applications/science/electronics/librepcb/default.nix @@ -0,0 +1,39 @@ +{ lib, mkDerivation, fetchFromGitHub, qtbase, qttools, qmake, wrapQtAppsHook }: + +mkDerivation { + pname = "librepcb"; + version = "0.1.3"; + + src = fetchFromGitHub { + owner = "LibrePCB"; + repo = "LibrePCB"; + fetchSubmodules = true; + rev = "56bc60d347ff67df0fe1d57807d03f0606de557f"; + sha256 = "0z6jn5zawp0x5i9zda7l787jnsv3yl8aqwnpii3g4hsnf2q3hhrh"; + }; + + enableParallelBuilding = true; + + nativeBuildInputs = [ qmake qttools wrapQtAppsHook ]; + + buildInputs = [ qtbase ]; + + qmakeFlags = ["-r"]; + + postInstall = '' + mkdir -p $out/share/librepcb/fontobene + cp share/librepcb/fontobene/newstroke.bene $out/share/librepcb/fontobene/ + ''; + + preFixup = '' + wrapQtApp $out/bin/librepcb + ''; + + meta = with lib; { + description = "A free EDA software to develop printed circuit boards"; + homepage = "https://librepcb.org/"; + maintainers = with maintainers; [ luz ]; + license = licenses.gpl3; + platforms = platforms.linux; + }; +} diff --git a/nixpkgs/pkgs/applications/science/electronics/ngspice/default.nix b/nixpkgs/pkgs/applications/science/electronics/ngspice/default.nix new file mode 100644 index 000000000000..951e5f66f6ee --- /dev/null +++ b/nixpkgs/pkgs/applications/science/electronics/ngspice/default.nix @@ -0,0 +1,25 @@ +{stdenv, fetchurl, bison, flex +, readline, libX11, libICE, libXaw, libXmu, libXext, libXt, fftw }: + +stdenv.mkDerivation rec { + pname = "ngspice"; + version = "31"; + + src = fetchurl { + url = "mirror://sourceforge/ngspice/ngspice-${version}.tar.gz"; + sha256 = "10n2lnfrpsv4vyrirkphr4jwjjhy7i617g6za78dwirfjq63npw4"; + }; + + nativeBuildInputs = [ flex bison ]; + buildInputs = [ readline libX11 libICE libXaw libXmu libXext libXt fftw ]; + + configureFlags = [ "--enable-x" "--with-x" "--with-readline" "--enable-xspice" "--enable-cider" ]; + + meta = with stdenv.lib; { + description = "The Next Generation Spice (Electronic Circuit Simulator)"; + homepage = "http://ngspice.sourceforge.net"; + license = with licenses; [ "BSD" gpl2 ]; + maintainers = with maintainers; [ bgamari rongcuid ]; + platforms = platforms.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..4309f52e8b15 --- /dev/null +++ b/nixpkgs/pkgs/applications/science/electronics/pcb/default.nix @@ -0,0 +1,65 @@ +{ stdenv +, fetchurl +, pkgconfig +, gtk2 +, bison +, intltool +, flex +, netpbm +, imagemagick +, dbus +, xlibsWrapper +, libGLU +, libGL +, shared-mime-info +, tcl +, tk +, gnome2 +, gd +, xorg +}: + +stdenv.mkDerivation rec { + pname = "pcb"; + version = "4.2.2"; + + src = fetchurl { + url = "mirror://sourceforge/pcb/${pname}-${version}.tar.gz"; + sha256 = "0pbfyfadbia1jf9ywkf02j8mfdh8c3mj390c2jdqnl70vcdszvhw"; + }; + + nativeBuildInputs = [ + pkgconfig + bison + intltool + flex + netpbm + imagemagick + ]; + + buildInputs = [ + gtk2 + dbus + xlibsWrapper + libGLU + libGL + tcl + shared-mime-info + tk + gnome2.gtkglext + gd + xorg.libXmu + ]; + + configureFlags = [ + "--disable-update-desktop-database" + ]; + + meta = with stdenv.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/pulseview/default.nix b/nixpkgs/pkgs/applications/science/electronics/pulseview/default.nix new file mode 100644 index 000000000000..f43717389b53 --- /dev/null +++ b/nixpkgs/pkgs/applications/science/electronics/pulseview/default.nix @@ -0,0 +1,30 @@ +{ mkDerivation, lib, fetchurl, pkgconfig, cmake, glib, boost, libsigrok +, libsigrokdecode, libserialport, libzip, udev, libusb1, libftdi1, glibmm +, pcre, librevisa, python3, qtbase, qtsvg +}: + +mkDerivation rec { + pname = "pulseview"; + version = "0.4.1"; + + src = fetchurl { + url = "https://sigrok.org/download/source/pulseview/${pname}-${version}.tar.gz"; + sha256 = "0bvgmkgz37n2bi9niskpl05hf7rsj1lj972fbrgnlz25s4ywxrwy"; + }; + + nativeBuildInputs = [ cmake pkgconfig ]; + + buildInputs = [ + glib boost libsigrok libsigrokdecode libserialport libzip udev libusb1 libftdi1 glibmm + pcre librevisa python3 + qtbase qtsvg + ]; + + 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 ]; + platforms = platforms.linux; + }; +} diff --git a/nixpkgs/pkgs/applications/science/electronics/qfsm/default.nix b/nixpkgs/pkgs/applications/science/electronics/qfsm/default.nix new file mode 100644 index 000000000000..9b6e75c77ba8 --- /dev/null +++ b/nixpkgs/pkgs/applications/science/electronics/qfsm/default.nix @@ -0,0 +1,29 @@ +{ stdenv, fetchurl, qt4, cmake, graphviz, pkgconfig }: + +stdenv.mkDerivation rec { + name = "qfsm-0.54.0"; + + src = fetchurl { + url = "mirror://sourceforge/qfsm/${name}-Source.tar.bz2"; + sha256 = "0rl7bc5cr29ng67yij4akciyid9z7npal812ys4c3m229vjvflrb"; + }; + + nativeBuildInputs = [ pkgconfig ]; + buildInputs = [ qt4 cmake graphviz ]; + + patches = [ + ./drop-hardcoded-prefix.patch + ./gcc6-fixes.patch + ]; + + hardeningDisable = [ "format" ]; + + enableParallelBuilding = true; + + meta = { + description = "Graphical editor for finite state machines"; + homepage = "http://qfsm.sourceforge.net/"; + license = stdenv.lib.licenses.gpl3Plus; + platforms = stdenv.lib.platforms.unix; + }; +} diff --git a/nixpkgs/pkgs/applications/science/electronics/qfsm/drop-hardcoded-prefix.patch b/nixpkgs/pkgs/applications/science/electronics/qfsm/drop-hardcoded-prefix.patch new file mode 100644 index 000000000000..965d67ac5526 --- /dev/null +++ b/nixpkgs/pkgs/applications/science/electronics/qfsm/drop-hardcoded-prefix.patch @@ -0,0 +1,20 @@ +diff -ubrw qfsm-0.53.0-Source-orig/CMakeLists.txt qfsm-0.53.0-Source-new/CMakeLists.txt +--- qfsm-0.53.0-Source-orig/CMakeLists.txt 2012-11-11 20:13:01.935856229 +0100 ++++ qfsm-0.53.0-Source-new/CMakeLists.txt 2012-11-11 20:13:24.962930007 +0100 +@@ -406,10 +406,6 @@ + + + IF(UNIX AND NOT WIN32) +- SET(CMAKE_INSTALL_PREFIX "/usr") +-ENDIF(UNIX AND NOT WIN32) +- +-IF(UNIX AND NOT WIN32) + ADD_DEFINITIONS(-DQFSM_LANGUAGE_DIR="${CMAKE_INSTALL_PREFIX}/share/qfsm/") + ADD_DEFINITIONS(-DQFSM_HELP_DIR="${CMAKE_INSTALL_PREFIX}/share/doc/qfsm/") + ELSE(UNIX AND NOT WIN32) +@@ -472,5 +468,3 @@ + ) + + ENDIF(UNIX AND NOT WIN32) +- +- diff --git a/nixpkgs/pkgs/applications/science/electronics/qfsm/gcc6-fixes.patch b/nixpkgs/pkgs/applications/science/electronics/qfsm/gcc6-fixes.patch new file mode 100644 index 000000000000..5cedc6476397 --- /dev/null +++ b/nixpkgs/pkgs/applications/science/electronics/qfsm/gcc6-fixes.patch @@ -0,0 +1,20 @@ +--- qfsm-0.54.0-Source-orig/src/FileIO.cpp 2015-01-02 19:01:46.000000000 +0100 ++++ qfsm-0.54.0-Source/src/FileIO.cpp 2017-09-11 19:53:30.579488402 +0200 +@@ -1617,7 +1617,7 @@ + QString ext; + + if (!imp) +- return FALSE; ++ return NULL; + + Project* p=NULL; + importdlg->setAcceptMode(QFileDialog::AcceptOpen); +@@ -1641,7 +1641,7 @@ + ifstream fin(act_importfile); + + if (!fin) +- return FALSE; ++ return NULL; + + emit setWaitCursor(); + diff --git a/nixpkgs/pkgs/applications/science/electronics/qucs/cmakelists.patch b/nixpkgs/pkgs/applications/science/electronics/qucs/cmakelists.patch new file mode 100644 index 000000000000..27066f09c84e --- /dev/null +++ b/nixpkgs/pkgs/applications/science/electronics/qucs/cmakelists.patch @@ -0,0 +1,34 @@ +diff --git i/qucs-core/CMakeLists.txt w/qucs-core/CMakeLists.txt +index 2dbbd41..d174b50 100644 +--- i/qucs-core/CMakeLists.txt ++++ w/qucs-core/CMakeLists.txt +@@ -158,26 +158,9 @@ ENDIF() + + # + # Need Bison +-# +-# This is a HACK to get arround a PATH issue with Qt Creator on OSX. +-# It seams impossible to pass a custom PATH to Qt Creator on OSX, ie, cannot prepend `/usr/local/bin/` for intance. +-# The FIND_PACKAGE fails. For now we provide a fallback with a custom FIND_PROGRAM. The variable BISON_DIR is also available. +-IF(WIN32) +- FIND_PACKAGE(BISON 2.4 REQUIRED) +- IF(BISON_FOUND) +- #MESSAGE(STATUS "Found bison: ${BISON_EXECUTABLE} / Version: ${BISON_VERSION}" ) +- ENDIF() +-ELSE() # Linux, OSX +- # use -DBISON_DIR=/path/ to provide the path to bison +- FIND_PROGRAM( BISON_EXECUTABLE bison +- PATHS /usr/local/bin/ /opt/local/bin/ /usr/bin ${BISON_DIR} +- DOC "bison path" +- NO_DEFAULT_PATH ) +- IF(BISON_EXECUTABLE ) +- MESSAGE(STATUS "Found bison: " ${BISON_EXECUTABLE}) +- ELSE() +- MESSAGE(FATAL_ERROR "Unable to find bison. Try to provide -DBISON_DIR=[path]") +- ENDIF() ++FIND_PACKAGE(BISON 2.4 REQUIRED) ++IF(BISON_FOUND) ++ #MESSAGE(STATUS "Found bison: ${BISON_EXECUTABLE} / Version: ${BISON_VERSION}" ) + ENDIF() + + # diff --git a/nixpkgs/pkgs/applications/science/electronics/qucs/default.nix b/nixpkgs/pkgs/applications/science/electronics/qucs/default.nix new file mode 100644 index 000000000000..62a9ae8b73be --- /dev/null +++ b/nixpkgs/pkgs/applications/science/electronics/qucs/default.nix @@ -0,0 +1,29 @@ +{stdenv, fetchFromGitHub, flex, bison, qt4, libX11, cmake, gperf, adms }: + +stdenv.mkDerivation rec { + version = "0.0.19"; + pname = "qucs"; + + src = fetchFromGitHub { + owner = "Qucs"; + repo = "qucs"; + rev = "qucs-${version}"; + sha256 = "106h3kjyg7c0hkmzkin7h8fcl32n60835121b2qqih8ixi6r5id6"; + }; + + QTDIR=qt4; + + patches = [ + ./cmakelists.patch + ]; + + buildInputs = [ flex bison qt4 libX11 cmake gperf adms ]; + + meta = { + description = "Integrated circuit simulator"; + homepage = "http://qucs.sourceforge.net"; + license = stdenv.lib.licenses.gpl2Plus; + maintainers = with stdenv.lib.maintainers; [viric]; + platforms = with stdenv.lib.platforms; linux; + }; +} 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..e6f912616034 --- /dev/null +++ b/nixpkgs/pkgs/applications/science/electronics/tkgate/1.x.nix @@ -0,0 +1,42 @@ +{ stdenv, fetchurl, tcl, tk, libX11, glibc, which, yacc, flex, imake, xorgproto, gccmakedep }: + +let + libiconvInc = stdenv.lib.optionalString stdenv.isLinux "${glibc.dev}/include"; + libiconvLib = stdenv.lib.optionalString stdenv.isLinux "${glibc.out}/lib"; +in +stdenv.mkDerivation rec { + name = "tkgate-1.8.7"; + + src = fetchurl { + url = "http://www.tkgate.org/downloads/${name}.tgz"; + sha256 = "1pqywkidfpdbj18i03h97f4cimld4fb3mqfy8jjsxs12kihm18fs"; + }; + + nativeBuildInputs = [ which yacc 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 = stdenv.lib.licenses.gpl2Plus; + maintainers = [ stdenv.lib.maintainers.peti ]; + hydraPlatforms = stdenv.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..dd6c5a09851e --- /dev/null +++ b/nixpkgs/pkgs/applications/science/electronics/verilator/default.nix @@ -0,0 +1,22 @@ +{ stdenv, fetchurl, perl, flex, bison }: + +stdenv.mkDerivation rec { + pname = "verilator"; + version = "4.032"; + + src = fetchurl { + url = "https://www.veripool.org/ftp/${pname}-${version}.tgz"; + sha256 = "1l3rhgw7pk59dz7dyhcl0iygn6c9rv9bv131rfzg66asxfwbfq1s"; + }; + + enableParallelBuilding = true; + buildInputs = [ perl flex bison ]; + + meta = { + description = "Fast and robust (System)Verilog simulator/compiler"; + homepage = "https://www.veripool.org/wiki/verilator"; + license = stdenv.lib.licenses.lgpl3; + platforms = stdenv.lib.platforms.unix; + maintainers = with stdenv.lib.maintainers; [ thoughtpolice ]; + }; +} 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..fa1efe299829 --- /dev/null +++ b/nixpkgs/pkgs/applications/science/electronics/verilog/default.nix @@ -0,0 +1,40 @@ +{ stdenv, fetchFromGitHub, autoconf, gperf, flex, bison, readline, ncurses +, bzip2, zlib +}: + +stdenv.mkDerivation rec { + pname = "iverilog"; + version = "unstable-2019-08-01"; + + src = fetchFromGitHub { + owner = "steveicarus"; + repo = pname; + rev = "c383d2048c0bd15f5db083f14736400546fb6215"; + sha256 = "1zs0gyhws0qa315magz3w5m45v97knczdgbf2zn4d7bdb7cv417c"; + }; + + enableParallelBuilding = true; + + prePatch = '' + substituteInPlace configure.in \ + --replace "AC_CHECK_LIB(termcap, tputs)" "AC_CHECK_LIB(termcap, tputs)" + ''; + + preConfigure = '' + chmod +x $PWD/autoconf.sh + $PWD/autoconf.sh + ''; + + nativeBuildInputs = [ autoconf gperf flex bison ]; + + buildInputs = [ readline ncurses bzip2 zlib ]; + + meta = with stdenv.lib; { + description = "Icarus Verilog compiler"; + repositories.git = "https://github.com/steveicarus/iverilog.git"; + homepage = "http://iverilog.icarus.com/"; + license = licenses.lgpl21; + maintainers = with maintainers; [ winden ]; + platforms = platforms.all; + }; +} 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..52fe9b037414 --- /dev/null +++ b/nixpkgs/pkgs/applications/science/electronics/xcircuit/default.nix @@ -0,0 +1,35 @@ +{ stdenv, fetchurl, autoreconfHook, automake, pkgconfig +, cairo, ghostscript, ngspice, tcl, tk, xorg, zlib }: + +let + version = "3.10.12"; + name = "xcircuit-${version}"; + inherit (stdenv.lib) getBin; + +in stdenv.mkDerivation { + inherit name version; + + src = fetchurl { + url = "http://opencircuitdesign.com/xcircuit/archive/${name}.tgz"; + sha256 = "1h1ywc3mr7plvwnhdii2zgnnv5ih2nhyl4qbdjpi83dq0aq1s2mn"; + }; + + nativeBuildInputs = [ autoreconfHook automake pkgconfig ]; + hardeningDisable = [ "format" ]; + + configureFlags = [ + "--with-tcl=${tcl}/lib" + "--with-tk=${tk}/lib" + "--with-ngspice=${getBin ngspice}/bin/ngspice" + ]; + + buildInputs = with xorg; [ cairo ghostscript libSM libXt libICE libX11 libXpm tcl tk zlib ]; + + meta = with stdenv.lib; { + description = "Generic drawing program tailored to circuit diagrams"; + homepage = "http://opencircuitdesign.com/xcircuit"; + license = licenses.gpl2; + platforms = platforms.linux; + maintainers = with maintainers; [ 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..f8a68f31f464 --- /dev/null +++ b/nixpkgs/pkgs/applications/science/electronics/xoscope/default.nix @@ -0,0 +1,24 @@ +{stdenv, fetchurl, gtk2, pkgconfig}: + +stdenv.mkDerivation rec { + name = "xoscope-2.0"; + + src = fetchurl { + url = "mirror://sourceforge/xoscope/${name}.tgz"; + sha256 = "00xlvvqyw6l1ljbsx1vgx2v1jfh0xacz1a0yhq1dj6yxf5wh58x8"; + }; + + nativeBuildInputs = [ pkgconfig ]; + buildInputs = [ gtk2 ]; + + # from: https://aur.archlinux.org/packages.php?ID=12140&detail=1 + patches = [ ./gtkdepre.diff ]; + + meta = { + description = "Oscilloscope through the sound card"; + homepage = "http://xoscope.sourceforge.net"; + license = stdenv.lib.licenses.gpl2Plus; + maintainers = with stdenv.lib.maintainers; [viric]; + platforms = with stdenv.lib.platforms; linux; + }; +} diff --git a/nixpkgs/pkgs/applications/science/electronics/xoscope/gtkdepre.diff b/nixpkgs/pkgs/applications/science/electronics/xoscope/gtkdepre.diff new file mode 100644 index 000000000000..993df9cb5503 --- /dev/null +++ b/nixpkgs/pkgs/applications/science/electronics/xoscope/gtkdepre.diff @@ -0,0 +1,58 @@ +diff -ru xoscope-2.0-old//gtkdatabox-0.6.0.0/gtk/gtkdatabox.c xoscope-2.0/gtkdatabox-0.6.0.0/gtk/gtkdatabox.c +--- xoscope-2.0-old//gtkdatabox-0.6.0.0/gtk/gtkdatabox.c 2010-06-07 10:42:24.000000000 +0200 ++++ xoscope-2.0/gtkdatabox-0.6.0.0/gtk/gtkdatabox.c 2010-06-07 10:45:40.000000000 +0200 +@@ -661,7 +661,7 @@ + static void + gtk_databox_calculate_hcanvas (GtkDatabox *box) + { +- if (!GTK_WIDGET_VISIBLE (box)) ++ if (!gtk_widget_get_visible (box)) + return; + + if (box->priv->adjX->page_size == 1.0) +@@ -698,7 +698,7 @@ + static void + gtk_databox_calculate_vcanvas (GtkDatabox *box) + { +- if (!GTK_WIDGET_VISIBLE (box)) ++ if (!gtk_widget_get_visible (box)) + return; + + if (box->priv->adjY->page_size == 1.0) +@@ -780,7 +780,7 @@ + gtk_databox_draw (box, event); + + gdk_draw_drawable (widget->window, +- widget->style->fg_gc[GTK_WIDGET_STATE (widget)], ++ widget->style->fg_gc[gtk_widget_get_state (widget)], + box->priv->canvas.pixmap, event->area.x, event->area.y, + event->area.x, event->area.y, event->area.width, + event->area.height); +@@ -940,7 +940,7 @@ + GtkWidget *widget = GTK_WIDGET (box); + + g_return_if_fail (GTK_IS_DATABOX (box)); +- g_return_if_fail (GTK_WIDGET_VISIBLE (widget)); ++ g_return_if_fail (gtk_widget_get_visible (widget)); + + gdk_draw_rectangle (box->priv->canvas.pixmap, widget->style->bg_gc[0], + TRUE, 0, 0, +@@ -1150,7 +1150,7 @@ + /* Copy a part of the pixmap to the screen */ + if (pixmapCopyRect) + gdk_draw_drawable (widget->window, +- widget->style->fg_gc[GTK_WIDGET_STATE (box)], ++ widget->style->fg_gc[gtk_widget_get_state (box)], + box->priv->canvas.pixmap, + pixmapCopyRect->x, + pixmapCopyRect->y, +--- xoscope-2.0-old//gtkdatabox-0.6.0.0/gtk/Makefile.in 2011-09-02 16:43:43.000000000 +0200 ++++ xoscope-2.0/gtkdatabox-0.6.0.0/gtk/Makefile.in 2011-09-02 16:43:57.000000000 +0200 +@@ -196,7 +196,6 @@ + -DG_DISABLE_DEPRECATED\ + -DGDK_DISABLE_DEPRECATED\ + -DGDK_PIXBUF_DISABLE_DEPRECATED\ +- -DGTK_DISABLE_DEPRECATED\ + `pkg-config gtk+-2.0 --cflags` + + all: all-am |