nixpkgs/pkgs/applications/science/electronics/kicad/default.nix

176 lines
7.0 KiB
Nix
Raw Normal View History

2019-12-14 19:30:15 -08:00
{ lib, stdenv, gnome3, pkgs, wxGTK30, wxGTK31
, gsettings-desktop-schemas, hicolor-icon-theme
, callPackage, callPackages
, librsvg, cups
2019-11-04 19:15:14 -08:00
, pname ? "kicad"
, oceSupport ? false, opencascade
, withOCCT ? true, opencascade-occt
2018-07-26 05:47:07 -07:00
, ngspiceSupport ? true, libngspice
2019-12-14 19:30:15 -08:00
, scriptingSupport ? true, swig, python3, python3Packages
2019-11-04 19:15:14 -08:00
, debug ? false, valgrind
, with3d ? true
2019-12-14 19:30:15 -08:00
, withI18n ? true
2018-07-26 05:47:07 -07:00
}:
2018-07-26 05:47:07 -07:00
assert ngspiceSupport -> libngspice != null;
2016-03-30 19:26:54 -07:00
2018-07-26 05:47:07 -07:00
with lib;
let
2019-12-14 19:30:15 -08:00
stable = pname != "kicad-unstable";
baseName = if (stable) then "kicad" else "kicad-unstable";
2019-12-14 19:30:15 -08:00
versions = {
"kicad" = {
kicadVersion = {
version = "5.1.5";
src.sha256 = "15h3rwisjss3fdc9bam9n2wq94slhacc3fbg14bnzf4n5agsnv5b";
};
libVersion = {
version = "5.1.5";
libSources = {
i18n.sha256 = "1rfpifl8vky1gba2angizlb2n7mwmsiai3r6ip6qma60wdj8sbd3";
symbols.sha256 = "048b07ffsaav1ssrchw2p870lvb4rsyb5vnniy670k7q9p16qq6h";
templates.sha256 = "0cs3bm3zb5ngw5ldn0lzw5bvqm4kvcidyrn76438alffwiz2b15g";
footprints.sha256 = "1c4whgn14qhz4yqkl46w13p6rpv1k0hsc9s9h9368fxfcz9knb2j";
packages3d.sha256 = "0cff2ms1bsw530kqb1fr1m2pjixyxzwa81mxgac3qpbcf8fnpvaz";
};
};
};
"kicad-unstable" = {
kicadVersion = {
version = "2019-12-31";
src = {
rev = "eaaa4eb63acb289047dfbb6cc275579dea58f12b";
sha256 = "1v2hf2slphjdh14y56pmzlpi6mqidrd8198if1fi0cch72v37zch";
};
};
libVersion = {
version = "unstable";
libSources = {
i18n.rev = "e7439fd76f27cfc26e269c4e6c4d56245345c28b";
i18n.sha256 = "1nqm1kx5b4f7s0f9q8bg4rdhqnp0128yp6bgnrkia1kwmfnf5gmy";
symbols.rev = "1bc5ff11c76bcbfda227e534b0acf737edddde8f";
symbols.sha256 = "05kv93790wi4dpbn2488p587b83yz1zw9h62lkv41h7vn2r1mmb7";
templates.rev = "0c0490897f803ab8b7c3dad438b7eb1f80e0417c";
templates.sha256 = "0cs3bm3zb5ngw5ldn0lzw5bvqm4kvcidyrn76438alffwiz2b15g";
footprints.rev = "454126c125edd3fa8633f301421a7d9c4de61b77";
footprints.sha256 = "00nli4kx2i68bk852rivbirzcgpsdlpdk34g1q892952jsbh7fy6";
packages3d.rev = "c2b92a411adc93ddeeed74b36b542e1057f81a2a";
packages3d.sha256 = "05znc6y2lc31iafspg308cxdda94zg6c7mwslmys76npih1pb8qc";
};
};
};
};
versionConfig = versions.${baseName};
2019-12-14 19:30:15 -08: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;
kicad-libraries = callPackages ./libraries.nix versionConfig.libVersion;
2019-12-14 19:30:15 -08:00
kicad-base = callPackage ./base.nix {
pname = baseName;
inherit versions stable baseName;
inherit wxGTK python wxPython;
inherit debug withI18n withOCCT oceSupport ngspiceSupport scriptingSupport;
2019-12-14 19:30:15 -08:00
};
2019-11-04 19:15:14 -08:00
in
stdenv.mkDerivation rec {
2016-03-30 19:26:54 -07:00
inherit pname;
version = versions.${baseName}.kicadVersion.version;
2019-11-04 19:15:14 -08:00
2019-12-14 19:30:15 -08:00
src = kicad-base;
dontUnpack = true;
dontConfigure = true;
dontBuild = true;
dontFixup = true;
2018-07-31 06:37:59 -07:00
2019-12-14 19:30:15 -08:00
pythonPath = optionals (scriptingSupport)
[ wxPython pythonPackages.six ];
2018-07-31 06:37:59 -07:00
2019-12-14 19:30:15 -08:00
nativeBuildInputs = optionals (scriptingSupport)
[ pythonPackages.wrapPython ];
2019-12-14 19:30:15 -08:00
# wrapGAppsHook added the equivalent to ${kicad-base}/share
# though i noticed no difference without it
2019-11-04 19:15:14 -08:00
makeWrapperArgs = [
2019-12-14 19:30:15 -08:00
"--prefix XDG_DATA_DIRS : ${kicad-base}/share"
2019-11-04 19:15:14 -08: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}"
# wrapGAppsHook did these two as well, no idea if it matters...
2019-11-04 19:15:14 -08:00
"--prefix XDG_DATA_DIRS : ${cups}/share"
"--prefix GIO_EXTRA_MODULES : ${gnome3.dconf}/lib/gio/modules"
"--set KISYSMOD ${kicad-libraries.footprints}/share/kicad/modules"
"--set KICAD_SYMBOL_DIR ${kicad-libraries.symbols}/share/kicad/library"
"--set KICAD_TEMPLATE_DIR ${kicad-libraries.templates}/share/kicad/template"
"--prefix KICAD_TEMPLATE_DIR : ${kicad-libraries.symbols}/share/kicad/template"
"--prefix KICAD_TEMPLATE_DIR : ${kicad-libraries.footprints}/share/kicad/template"
2019-11-04 19:15:14 -08:00
]
++ optionals (with3d) [ "--set KISYS3DMOD ${kicad-libraries.packages3d}/share/kicad/modules/packages3d" ]
++ optionals (ngspiceSupport) [ "--prefix LD_LIBRARY_PATH : ${libngspice}/lib" ]
2019-11-04 19:15:14 -08: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 06:37:59 -07:00
2019-12-14 19:30:15 -08:00
# 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 kicad-base/bin
# dxf2idf, idf2vrml, idfcyl, idfrect, kicad2step, kicad-ogltest
installPhase =
optionalString (scriptingSupport) '' buildPythonPath "${kicad-base} $pythonPath"
2019-11-04 19:15:14 -08:00
'' +
2019-12-14 19:30:15 -08:00
'' makeWrapper ${kicad-base}/bin/kicad $out/bin/kicad $makeWrapperArgs ''
2019-11-04 19:15:14 -08:00
+ optionalString (scriptingSupport) '' --set PYTHONPATH "$program_PYTHONPATH"
'' +
2019-12-14 19:30:15 -08:00
'' makeWrapper ${kicad-base}/bin/pcbnew $out/bin/pcbnew $makeWrapperArgs ''
2019-11-04 19:15:14 -08:00
+ optionalString (scriptingSupport) '' --set PYTHONPATH "$program_PYTHONPATH"
'' +
2019-12-14 19:30:15 -08:00
'' makeWrapper ${kicad-base}/bin/eeschema $out/bin/eeschema $makeWrapperArgs ''
2019-11-04 19:15:14 -08:00
+ optionalString (scriptingSupport) '' --set PYTHONPATH "$program_PYTHONPATH"
'' +
2019-12-14 19:30:15 -08:00
'' makeWrapper ${kicad-base}/bin/gerbview $out/bin/gerbview $makeWrapperArgs ''
2019-11-04 19:15:14 -08:00
+ optionalString (scriptingSupport) '' --set PYTHONPATH "$program_PYTHONPATH"
'' +
2019-12-14 19:30:15 -08:00
'' makeWrapper ${kicad-base}/bin/pcb_calculator $out/bin/pcb_calculator $makeWrapperArgs ''
2019-11-04 19:15:14 -08:00
+ optionalString (scriptingSupport) '' --set PYTHONPATH "$program_PYTHONPATH"
'' +
2019-12-14 19:30:15 -08:00
'' makeWrapper ${kicad-base}/bin/pl_editor $out/bin/pl_editor $makeWrapperArgs ''
2019-11-04 19:15:14 -08:00
+ optionalString (scriptingSupport) '' --set PYTHONPATH "$program_PYTHONPATH"
'' +
2019-12-14 19:30:15 -08:00
'' makeWrapper ${kicad-base}/bin/bitmap2component $out/bin/bitmap2component $makeWrapperArgs ''
2019-11-04 19:15:14 -08:00
+ optionalString (scriptingSupport) '' --set PYTHONPATH "$program_PYTHONPATH"
''
;
2016-03-30 19:26:54 -07:00
meta = {
2019-12-14 19:30:15 -08:00
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;
2019-12-14 19:30:15 -08:00
# berce seems inactive...
2019-11-04 19:15:14 -08:00
maintainers = with maintainers; [ evils kiwi berce ];
2019-12-14 19:30:15 -08:00
# kicad's cross-platform, not sure what to fill in here
2018-07-26 05:47:07 -07:00
platforms = with platforms; linux;
};
}