about summary refs log tree commit diff
path: root/nixpkgs/pkgs/applications/science/electronics
diff options
context:
space:
mode:
authorAlyssa Ross <hi@alyssa.is>2019-01-07 02:18:36 +0000
committerAlyssa Ross <hi@alyssa.is>2019-01-07 02:18:47 +0000
commit36f56d99fa0a0765c9f1de4a5f17a9b05830c3f2 (patch)
treeb3faaf573407b32aa645237a4d16b82778a39a92 /nixpkgs/pkgs/applications/science/electronics
parent4e31070265257dc67d120c27e0f75c2344fdfa9a (diff)
parentabf060725d7614bd3b9f96764262dfbc2f9c2199 (diff)
downloadnixlib-36f56d99fa0a0765c9f1de4a5f17a9b05830c3f2.tar
nixlib-36f56d99fa0a0765c9f1de4a5f17a9b05830c3f2.tar.gz
nixlib-36f56d99fa0a0765c9f1de4a5f17a9b05830c3f2.tar.bz2
nixlib-36f56d99fa0a0765c9f1de4a5f17a9b05830c3f2.tar.lz
nixlib-36f56d99fa0a0765c9f1de4a5f17a9b05830c3f2.tar.xz
nixlib-36f56d99fa0a0765c9f1de4a5f17a9b05830c3f2.tar.zst
nixlib-36f56d99fa0a0765c9f1de4a5f17a9b05830c3f2.zip
Add 'nixpkgs/' from commit 'abf060725d7614bd3b9f96764262dfbc2f9c2199'
git-subtree-dir: nixpkgs
git-subtree-mainline: 4e31070265257dc67d120c27e0f75c2344fdfa9a
git-subtree-split: abf060725d7614bd3b9f96764262dfbc2f9c2199
Diffstat (limited to 'nixpkgs/pkgs/applications/science/electronics')
-rw-r--r--nixpkgs/pkgs/applications/science/electronics/adms/default.nix26
-rw-r--r--nixpkgs/pkgs/applications/science/electronics/alliance/default.nix75
-rw-r--r--nixpkgs/pkgs/applications/science/electronics/archimedes/default.nix17
-rw-r--r--nixpkgs/pkgs/applications/science/electronics/bitscope/common.nix64
-rw-r--r--nixpkgs/pkgs/applications/science/electronics/bitscope/packages.nix146
-rw-r--r--nixpkgs/pkgs/applications/science/electronics/caneda/default.nix26
-rw-r--r--nixpkgs/pkgs/applications/science/electronics/caneda/gcc6.patch13
-rw-r--r--nixpkgs/pkgs/applications/science/electronics/dsview/default.nix47
-rw-r--r--nixpkgs/pkgs/applications/science/electronics/dsview/install.patch15
-rw-r--r--nixpkgs/pkgs/applications/science/electronics/dsview/libsigrok4dsl.nix28
-rw-r--r--nixpkgs/pkgs/applications/science/electronics/dsview/libsigrokdecode4dsl.nix27
-rw-r--r--nixpkgs/pkgs/applications/science/electronics/eagle/eagle.nix83
-rw-r--r--nixpkgs/pkgs/applications/science/electronics/eagle/eagle7.nix97
-rw-r--r--nixpkgs/pkgs/applications/science/electronics/eagle/eagle7_fixer.c134
-rw-r--r--nixpkgs/pkgs/applications/science/electronics/fritzing/default.nix46
-rw-r--r--nixpkgs/pkgs/applications/science/electronics/geda/default.nix25
-rw-r--r--nixpkgs/pkgs/applications/science/electronics/gerbv/default.nix25
-rw-r--r--nixpkgs/pkgs/applications/science/electronics/gtkwave/default.nix24
-rw-r--r--nixpkgs/pkgs/applications/science/electronics/kicad/default.nix72
-rw-r--r--nixpkgs/pkgs/applications/science/electronics/kicad/unstable.nix56
-rw-r--r--nixpkgs/pkgs/applications/science/electronics/librepcb/default.nix35
-rw-r--r--nixpkgs/pkgs/applications/science/electronics/ngspice/default.nix24
-rw-r--r--nixpkgs/pkgs/applications/science/electronics/pcb/default.nix31
-rw-r--r--nixpkgs/pkgs/applications/science/electronics/pulseview/default.nix30
-rw-r--r--nixpkgs/pkgs/applications/science/electronics/qfsm/default.nix29
-rw-r--r--nixpkgs/pkgs/applications/science/electronics/qfsm/drop-hardcoded-prefix.patch20
-rw-r--r--nixpkgs/pkgs/applications/science/electronics/qfsm/gcc6-fixes.patch20
-rw-r--r--nixpkgs/pkgs/applications/science/electronics/qucs/cmakelists.patch34
-rw-r--r--nixpkgs/pkgs/applications/science/electronics/qucs/default.nix29
-rw-r--r--nixpkgs/pkgs/applications/science/electronics/tkgate/1.x.nix42
-rw-r--r--nixpkgs/pkgs/applications/science/electronics/verilator/default.nix26
-rw-r--r--nixpkgs/pkgs/applications/science/electronics/verilog/default.nix29
-rw-r--r--nixpkgs/pkgs/applications/science/electronics/xcircuit/default.nix35
-rw-r--r--nixpkgs/pkgs/applications/science/electronics/xoscope/default.nix24
-rw-r--r--nixpkgs/pkgs/applications/science/electronics/xoscope/gtkdepre.diff58
35 files changed, 1512 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..236225959f7a
--- /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";
+  name = "adms-${version}";
+
+  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..97d1db83a162
--- /dev/null
+++ b/nixpkgs/pkgs/applications/science/electronics/alliance/default.nix
@@ -0,0 +1,75 @@
+{ stdenv, fetchurl
+, xproto, motif, libX11, libXt, libXpm, bison
+, flex, automake, autoconf, libtool
+}:
+
+stdenv.mkDerivation rec {
+  name = "alliance-${version}";
+  version = "5.1.1";
+
+  src = fetchurl {
+    url = "http://www-asim.lip6.fr/pub/alliance/distribution/5.0/${name}.tar.bz2";
+    sha256 = "046c9qwl1vbww0ljm4xyxf5jpz9nq62b2q0wdz9xjimgh4c207w1";
+  };
+
+
+  nativeBuildInputs = [ libtool automake autoconf flex ];
+  buildInputs = [ xproto motif xproto libX11 libXt libXpm bison ];
+
+  sourceRoot = "alliance/src/";
+
+  configureFlags = [
+    "--prefix=$(out)"
+    "--disable-static"
+  ];
+
+  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 = ''
+    #!${stdenv.shell}
+    cp -v -r -n --no-preserve=mode  $out/etc/* /etc/ > /etc/alliance-install.log
+  '';
+
+  allianceUnInstaller = ''
+    #!${stdenv.shell}
+    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..016760bde020
--- /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..64777b5a0ac8
--- /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..58e01f4f9f49
--- /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 rec {
+    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..8f81a03044be
--- /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 {
+  name = "caneda-${version}";
+  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..af3844f47312
--- /dev/null
+++ b/nixpkgs/pkgs/applications/science/electronics/dsview/default.nix
@@ -0,0 +1,47 @@
+{ stdenv, fetchFromGitHub, pkgconfig, cmake, autoreconfHook,
+glib, libzip, boost, fftw, qtbase,
+libusb, makeWrapper, libsigrok4dsl, libsigrokdecode4dsl
+}:
+
+stdenv.mkDerivation rec {
+  name = "dsview-${version}";
+
+  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 makeWrapper ];
+
+  buildInputs = [
+   boost fftw qtbase libusb libzip libsigrokdecode4dsl libsigrok4dsl
+  ];
+
+  enableParallelBuilding = true;
+
+  postFixup = ''
+    wrapProgram $out/bin/DSView --suffix QT_PLUGIN_PATH : \
+      ${qtbase.bin}/${qtbase.qtPluginPrefix}
+  '';
+
+  meta = with stdenv.lib; {
+    description = "A GUI program for supporting various instruments from DreamSourceLab, including logic analyzer, oscilloscope, etc";
+    homepage = http://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..4a681907e192
--- /dev/null
+++ b/nixpkgs/pkgs/applications/science/electronics/dsview/libsigrok4dsl.nix
@@ -0,0 +1,28 @@
+{ stdenv, pkgconfig, autoreconfHook,
+glib, libzip, libserialport, check, libusb, libftdi,
+systemd, alsaLib, dsview
+}:
+
+stdenv.mkDerivation rec {
+  inherit (dsview) version src;
+
+  name = "libsigrok4dsl-${version}";
+
+  postUnpack = ''
+    export sourceRoot=$sourceRoot/libsigrok4DSL
+  '';
+
+  nativeBuildInputs = [ pkgconfig autoreconfHook ];
+
+  buildInputs = [
+    glib libzip libserialport libusb libftdi systemd check alsaLib
+  ];
+
+  meta = with stdenv.lib; {
+    description = "A fork of the sigrok library for usage with DSView";
+    homepage = http://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..58f32f2ae6cc
--- /dev/null
+++ b/nixpkgs/pkgs/applications/science/electronics/dsview/libsigrokdecode4dsl.nix
@@ -0,0 +1,27 @@
+{ stdenv, pkgconfig, autoreconfHook,
+glib, check, python3, dsview
+}:
+
+stdenv.mkDerivation rec {
+  inherit (dsview) version src;
+
+  name = "libsigrokdecode4dsl-${version}";
+
+  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 = http://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..b97ede413963
--- /dev/null
+++ b/nixpkgs/pkgs/applications/science/electronics/eagle/eagle.nix
@@ -0,0 +1,83 @@
+{ stdenv, fetchurl, makeDesktopItem, patchelf
+, libXrender, libXrandr, libXcursor, libX11, libXext, libXi, libxcb
+, cups , 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
+  stdenv.mkDerivation rec {
+    name = "eagle-${version}";
+    version = "9.1.2";
+
+    src = fetchurl {
+      url = "https://eagle-updates.circuits.io/downloads/${builtins.replaceStrings ["."] ["_"] version}/Autodesk_EAGLE_${version}_English_Linux_64bit.tar.gz";
+      sha256 = "0y7ahl9z5a7l9cjk8hzmyv6ga8chlry5rr8v116q5mnsgs4i11an";
+    };
+
+    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
+      ];
+
+    doConfigure = false;
+    doBuild = false;
+
+    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..d5720440f7cc
--- /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
+}:
+
+let
+
+  libPath = stdenv.lib.makeLibraryPath
+    [ zlib freetype fontconfig openssl libXrender libXrandr libXcursor libX11
+      libXext libXi libxcb cups
+    ];
+
+in
+
+stdenv.mkDerivation rec {
+  name = "eagle-${version}";
+  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
+    #!${stdenv.shell}
+    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/fritzing/default.nix b/nixpkgs/pkgs/applications/science/electronics/fritzing/default.nix
new file mode 100644
index 000000000000..ab5088543102
--- /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 {
+  name = "fritzing-${version}";
+  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..93fe7b6ba77a
--- /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 rec {
+  name = "geda-${version}";
+  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..c0821c8a9ab9
--- /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 rec {
+  name = "gerbv-${version}";
+  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..214a918fa348
--- /dev/null
+++ b/nixpkgs/pkgs/applications/science/electronics/gtkwave/default.nix
@@ -0,0 +1,24 @@
+{stdenv, fetchurl, gtk2, gperf, pkgconfig, bzip2, tcl, tk, judy, xz}:
+
+stdenv.mkDerivation rec {
+  name = "gtkwave-${version}";
+  version = "3.3.97";
+
+  src = fetchurl {
+    url    = "mirror://sourceforge/gtkwave/${name}.tar.gz";
+    sha256 = "0jy5qk0b0np9xsxgnvv8jjgyw81l170wrm5q04qs48wpw7d0rm3v";
+  };
+
+  nativeBuildInputs = [ pkgconfig ];
+  buildInputs = [ gtk2 gperf bzip2 tcl tk judy xz ];
+
+  configureFlags = [ "--with-tcl=${tcl}/lib" "--with-tk=${tk}/lib" "--enable-judy" ];
+
+  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/default.nix b/nixpkgs/pkgs/applications/science/electronics/kicad/default.nix
new file mode 100644
index 000000000000..5d0165eb6dda
--- /dev/null
+++ b/nixpkgs/pkgs/applications/science/electronics/kicad/default.nix
@@ -0,0 +1,72 @@
+{ wxGTK, lib, stdenv, fetchurl, cmake, libGLU_combined, zlib
+, libX11, gettext, glew, glm, cairo, curl, openssl, boost, pkgconfig
+, doxygen, pcre, libpthreadstubs, libXdmcp
+, wrapGAppsHook
+, oceSupport ? true, opencascade
+, ngspiceSupport ? true, libngspice
+, swig, python, pythonPackages
+}:
+
+assert ngspiceSupport -> libngspice != null;
+
+with lib;
+stdenv.mkDerivation rec {
+  name = "kicad-${version}";
+  series = "5.0";
+  version = "5.0.1";
+
+  src = fetchurl {
+    url = "https://launchpad.net/kicad/${series}/${version}/+download/kicad-${version}.tar.xz";
+    sha256 = "0skig2wdxxc2677m8a8m1xrg3pkhqiqnmkcyr2hv0b2j30rzdr2z";
+  };
+
+  postPatch = ''
+    substituteInPlace CMakeModules/KiCadVersion.cmake \
+      --replace no-vcs-found ${version}
+  '';
+
+  cmakeFlags = [
+    "-DKICAD_SCRIPTING=ON"
+    "-DKICAD_SCRIPTING_MODULES=ON"
+    "-DKICAD_SCRIPTING_WXPYTHON=ON"
+    # nix installs wxPython headers in wxPython package, not in wxwidget
+    # as assumed. We explicitely set the header location.
+    "-DCMAKE_CXX_FLAGS=-I${pythonPackages.wxPython}/include/wx-3.0"
+  ] ++ optionals (oceSupport) [ "-DKICAD_USE_OCE=ON" "-DOCE_DIR=${opencascade}" ]
+    ++ optional (ngspiceSupport) "-DKICAD_SPICE=ON";
+
+  nativeBuildInputs = [
+    cmake
+    doxygen
+    pkgconfig
+    wrapGAppsHook
+    pythonPackages.wrapPython
+  ];
+  pythonPath = [ pythonPackages.wxPython ];
+  propagatedBuildInputs = [ pythonPackages.wxPython ];
+
+  buildInputs = [
+    libGLU_combined zlib libX11 wxGTK pcre libXdmcp gettext glew glm libpthreadstubs
+    cairo curl openssl boost
+    swig python
+  ] ++ optional (oceSupport) opencascade
+    ++ optional (ngspiceSupport) libngspice;
+
+  # this breaks other applications in kicad
+  dontWrapGApps = true;
+
+  preFixup = ''
+    buildPythonPath "$out $pythonPath"
+    gappsWrapperArgs+=(--set PYTHONPATH "$program_PYTHONPATH")
+
+    wrapProgram "$out/bin/kicad" "''${gappsWrapperArgs[@]}"
+  '';
+
+  meta = {
+    description = "Free Software EDA Suite";
+    homepage = http://www.kicad-pcb.org/;
+    license = licenses.gpl2;
+    maintainers = with maintainers; [ berce ];
+    platforms = with platforms; linux;
+  };
+}
diff --git a/nixpkgs/pkgs/applications/science/electronics/kicad/unstable.nix b/nixpkgs/pkgs/applications/science/electronics/kicad/unstable.nix
new file mode 100644
index 000000000000..a9a4c32a0b45
--- /dev/null
+++ b/nixpkgs/pkgs/applications/science/electronics/kicad/unstable.nix
@@ -0,0 +1,56 @@
+{ wxGTK, lib, stdenv, fetchFromGitHub, cmake, libGLU_combined, zlib
+, libX11, gettext, glew, glm, cairo, curl, openssl, boost, pkgconfig
+, doxygen, pcre, libpthreadstubs, libXdmcp
+
+, oceSupport ? true, opencascade
+, ngspiceSupport ? true, libngspice
+, scriptingSupport ? true, swig, python, wxPython
+}:
+
+assert ngspiceSupport -> libngspice != null;
+
+with lib;
+stdenv.mkDerivation rec {
+  name = "kicad-unstable-${version}";
+  version = "2018-06-12";
+
+  src = fetchFromGitHub {
+    owner = "KICad";
+    repo = "kicad-source-mirror";
+    rev = "bc7bd107d980da147ad515aeae0469ddd55c2368";
+    sha256 = "11nsx52pd3jr2wbzr11glmcs1a9r7z1mqkqx6yvlm0awbgd8qlv8";
+  };
+
+  postPatch = ''
+    substituteInPlace CMakeModules/KiCadVersion.cmake \
+      --replace no-vcs-found ${version}
+  '';
+
+  cmakeFlags =
+    optionals (oceSupport) [ "-DKICAD_USE_OCE=ON" "-DOCE_DIR=${opencascade}" ]
+    ++ optional (ngspiceSupport) "-DKICAD_SPICE=ON"
+    ++ optionals (scriptingSupport) [
+      "-DKICAD_SCRIPTING=ON"
+      "-DKICAD_SCRIPTING_MODULES=ON"
+      "-DKICAD_SCRIPTING_WXPYTHON=ON"
+      # nix installs wxPython headers in wxPython package, not in wxwidget
+      # as assumed. We explicitely set the header location.
+      "-DCMAKE_CXX_FLAGS=-I${wxPython}/include/wx-3.0"
+    ];
+
+  nativeBuildInputs = [ cmake doxygen pkgconfig ];
+  buildInputs = [
+    libGLU_combined zlib libX11 wxGTK pcre libXdmcp gettext glew glm libpthreadstubs
+    cairo curl openssl boost
+  ] ++ optional (oceSupport) opencascade
+    ++ optional (ngspiceSupport) libngspice
+    ++ optionals (scriptingSupport) [ swig python wxPython ];
+
+  meta = {
+    description = "Free Software EDA Suite, Nightly Development Build";
+    homepage = http://www.kicad-pcb.org/;
+    license = licenses.gpl2;
+    maintainers = with maintainers; [ berce ];
+    platforms = with platforms; linux;
+  };
+}
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..bc6e5e33ea24
--- /dev/null
+++ b/nixpkgs/pkgs/applications/science/electronics/librepcb/default.nix
@@ -0,0 +1,35 @@
+{ stdenv, fetchFromGitHub, qtbase, qttools, qmake }:
+
+stdenv.mkDerivation rec {
+  name = "librepcb-${version}";
+  version = "0.1.0";
+
+  src = fetchFromGitHub {
+    owner = "LibrePCB";
+    repo = "LibrePCB";
+    fetchSubmodules = true;
+    rev = "d7458d3b3e126499902e1a66a0ef889f516a7c97";
+    sha256 = "19wh0398fzzpd65nh4mmc4jllkrgcrwxvxdby0gb5wh1sqyaqac4";
+  };
+
+  enableParallelBuilding = true;
+
+  nativeBuildInputs = [ qmake qttools ];
+
+  buildInputs = [ qtbase ];
+
+  qmakeFlags = ["-r"];
+
+  postInstall = ''
+      mkdir -p $out/share/librepcb/fontobene
+      cp share/librepcb/fontobene/newstroke.bene $out/share/librepcb/fontobene/
+    '';
+
+  meta = with stdenv.lib; {
+    description = "A free EDA software to develop printed circuit boards";
+    homepage = http://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..4777c89e876b
--- /dev/null
+++ b/nixpkgs/pkgs/applications/science/electronics/ngspice/default.nix
@@ -0,0 +1,24 @@
+{stdenv, fetchurl, bison, flex
+, readline, libX11, libICE, libXaw, libXmu, libXext, libXt, fftw }:
+
+stdenv.mkDerivation {
+  name = "ngspice-29";
+
+  src = fetchurl {
+    url = "mirror://sourceforge/ngspice/ngspice-29.tar.gz";
+    sha256 = "0jjwz73naq7l9yhwdqbpnrfckywp2ffkppivxjv8w92zq7xhyvcd";
+  };
+
+  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..b9bbcd695f17
--- /dev/null
+++ b/nixpkgs/pkgs/applications/science/electronics/pcb/default.nix
@@ -0,0 +1,31 @@
+{ stdenv, fetchurl, pkgconfig, gtk2, bison, intltool, flex
+, netpbm, imagemagick, dbus, xlibsWrapper, libGLU_combined
+, shared-mime-info, tcl, tk, gnome2, pangox_compat, gd, xorg
+}:
+
+stdenv.mkDerivation rec {
+  name = "pcb-${version}";
+  version = "20140316";
+
+  src = fetchurl {
+    url = "http://ftp.geda-project.org/pcb/pcb-20140316/${name}.tar.gz";
+    sha256 = "0l6944hq79qsyp60i5ai02xwyp8l47q7xdm3js0jfkpf72ag7i42";
+  };
+
+  nativeBuildInputs = [ pkgconfig ];
+  buildInputs = [
+    gtk2 bison intltool flex netpbm imagemagick dbus xlibsWrapper
+    libGLU_combined tcl shared-mime-info tk
+    gnome2.gtkglext pangox_compat 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..4e86d1d917f8
--- /dev/null
+++ b/nixpkgs/pkgs/applications/science/electronics/pulseview/default.nix
@@ -0,0 +1,30 @@
+{ stdenv, fetchurl, pkgconfig, cmake, glib, boost, libsigrok
+, libsigrokdecode, libserialport, libzip, udev, libusb1, libftdi1, glibmm
+, pcre, librevisa, python3, qtbase, qtsvg
+}:
+
+stdenv.mkDerivation rec {
+  name = "pulseview-0.4.0";
+
+  src = fetchurl {
+    url = "https://sigrok.org/download/source/pulseview/${name}.tar.gz";
+    sha256 = "1f8f2342d5yam98mmcb8f9g2vslcwv486bmi4x45pxn68l82ky3q";
+  };
+
+  nativeBuildInputs = [ cmake pkgconfig ];
+
+  buildInputs = [
+    glib boost libsigrok libsigrokdecode libserialport libzip udev libusb1 libftdi1 glibmm
+    pcre librevisa python3 qtbase qtsvg
+  ];
+
+  enableParallelBuilding = true;
+
+  meta = with stdenv.lib; {
+    description = "Qt-based LA/scope/MSO GUI for sigrok (a signal analysis software suite)";
+    homepage = https://sigrok.org/;
+    license = licenses.gpl3Plus;
+    platforms = platforms.linux;
+    maintainers = [ maintainers.bjornfor ];
+  };
+}
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..6ca3f80cefd3
--- /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..1a5fbf90d10b
--- /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";
+  name = "qucs-${version}";
+
+  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..ab2b75917b92
--- /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, xproto, 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 xproto ];
+  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..fdee3e013ded
--- /dev/null
+++ b/nixpkgs/pkgs/applications/science/electronics/verilator/default.nix
@@ -0,0 +1,26 @@
+{ stdenv, fetchurl, perl, flex, bison }:
+
+stdenv.mkDerivation rec {
+  name    = "verilator-${version}";
+  version = "4.008";
+
+  src = fetchurl {
+    url    = "https://www.veripool.org/ftp/${name}.tgz";
+    sha256 = "1b0cj7bb2a3hrfaziix7p9idcpbygapdl0nrfr3pbdxxsgnzdknm";
+  };
+
+  enableParallelBuilding = true;
+  buildInputs = [ perl flex bison ];
+
+  postInstall = ''
+    sed -i -e '3a\#!/usr/bin/env perl' -e '1,3d' $out/bin/{verilator,verilator_coverage,verilator_profcfunc}
+  '';
+
+  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..c4268b54c20b
--- /dev/null
+++ b/nixpkgs/pkgs/applications/science/electronics/verilog/default.nix
@@ -0,0 +1,29 @@
+{ stdenv, fetchFromGitHub, autoconf, gperf, flex, bison }:
+
+stdenv.mkDerivation rec {
+  name = "iverilog-${version}";
+  version = "2018.12.15";
+
+  src = fetchFromGitHub {
+    owner = "steveicarus";
+    repo = "iverilog";
+    rev = "7cd078e7ab184069b3b458fe6df7e83962254816";
+    sha256 = "1zc7lsa77dbsxjfz7vdgclmg97r0kw08xss7yfs4vyv5v5gnn98d";
+  };
+
+  patchPhase = ''
+    chmod +x $PWD/autoconf.sh
+    $PWD/autoconf.sh
+  '';
+
+  buildInputs = [ autoconf gperf flex bison ];
+
+  meta = {
+    description = "Icarus Verilog compiler";
+    repositories.git = https://github.com/steveicarus/iverilog.git;
+    homepage = http://www.icarus.com;
+    license = stdenv.lib.licenses.gpl2Plus;
+    maintainers = with stdenv.lib.maintainers; [winden];
+    platforms = with stdenv.lib.platforms; linux;
+  };
+}
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..418144e6af7b
--- /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.9.73";
+  name = "xcircuit-${version}";
+  inherit (stdenv.lib) getBin;
+
+in stdenv.mkDerivation {
+  inherit name version;
+
+  src = fetchurl {
+    url = "http://opencircuitdesign.com/xcircuit/archive/${name}.tgz";
+    sha256 = "1kj9hayipplzm4960kx48vxddqj154qnxkccaqj9cnkp62b7q3jg";
+  };
+
+  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 = [ maintainers.spacefrogg ];
+  };
+}
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..829caacb55cb
--- /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