summary refs log tree commit diff
path: root/pkgs/applications/science/electronics/kicad/libraries.nix
blob: 53e190d2749b357b8873602152782de24f0ad507 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
{ lib, stdenv, cmake, gettext
, fetchFromGitHub, fetchFromGitLab
, version, libSources
}:

# callPackage libraries {
#   version = "unstable";
#   libs.symbols = {
#     rev = "09f9..";
#     sha256 = "...";
#   };
# };
with lib;
let
  mkLib = name: attrs:
    stdenv.mkDerivation (
      {
        pname = "kicad-${name}";
        version = "${version}";
        src = fetchFromGitHub (
          {
            owner = "KiCad";
            repo = "kicad-${name}";
            rev = version;
            inherit name;
          } // (libSources.${name} or { })
        );
        nativeBuildInputs = [ cmake ];
        meta.license = licenses.cc-by-sa-40;
      } // attrs
    );
in
{
  symbols = mkLib "symbols" { };
  templates = mkLib "templates" { };
  footprints = mkLib "footprints" { };
  packages3d = mkLib "packages3d" {
    hydraPlatforms = []; # this is a ~1 GiB download, occupies ~5 GiB in store
  };

  # i18n is a special case, not actually a library
  # more a part of kicad proper, but also optional and separate
  # since their move to gitlab they're keeping it in a separate path
  # kicad has no way to find i18n except through a path relative to its install path
  # therefore this is being linked into ${kicad-base}/share/
  # and defined here to make use of the rev & sha256's brought here for the libs
  i18n = let name = "i18n"; in
    stdenv.mkDerivation {
      pname = "kicad-${name}";
      version = "${version}";
      src = fetchFromGitLab (
        {
          group = "kicad";
          owner = "code";
          repo = "kicad-${name}";
          rev = version;
          inherit name;
        } // (libSources.${name} or { })
      );
      buildInputs = [ gettext ];
      nativeBuildInputs = [ cmake ];
      meta.license = licenses.gpl2; # https://github.com/KiCad/kicad-i18n/issues/3
    };
}