···
, oceSupport ? false, opencascade
, withOCCT ? true, opencascade-occt
, ngspiceSupport ? true, libngspice
···
21
-
stable = pname != "kicad-unstable";
baseName = if (stable) then "kicad" else "kicad-unstable";
versions = import ./versions.nix;
···
wxPython = python3Packages.wxPython_4_0;
38
-
libraries = callPackages ./libraries.nix versionConfig.libVersion;
39
+
stdenv.mkDerivation rec {
41
+
passthru.libraries = callPackages ./libraries.nix versionConfig.libVersion;
base = callPackage ./base.nix {
inherit versions stable baseName;
inherit wxGTK python wxPython;
inherit debug withI18n withOCCT oceSupport ngspiceSupport scriptingSupport;
47
-
stdenv.mkDerivation rec {
version = versions.${baseName}.kicadVersion.version;
···
# wrapGAppsHook added the equivalent to ${base}/share
# though i noticed no difference without it
65
+
makeWrapperArgs = with passthru.libraries; [
"--prefix XDG_DATA_DIRS : ${base}/share"
"--prefix XDG_DATA_DIRS : ${hicolor-icon-theme}/share"
"--prefix XDG_DATA_DIRS : ${gnome3.defaultIconTheme}/share"
···
"--prefix XDG_DATA_DIRS : ${cups}/share"
"--prefix GIO_EXTRA_MODULES : ${gnome3.dconf}/lib/gio/modules"
76
-
"--set KISYSMOD ${libraries.footprints}/share/kicad/modules"
77
-
"--set KICAD_SYMBOL_DIR ${libraries.symbols}/share/kicad/library"
78
-
"--set KICAD_TEMPLATE_DIR ${libraries.templates}/share/kicad/template"
79
-
"--prefix KICAD_TEMPLATE_DIR : ${libraries.symbols}/share/kicad/template"
80
-
"--prefix KICAD_TEMPLATE_DIR : ${libraries.footprints}/share/kicad/template"
75
+
"--set KISYSMOD ${footprints}/share/kicad/modules"
76
+
"--set KICAD_SYMBOL_DIR ${symbols}/share/kicad/library"
77
+
"--set KICAD_TEMPLATE_DIR ${templates}/share/kicad/template"
78
+
"--prefix KICAD_TEMPLATE_DIR : ${symbols}/share/kicad/template"
79
+
"--prefix KICAD_TEMPLATE_DIR : ${footprints}/share/kicad/template"
82
-
++ optionals (with3d) [ "--set KISYS3DMOD ${libraries.packages3d}/share/kicad/modules/packages3d" ]
81
+
++ optionals (with3d) [ "--set KISYS3DMOD ${packages3d}/share/kicad/modules/packages3d" ]
++ optionals (ngspiceSupport) [ "--prefix LD_LIBRARY_PATH : ${libngspice}/lib" ]
# infinisil's workaround for #39493
++ [ "--set GDK_PIXBUF_MODULE_FILE ${librsvg}/lib/gdk-pixbuf-2.0/2.10.0/loaders.cache" ]
89
-
# dunno why i have to add $makeWrapperArgs manually...
88
+
# why does $makeWrapperArgs have to be added explicitly?
# $out and $program_PYTHONPATH don't exist when makeWrapperArgs gets set?
91
-
# not sure if anything has to be done with the other stuff in base/bin
92
-
# dxf2idf, idf2vrml, idfcyl, idfrect, kicad2step, kicad-ogltest
94
-
optionalString (scriptingSupport) '' buildPythonPath "${base} $pythonPath"
96
-
'' makeWrapper ${base}/bin/kicad $out/bin/kicad $makeWrapperArgs ''
97
-
+ optionalString (scriptingSupport) '' --set PYTHONPATH "$program_PYTHONPATH"
99
-
'' makeWrapper ${base}/bin/pcbnew $out/bin/pcbnew $makeWrapperArgs ''
100
-
+ optionalString (scriptingSupport) '' --set PYTHONPATH "$program_PYTHONPATH"
102
-
'' makeWrapper ${base}/bin/eeschema $out/bin/eeschema $makeWrapperArgs ''
103
-
+ optionalString (scriptingSupport) '' --set PYTHONPATH "$program_PYTHONPATH"
105
-
'' makeWrapper ${base}/bin/gerbview $out/bin/gerbview $makeWrapperArgs ''
106
-
+ optionalString (scriptingSupport) '' --set PYTHONPATH "$program_PYTHONPATH"
108
-
'' makeWrapper ${base}/bin/pcb_calculator $out/bin/pcb_calculator $makeWrapperArgs ''
109
-
+ optionalString (scriptingSupport) '' --set PYTHONPATH "$program_PYTHONPATH"
111
-
'' makeWrapper ${base}/bin/pl_editor $out/bin/pl_editor $makeWrapperArgs ''
112
-
+ optionalString (scriptingSupport) '' --set PYTHONPATH "$program_PYTHONPATH"
114
-
'' makeWrapper ${base}/bin/bitmap2component $out/bin/bitmap2component $makeWrapperArgs ''
115
-
+ optionalString (scriptingSupport) '' --set PYTHONPATH "$program_PYTHONPATH"
90
+
# kicad-ogltest's source seems to indicate that crashing is expected behaviour...
91
+
installPhase = with lib;
93
+
tools = [ "kicad" "pcbnew" "eeschema" "gerbview" "pcb_calculator" "pl_editor" "bitmap2component" ];
94
+
utils = [ "dxf2idf" "idf2vrml" "idfcyl" "idfrect" "kicad2step" "kicad-ogltest" ];
96
+
( concatStringsSep "\n"
98
+
( optionalString (scriptingSupport) "buildPythonPath \"${base} $pythonPath\" \n" )
100
+
# wrap each of the directly usable tools
101
+
( map ( tool: "makeWrapper ${base}/bin/${tool} $out/bin/${tool} $makeWrapperArgs"
102
+
+ optionalString (scriptingSupport) " --set PYTHONPATH \"$program_PYTHONPATH\""
105
+
# link in the CLI utils
106
+
( map ( util: "ln -s ${base}/bin/${util} $out/bin/${util}" ) utils )
# can't run this for each pname
···
# and can't git commit if this could be running in parallel with other scripts
passthru.updateScript = [ ./update.sh "all" ];
127
-
description = if (stable)
128
-
then "Open Source Electronics Design Automation Suite"
129
-
else "Open Source EDA Suite, Development Build";
119
+
description = (if (stable)
120
+
then "Open Source Electronics Design Automation suite"
121
+
else "Open Source EDA suite, development build")
122
+
+ (if (!with3d) then ", without 3D models" else "");
homepage = "https://www.kicad-pcb.org/";
KiCad is an open source software suite for Electronic Design Automation.
···
license = licenses.agpl3;
# berce seems inactive...
137
-
maintainers = with maintainers; [ evils kiwi berce ];
138
-
# kicad's cross-platform, not sure what to fill in here
139
-
platforms = with platforms; linux;
140
-
} // optionalAttrs with3d {
141
-
# We can't download the 3d models on Hydra - they are a ~1 GiB download and
142
-
# they occupy ~5 GiB in store.
143
-
hydraPlatforms = [];
130
+
maintainers = with stdenv.lib.maintainers; [ evils kiwi berce ];
131
+
# kicad is cross platform
132
+
platforms = stdenv.lib.platforms.all;
133
+
# despite that, nipkgs' wxGTK for darwin is "wxmac"
134
+
# and wxPython_4_0 does not account for this
135
+
# adjusting this package to downgrade to python2Packages.wxPython (wxPython 3),
136
+
# seems like more trouble than fixing wxPython_4_0 would be
137
+
# additionally, libngspice is marked as linux only, though it should support darwin
139
+
hydraPlatforms = if (with3d) then [ ] else platforms;
140
+
# We can't download the 3d models on Hydra,
141
+
# they are a ~1 GiB download and they occupy ~5 GiB in store.
142
+
# as long as the base and libraries (minus 3d) are build,
143
+
# this wrapper does not need to get built
144
+
# the kicad-*small "packages" cause this to happen