kicad: make module list overridable

This moves module definition into passthru. Otherwise building kicad
would still require all modules to be built first even if they are not
used.

Also this drops preferLocalBuild from packages3d. hydraPlatforms should
do what we need to. preferLocalBuild would addtitionaly disable remote
builders, which is probably not what we want.
This commit is contained in:
Dmitry Kalinkin 2019-03-23 23:54:31 -04:00
parent 2f5439a950
commit d0fc807347
No known key found for this signature in database
GPG key ID: 06AF1D3C38F04E0E

View file

@ -5,14 +5,14 @@
, oceSupport ? true, opencascade , oceSupport ? true, opencascade
, ngspiceSupport ? true, libngspice , ngspiceSupport ? true, libngspice
, swig, python, pythonPackages , swig, python, pythonPackages
, lndir, withLibraries ? true, with3DPackages ? false , lndir, with3DPackages ? false
}: }:
assert ngspiceSupport -> libngspice != null; assert ngspiceSupport -> libngspice != null;
with lib; with lib;
let let
mkLib = version: name: sha256: stdenv.mkDerivation { mkLib = version: name: sha256: attrs: stdenv.mkDerivation ({
name = "kicad-${name}-${version}"; name = "kicad-${name}-${version}";
src = fetchFromGitHub { src = fetchFromGitHub {
owner = "KiCad"; owner = "KiCad";
@ -23,7 +23,7 @@ let
nativeBuildInputs = [ nativeBuildInputs = [
cmake cmake
]; ];
}; } // attrs);
in stdenv.mkDerivation rec { in stdenv.mkDerivation rec {
name = "kicad-${version}"; name = "kicad-${version}";
@ -71,31 +71,37 @@ in stdenv.mkDerivation rec {
# this breaks other applications in kicad # this breaks other applications in kicad
dontWrapGApps = true; dontWrapGApps = true;
i18n = (mkLib version "i18n" "1hkc240gymhmyv6r858mq5d2slz0vjqc47ah8wn82vvmb83fpnjy").overrideAttrs (_: { passthru = {
buildInputs = [ i18n = mkLib version "i18n" "1hkc240gymhmyv6r858mq5d2slz0vjqc47ah8wn82vvmb83fpnjy" {
gettext buildInputs = [
]; gettext
}); ];
meta.license = licenses.gpl2; # https://github.com/KiCad/kicad-i18n/issues/3
};
symbols = mkLib version "symbols" "1rjh2pjcrc3bhcgyyskj5pssm7vffrjk0ymwr70fb7sjpmk96yjk" {
meta.license = licenses.cc-by-sa-40;
};
footprints = mkLib version "footprints" "19khqyrbrqsdzxvm1b1vxfscxhss705fqky0ilrbvnbvf27fnx8w" {
meta.license = licenses.cc-by-sa-40;
};
templates = mkLib version "templates" "0rlzq1n09n0sf2kj5c9bvbnkvs6cpycjxmxwcswql0fbpcp0sql7" {
meta.license = licenses.cc-by-sa-40;
};
packages3d = mkLib version "packages3d" "135jyrljgknnv2y35skhnwcxg16yxxkfbcx07nad3vr4r76zk3am" {
hydraPlatforms = []; # this is a ~1 GiB download, occupies ~5 GiB in store
meta.license = licenses.cc-by-sa-40;
};
};
symbols = mkLib version "symbols" "1rjh2pjcrc3bhcgyyskj5pssm7vffrjk0ymwr70fb7sjpmk96yjk"; modules = with passthru;
[ i18n symbols footprints templates ]
footprints = mkLib version "footprints" "19khqyrbrqsdzxvm1b1vxfscxhss705fqky0ilrbvnbvf27fnx8w"; ++ optional with3DPackages packages3d;
templates = mkLib version "templates" "0rlzq1n09n0sf2kj5c9bvbnkvs6cpycjxmxwcswql0fbpcp0sql7";
packages3d = (mkLib version "packages3d" "135jyrljgknnv2y35skhnwcxg16yxxkfbcx07nad3vr4r76zk3am").overrideAttrs (_: {
hydraPlatforms = []; # Disable big package3d library
preferLocalBuild = true;
});
postInstall = '' postInstall = ''
lndir -silent $i18n/share $out/share mkdir -p $out/share
'' + optionalString withLibraries '' for module in $modules; do
lndir -silent $symbols/share $out/share lndir $module/share $out/share
lndir -silent $footprints/share $out/share done
lndir -silent $templates/share $out/share
'' + optionalString with3DPackages ''
lndir -silent $packages3d/share $out/share
''; '';
preFixup = '' preFixup = ''
@ -108,7 +114,7 @@ in stdenv.mkDerivation rec {
meta = { meta = {
description = "Free Software EDA Suite"; description = "Free Software EDA Suite";
homepage = http://www.kicad-pcb.org/; homepage = http://www.kicad-pcb.org/;
license = [ licenses.gpl2 ] ++ optional (withLibraries || with3DPackages) licenses.cc-by-sa-40; license = licenses.gpl2;
maintainers = with maintainers; [ berce ]; maintainers = with maintainers; [ berce ];
platforms = with platforms; linux; platforms = with platforms; linux;
}; };