@@ -0,0 +1,54 @@
1+{ wxGTK, lib, stdenv, fetchFromGitHub, cmake, mesa, zlib
2+, libX11, gettext, glew, glm, cairo, curl, openssl, boost, pkgconfig
3+, doxygen, pcre, libpthreadstubs, libXdmcp
4+
5+, oceSupport ? true, opencascade_oce
6+, ngspiceSupport ? true, ngspice
7+, scriptingSupport ? true, swig, python, wxPython
8+}:
9+
10+with lib;
11+stdenv.mkDerivation rec {
12+ name = "kicad-unstable-${version}";
13+ version = "2017-12-11";
14+
15+ src = fetchFromGitHub {
16+ owner = "KICad";
17+ repo = "kicad-source-mirror";
18+ rev = "1955f252265c38a313f6c595d6c4c637f38fd316";
19+ sha256 = "15cc81h7nh5dk6gj6mc4ylcgdznfriilhb43n1g3xwyq3s8iaibz";
20+ };
21+
22+ postPatch = ''
23+ substituteInPlace CMakeModules/KiCadVersion.cmake \
24+ --replace no-vcs-found ${version}
25+ '';
26+
27+ cmakeFlags =
28+ optionals (oceSupport) [ "-DKICAD_USE_OCE=ON" "-DOCE_DIR=${opencascade_oce}" ]
29+ ++ optional (ngspiceSupport) "-DKICAD_SPICE=ON"
30+ ++ optionals (scriptingSupport) [
31+ "-DKICAD_SCRIPTING=ON"
32+ "-DKICAD_SCRIPTING_MODULES=ON"
33+ "-DKICAD_SCRIPTING_WXPYTHON=ON"
34+ # nix installs wxPython headers in wxPython package, not in wxwidget
35+ # as assumed. We explicitely set the header location.
36+ "-DCMAKE_CXX_FLAGS=-I${wxPython}/include/wx-3.0"
37+ ];
38+
39+ nativeBuildInputs = [ cmake doxygen pkgconfig ];
40+ buildInputs = [
41+ mesa zlib libX11 wxGTK pcre libXdmcp gettext glew glm libpthreadstubs
42+ cairo curl openssl boost
43+ ] ++ optional (oceSupport) opencascade_oce
44+ ++ optional (ngspiceSupport) ngspice
45+ ++ optionals (scriptingSupport) [ swig python wxPython ];
46+
47+ meta = {
48+ description = "Free Software EDA Suite, Nightly Development Build";
49+ homepage = http://www.kicad-pcb.org/;
50+ license = licenses.gpl2;
51+ maintainers = with maintainers; [ berce ];
52+ platforms = with platforms; linux;
53+ };
54+}