2020-10-11 00:37:15 +02:00
|
|
|
{ stdenv
|
|
|
|
, fetchFromGitLab
|
2020-10-10 21:50:41 +02:00
|
|
|
, gnome3
|
|
|
|
, wxGTK30
|
|
|
|
, wxGTK31
|
2020-07-21 08:52:04 +02:00
|
|
|
, makeWrapper
|
2020-10-10 21:50:41 +02:00
|
|
|
, gsettings-desktop-schemas
|
|
|
|
, hicolor-icon-theme
|
|
|
|
, callPackage
|
|
|
|
, callPackages
|
|
|
|
, librsvg
|
|
|
|
, cups
|
2019-11-05 04:15:14 +01:00
|
|
|
|
2019-12-14 17:01:15 +01:00
|
|
|
, pname ? "kicad"
|
2020-03-28 01:39:57 +01:00
|
|
|
, stable ? true
|
2020-10-10 21:50:41 +02:00
|
|
|
, oceSupport ? false
|
2020-10-10 23:44:56 +02:00
|
|
|
, withOCE ? false
|
2020-10-10 21:50:41 +02:00
|
|
|
, opencascade
|
2020-10-10 23:44:56 +02:00
|
|
|
, withOCCT ? false
|
|
|
|
, withOCC ? true
|
2020-10-10 21:50:41 +02:00
|
|
|
, opencascade-occt
|
2020-10-10 23:44:56 +02:00
|
|
|
, ngspiceSupport ? false
|
|
|
|
, withNgspice ? true
|
2020-10-10 21:50:41 +02:00
|
|
|
, libngspice
|
2020-10-10 23:44:56 +02:00
|
|
|
, scriptingSupport ? false
|
|
|
|
, withScripting ? true
|
2020-10-10 21:50:41 +02:00
|
|
|
, swig
|
|
|
|
, python3
|
|
|
|
, debug ? false
|
|
|
|
, valgrind
|
2019-11-05 04:15:14 +01:00
|
|
|
, with3d ? true
|
2019-12-15 04:30:15 +01:00
|
|
|
, withI18n ? true
|
2018-07-26 14:47:07 +02:00
|
|
|
}:
|
2010-08-31 10:19:28 +02:00
|
|
|
|
2020-10-10 23:44:56 +02:00
|
|
|
assert withNgspice -> libngspice != null;
|
|
|
|
assert stdenv.lib.assertMsg (!ngspiceSupport)
|
|
|
|
"`nspiceSupport` was renamed to `withNgspice` for the sake of consistency with other kicad nix arguments.";
|
|
|
|
assert stdenv.lib.assertMsg (!oceSupport)
|
|
|
|
"`oceSupport` was renamed to `withOCE` for the sake of consistency with other kicad nix arguments.";
|
|
|
|
assert stdenv.lib.assertMsg (!scriptingSupport)
|
|
|
|
"`scriptingSupport` was renamed to `withScripting` for the sake of consistency with other kicad nix arguments.";
|
|
|
|
assert stdenv.lib.assertMsg (!withOCCT)
|
|
|
|
"`withOCCT` was renamed to `withOCC` for the sake of consistency with upstream cmake options.";
|
2019-03-11 16:54:13 +01:00
|
|
|
let
|
2019-12-15 12:26:23 +01:00
|
|
|
baseName = if (stable) then "kicad" else "kicad-unstable";
|
2019-12-15 04:30:15 +01:00
|
|
|
|
2020-10-10 21:50:41 +02:00
|
|
|
versions = import ./versions.nix;
|
2019-12-15 12:26:23 +01:00
|
|
|
versionConfig = versions.${baseName};
|
2019-12-15 04:30:15 +01:00
|
|
|
|
2020-10-10 21:50:41 +02:00
|
|
|
wxGTK =
|
|
|
|
if (stable)
|
2019-12-15 04:30:15 +01:00
|
|
|
# wxGTK3x may default to withGtk2 = false, see #73145
|
2020-10-10 21:50:41 +02:00
|
|
|
then
|
|
|
|
wxGTK30.override
|
|
|
|
{
|
|
|
|
withGtk2 = false;
|
|
|
|
}
|
2019-12-15 04:30:15 +01:00
|
|
|
# wxGTK31 currently introduces an issue with opening the python interpreter in pcbnew
|
|
|
|
# but brings high DPI support?
|
2020-10-10 21:50:41 +02:00
|
|
|
else
|
|
|
|
wxGTK31.override {
|
|
|
|
withGtk2 = false;
|
|
|
|
};
|
2019-12-15 04:30:15 +01:00
|
|
|
|
|
|
|
python = python3;
|
2020-07-21 08:52:04 +02:00
|
|
|
wxPython = python.pkgs.wxPython_4_0;
|
2019-12-14 17:01:15 +01:00
|
|
|
|
2020-10-11 00:37:15 +02:00
|
|
|
inherit (stdenv.lib) concatStringsSep flatten optionalString optionals;
|
2020-03-30 06:13:59 +02:00
|
|
|
in
|
|
|
|
stdenv.mkDerivation rec {
|
|
|
|
|
|
|
|
passthru.libraries = callPackages ./libraries.nix versionConfig.libVersion;
|
2020-01-12 16:45:35 +01:00
|
|
|
base = callPackage ./base.nix {
|
2019-12-15 12:26:23 +01:00
|
|
|
inherit versions stable baseName;
|
|
|
|
inherit wxGTK python wxPython;
|
2020-10-10 23:44:56 +02:00
|
|
|
inherit debug withI18n withOCC withOCE withNgspice withScripting;
|
2019-12-15 04:30:15 +01:00
|
|
|
};
|
|
|
|
|
2019-12-14 17:01:15 +01:00
|
|
|
inherit pname;
|
2019-12-15 12:26:23 +01:00
|
|
|
version = versions.${baseName}.kicadVersion.version;
|
2019-11-05 04:15:14 +01:00
|
|
|
|
2020-01-12 16:45:35 +01:00
|
|
|
src = base;
|
2019-12-15 12:26:23 +01:00
|
|
|
dontUnpack = true;
|
|
|
|
dontConfigure = true;
|
|
|
|
dontBuild = true;
|
|
|
|
dontFixup = true;
|
2018-07-31 15:37:59 +02:00
|
|
|
|
2020-10-10 23:44:56 +02:00
|
|
|
pythonPath = optionals (withScripting)
|
2020-07-21 08:52:04 +02:00
|
|
|
[ wxPython python.pkgs.six ];
|
2018-07-31 15:37:59 +02:00
|
|
|
|
2020-07-21 08:52:04 +02:00
|
|
|
nativeBuildInputs = [ makeWrapper ]
|
2020-10-10 23:44:56 +02:00
|
|
|
++ optionals (withScripting)
|
2020-10-10 21:50:41 +02:00
|
|
|
[ python.pkgs.wrapPython ];
|
2019-03-11 16:54:13 +01:00
|
|
|
|
2020-10-10 23:49:46 +02:00
|
|
|
# We are emulating wrapGAppsHook, along with other variables to the
|
|
|
|
# wrapper
|
2020-03-30 06:13:59 +02:00
|
|
|
makeWrapperArgs = with passthru.libraries; [
|
2020-01-12 16:45:35 +01:00
|
|
|
"--prefix XDG_DATA_DIRS : ${base}/share"
|
2019-11-05 04:15:14 +01: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 04:53:28 +01:00
|
|
|
# wrapGAppsHook did these two as well, no idea if it matters...
|
2019-11-05 04:15:14 +01:00
|
|
|
"--prefix XDG_DATA_DIRS : ${cups}/share"
|
|
|
|
"--prefix GIO_EXTRA_MODULES : ${gnome3.dconf}/lib/gio/modules"
|
2019-12-06 04:53:28 +01:00
|
|
|
|
2020-03-30 06:13:59 +02: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 04:15:14 +01:00
|
|
|
]
|
2020-03-30 06:13:59 +02:00
|
|
|
++ optionals (with3d) [ "--set KISYS3DMOD ${packages3d}/share/kicad/modules/packages3d" ]
|
2020-10-10 23:44:56 +02:00
|
|
|
++ optionals (withNgspice) [ "--prefix LD_LIBRARY_PATH : ${libngspice}/lib" ]
|
2019-12-06 04:53:28 +01:00
|
|
|
|
2019-11-05 04:15:14 +01: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 15:37:59 +02:00
|
|
|
|
2020-04-05 21:23:36 +02:00
|
|
|
# why does $makeWrapperArgs have to be added explicitly?
|
2019-12-15 04:30:15 +01:00
|
|
|
# $out and $program_PYTHONPATH don't exist when makeWrapperArgs gets set?
|
2020-04-05 21:23:36 +02:00
|
|
|
# kicad-ogltest's source seems to indicate that crashing is expected behaviour...
|
2020-10-11 00:37:15 +02:00
|
|
|
installPhase =
|
2020-04-05 21:23:36 +02:00
|
|
|
let
|
|
|
|
tools = [ "kicad" "pcbnew" "eeschema" "gerbview" "pcb_calculator" "pl_editor" "bitmap2component" ];
|
|
|
|
utils = [ "dxf2idf" "idf2vrml" "idfcyl" "idfrect" "kicad2step" "kicad-ogltest" ];
|
|
|
|
in
|
2020-10-10 21:50:41 +02:00
|
|
|
(concatStringsSep "\n"
|
|
|
|
(flatten [
|
2020-10-10 23:44:56 +02:00
|
|
|
(optionalString (withScripting) "buildPythonPath \"${base} $pythonPath\" \n")
|
2020-04-05 21:23:36 +02:00
|
|
|
|
|
|
|
# wrap each of the directly usable tools
|
2020-10-10 21:50:41 +02:00
|
|
|
(map
|
|
|
|
(tool: "makeWrapper ${base}/bin/${tool} $out/bin/${tool} $makeWrapperArgs"
|
2020-10-10 23:44:56 +02:00
|
|
|
+ optionalString (withScripting) " --set PYTHONPATH \"$program_PYTHONPATH\""
|
2020-10-10 21:50:41 +02:00
|
|
|
)
|
|
|
|
tools)
|
2020-04-05 21:23:36 +02:00
|
|
|
|
|
|
|
# link in the CLI utils
|
2020-10-10 21:50:41 +02:00
|
|
|
(map (util: "ln -s ${base}/bin/${util} $out/bin/${util}") utils)
|
2020-04-05 21:23:36 +02:00
|
|
|
])
|
|
|
|
)
|
2019-11-05 04:15:14 +01:00
|
|
|
;
|
2016-03-31 04:26:54 +02:00
|
|
|
|
2020-01-04 11:34:52 +01: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 01:39:57 +01:00
|
|
|
meta = rec {
|
|
|
|
description = (if (stable)
|
2020-10-10 21:50:41 +02:00
|
|
|
then "Open Source Electronics Design Automation suite"
|
|
|
|
else "Open Source EDA suite, development build")
|
|
|
|
+ (if (!with3d) then ", without 3D models" else "");
|
2019-12-06 04:53:28 +01: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.
|
|
|
|
'';
|
2020-10-11 00:37:15 +02:00
|
|
|
license = stdenv.lib.licenses.agpl3;
|
2019-12-15 04:30:15 +01:00
|
|
|
# berce seems inactive...
|
2020-03-28 01:39:57 +01: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 14:09:47 +02:00
|
|
|
};
|
|
|
|
}
|