2019-12-15 03:30:15 +00:00
|
|
|
{ lib, stdenv, gnome3, pkgs, wxGTK30, wxGTK31
|
|
|
|
, gsettings-desktop-schemas, hicolor-icon-theme
|
|
|
|
, callPackage, callPackages
|
|
|
|
, librsvg, cups
|
2019-11-05 03:15:14 +00:00
|
|
|
|
2019-12-14 16:01:15 +00:00
|
|
|
, pname ? "kicad"
|
2020-03-28 00:39:57 +00:00
|
|
|
, stable ? true
|
2019-11-26 11:02:49 +00:00
|
|
|
, oceSupport ? false, opencascade
|
|
|
|
, withOCCT ? true, opencascade-occt
|
2018-07-26 13:47:07 +01:00
|
|
|
, ngspiceSupport ? true, libngspice
|
2019-12-15 03:30:15 +00:00
|
|
|
, scriptingSupport ? true, swig, python3, python3Packages
|
2019-11-05 03:15:14 +00:00
|
|
|
, debug ? false, valgrind
|
|
|
|
, with3d ? true
|
2019-12-15 03:30:15 +00:00
|
|
|
, withI18n ? true
|
2018-07-26 13:47:07 +01:00
|
|
|
}:
|
2010-08-31 09:19:28 +01:00
|
|
|
|
2018-07-26 13:47:07 +01:00
|
|
|
assert ngspiceSupport -> libngspice != null;
|
2016-03-31 03:26:54 +01:00
|
|
|
|
2018-07-26 13:47:07 +01:00
|
|
|
with lib;
|
2019-03-11 15:54:13 +00:00
|
|
|
let
|
2019-12-15 03:30:15 +00:00
|
|
|
|
2019-12-15 11:26:23 +00:00
|
|
|
baseName = if (stable) then "kicad" else "kicad-unstable";
|
2019-12-15 03:30:15 +00:00
|
|
|
|
2020-01-04 10:34:52 +00:00
|
|
|
versions = import ./versions.nix;
|
2019-12-15 11:26:23 +00:00
|
|
|
versionConfig = versions.${baseName};
|
2019-12-15 03:30:15 +00:00
|
|
|
|
|
|
|
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;
|
2019-12-14 16:01:15 +00:00
|
|
|
|
2020-03-30 05:13:59 +01:00
|
|
|
in
|
|
|
|
stdenv.mkDerivation rec {
|
|
|
|
|
|
|
|
passthru.libraries = callPackages ./libraries.nix versionConfig.libVersion;
|
2020-01-12 15:45:35 +00:00
|
|
|
base = callPackage ./base.nix {
|
2019-12-15 11:26:23 +00:00
|
|
|
inherit versions stable baseName;
|
|
|
|
inherit wxGTK python wxPython;
|
|
|
|
inherit debug withI18n withOCCT oceSupport ngspiceSupport scriptingSupport;
|
2019-12-15 03:30:15 +00:00
|
|
|
};
|
|
|
|
|
2019-12-14 16:01:15 +00:00
|
|
|
inherit pname;
|
2019-12-15 11:26:23 +00:00
|
|
|
version = versions.${baseName}.kicadVersion.version;
|
2019-11-05 03:15:14 +00:00
|
|
|
|
2020-01-12 15:45:35 +00:00
|
|
|
src = base;
|
2019-12-15 11:26:23 +00:00
|
|
|
dontUnpack = true;
|
|
|
|
dontConfigure = true;
|
|
|
|
dontBuild = true;
|
|
|
|
dontFixup = true;
|
2018-07-31 14:37:59 +01:00
|
|
|
|
2019-12-15 03:30:15 +00:00
|
|
|
pythonPath = optionals (scriptingSupport)
|
|
|
|
[ wxPython pythonPackages.six ];
|
2018-07-31 14:37:59 +01:00
|
|
|
|
2019-12-15 03:30:15 +00:00
|
|
|
nativeBuildInputs = optionals (scriptingSupport)
|
|
|
|
[ pythonPackages.wrapPython ];
|
2019-03-11 15:54:13 +00:00
|
|
|
|
2020-01-12 15:45:35 +00:00
|
|
|
# wrapGAppsHook added the equivalent to ${base}/share
|
2019-12-15 03:30:15 +00:00
|
|
|
# though i noticed no difference without it
|
2020-03-30 05:13:59 +01:00
|
|
|
makeWrapperArgs = with passthru.libraries; [
|
2020-01-12 15:45:35 +00:00
|
|
|
"--prefix XDG_DATA_DIRS : ${base}/share"
|
2019-11-05 03:15:14 +00:00
|
|
|
"--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}"
|
2019-12-06 03:53:28 +00:00
|
|
|
# wrapGAppsHook did these two as well, no idea if it matters...
|
2019-11-05 03:15:14 +00:00
|
|
|
"--prefix XDG_DATA_DIRS : ${cups}/share"
|
|
|
|
"--prefix GIO_EXTRA_MODULES : ${gnome3.dconf}/lib/gio/modules"
|
2019-12-06 03:53:28 +00:00
|
|
|
|
2020-03-30 05:13:59 +01:00
|
|
|
"--set KISYSMOD ${footprints}/share/kicad/modules"
|
|
|
|
"--set KICAD_SYMBOL_DIR ${symbols}/share/kicad/library"
|
|
|
|
"--set KICAD_TEMPLATE_DIR ${templates}/share/kicad/template"
|
|
|
|
"--prefix KICAD_TEMPLATE_DIR : ${symbols}/share/kicad/template"
|
|
|
|
"--prefix KICAD_TEMPLATE_DIR : ${footprints}/share/kicad/template"
|
2019-11-05 03:15:14 +00:00
|
|
|
]
|
2020-03-30 05:13:59 +01:00
|
|
|
++ optionals (with3d) [ "--set KISYS3DMOD ${packages3d}/share/kicad/modules/packages3d" ]
|
2019-12-15 11:26:23 +00:00
|
|
|
++ optionals (ngspiceSupport) [ "--prefix LD_LIBRARY_PATH : ${libngspice}/lib" ]
|
2019-12-06 03:53:28 +00:00
|
|
|
|
2019-11-05 03:15:14 +00:00
|
|
|
# infinisil's workaround for #39493
|
|
|
|
++ [ "--set GDK_PIXBUF_MODULE_FILE ${librsvg}/lib/gdk-pixbuf-2.0/2.10.0/loaders.cache" ]
|
|
|
|
;
|
2018-07-31 14:37:59 +01:00
|
|
|
|
2019-12-15 03:30:15 +00:00
|
|
|
# dunno why i have to add $makeWrapperArgs manually...
|
|
|
|
# $out and $program_PYTHONPATH don't exist when makeWrapperArgs gets set?
|
2020-01-12 15:45:35 +00:00
|
|
|
# not sure if anything has to be done with the other stuff in base/bin
|
2019-12-15 03:30:15 +00:00
|
|
|
# dxf2idf, idf2vrml, idfcyl, idfrect, kicad2step, kicad-ogltest
|
|
|
|
installPhase =
|
2020-01-12 15:45:35 +00:00
|
|
|
optionalString (scriptingSupport) '' buildPythonPath "${base} $pythonPath"
|
2019-11-05 03:15:14 +00:00
|
|
|
'' +
|
2020-01-12 15:45:35 +00:00
|
|
|
'' makeWrapper ${base}/bin/kicad $out/bin/kicad $makeWrapperArgs ''
|
2019-11-05 03:15:14 +00:00
|
|
|
+ optionalString (scriptingSupport) '' --set PYTHONPATH "$program_PYTHONPATH"
|
|
|
|
'' +
|
2020-01-12 15:45:35 +00:00
|
|
|
'' makeWrapper ${base}/bin/pcbnew $out/bin/pcbnew $makeWrapperArgs ''
|
2019-11-05 03:15:14 +00:00
|
|
|
+ optionalString (scriptingSupport) '' --set PYTHONPATH "$program_PYTHONPATH"
|
|
|
|
'' +
|
2020-01-12 15:45:35 +00:00
|
|
|
'' makeWrapper ${base}/bin/eeschema $out/bin/eeschema $makeWrapperArgs ''
|
2019-11-05 03:15:14 +00:00
|
|
|
+ optionalString (scriptingSupport) '' --set PYTHONPATH "$program_PYTHONPATH"
|
|
|
|
'' +
|
2020-01-12 15:45:35 +00:00
|
|
|
'' makeWrapper ${base}/bin/gerbview $out/bin/gerbview $makeWrapperArgs ''
|
2019-11-05 03:15:14 +00:00
|
|
|
+ optionalString (scriptingSupport) '' --set PYTHONPATH "$program_PYTHONPATH"
|
|
|
|
'' +
|
2020-01-12 15:45:35 +00:00
|
|
|
'' makeWrapper ${base}/bin/pcb_calculator $out/bin/pcb_calculator $makeWrapperArgs ''
|
2019-11-05 03:15:14 +00:00
|
|
|
+ optionalString (scriptingSupport) '' --set PYTHONPATH "$program_PYTHONPATH"
|
|
|
|
'' +
|
2020-01-12 15:45:35 +00:00
|
|
|
'' makeWrapper ${base}/bin/pl_editor $out/bin/pl_editor $makeWrapperArgs ''
|
2019-11-05 03:15:14 +00:00
|
|
|
+ optionalString (scriptingSupport) '' --set PYTHONPATH "$program_PYTHONPATH"
|
|
|
|
'' +
|
2020-01-12 15:45:35 +00:00
|
|
|
'' makeWrapper ${base}/bin/bitmap2component $out/bin/bitmap2component $makeWrapperArgs ''
|
2019-11-05 03:15:14 +00:00
|
|
|
+ optionalString (scriptingSupport) '' --set PYTHONPATH "$program_PYTHONPATH"
|
|
|
|
''
|
|
|
|
;
|
2016-03-31 03:26:54 +01:00
|
|
|
|
2020-01-04 10:34:52 +00:00
|
|
|
# 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" ];
|
|
|
|
|
2020-03-28 00:39:57 +00:00
|
|
|
meta = rec {
|
|
|
|
description = (if (stable)
|
|
|
|
then "Open Source Electronics Design Automation suite"
|
|
|
|
else "Open Source EDA suite, development build")
|
|
|
|
+ (if (!with3d) then ", without 3D models" else "");
|
2019-12-06 03:53:28 +00:00
|
|
|
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;
|
2019-12-15 03:30:15 +00:00
|
|
|
# berce seems inactive...
|
2020-03-28 00:39:57 +00:00
|
|
|
maintainers = with stdenv.lib.maintainers; [ evils kiwi berce ];
|
|
|
|
# kicad is cross platform
|
|
|
|
platforms = stdenv.lib.platforms.all;
|
|
|
|
# despite that, nipkgs' wxGTK for darwin is "wxmac"
|
|
|
|
# and wxPython_4_0 does not account for this
|
|
|
|
# adjusting this package to downgrade to python2Packages.wxPython (wxPython 3),
|
|
|
|
# seems like more trouble than fixing wxPython_4_0 would be
|
|
|
|
# additionally, libngspice is marked as linux only, though it should support darwin
|
|
|
|
|
|
|
|
hydraPlatforms = if (with3d) then [ ] else platforms;
|
|
|
|
# We can't download the 3d models on Hydra,
|
|
|
|
# they are a ~1 GiB download and they occupy ~5 GiB in store.
|
|
|
|
# as long as the base and libraries (minus 3d) are build,
|
|
|
|
# this wrapper does not need to get built
|
|
|
|
# the kicad-*small "packages" cause this to happen
|
2010-08-22 13:09:47 +01:00
|
|
|
};
|
|
|
|
}
|