<commit_before>{ stdenv, fetchurl, fetchbzr, cmake, mesa, wxGTK, zlib, libX11, gettext, glew, cairo, curl, openssl, boost, pkgconfig, doxygen }:

stdenv.mkDerivation rec {
  name = "kicad-${version}";
  series = "4.0";
  version = "4.0.7";

  srcs = [
    (fetchurl {
      url = "https://code.launchpad.net/kicad/${series}/${version}/+download/kicad-${version}.tar.xz";
      sha256 = "1hgxan9321szgyqnkflb0q60yjf4yvbcc4cpwhm0yz89qrvlq1q9";
    })

    (fetchurl {
      url = "http://downloads.kicad-pcb.org/libraries/kicad-library-${version}.tar.gz";
      sha256 = "1azb7v1y3l6j329r9gg7f4zlg0wz8nh4s4i5i0l9s4yh9r6i9zmv";
    })

    (fetchurl {
      url = "http://downloads.kicad-pcb.org/libraries/kicad-footprints-${version}.tar.gz";
      sha256 = "08qrz5zzsb5127jlnv24j0sgiryd5nqwg3lfnwi8j9a25agqk13j";
    })
  ];

  sourceRoot = "kicad-${version}";

  cmakeFlags = ''
    -DKICAD_SKIP_BOOST=ON
    -DKICAD_BUILD_VERSION=${version}
    -DKICAD_REPO_NAME=stable
  '';

  enableParallelBuilding = true; # often fails on Hydra: fatal error: pcb_plot_params_lexer.h: No such file or directory

  buildInputs = [ cmake mesa wxGTK zlib libX11 gettext glew cairo curl openssl boost pkgconfig doxygen ];

  # They say they only support installs to /usr or /usr/local,
  # so we have to handle this.
  patchPhase = ''
    sed -i -e 's,/usr/local/kicad,'$out,g common/gestfich.cpp
  '';

  postUnpack = ''
    pushd $(pwd)
  '';

  postInstall = ''
    popd

    pushd kicad-library-*
    cmake -DCMAKE_INSTALL_PREFIX=$out
    make $MAKE_FLAGS
    make install
    popd

    pushd kicad-footprints-*
    mkdir -p $out/share/kicad/modules
    cp -R *.pretty $out/share/kicad/modules/
    popd
  '';


  meta = {
    description = "Free Software EDA Suite";
    homepage = http://www.kicad-pcb.org/;
    license = stdenv.lib.licenses.gpl2;
    maintainers = with stdenv.lib.maintainers; [viric];
    platforms = with stdenv.lib.platforms; linux;
  };
}<commit_msg>kicad: don't try to build on hydra<commit_after>{ stdenv, fetchurl, fetchbzr, cmake, mesa, wxGTK, zlib, libX11, gettext, glew, cairo, curl, openssl, boost, pkgconfig, doxygen }:

stdenv.mkDerivation rec {
  name = "kicad-${version}";
  series = "4.0";
  version = "4.0.7";

  srcs = [
    (fetchurl {
      url = "https://code.launchpad.net/kicad/${series}/${version}/+download/kicad-${version}.tar.xz";
      sha256 = "1hgxan9321szgyqnkflb0q60yjf4yvbcc4cpwhm0yz89qrvlq1q9";
    })

    (fetchurl {
      url = "http://downloads.kicad-pcb.org/libraries/kicad-library-${version}.tar.gz";
      sha256 = "1azb7v1y3l6j329r9gg7f4zlg0wz8nh4s4i5i0l9s4yh9r6i9zmv";
    })

    (fetchurl {
      url = "http://downloads.kicad-pcb.org/libraries/kicad-footprints-${version}.tar.gz";
      sha256 = "08qrz5zzsb5127jlnv24j0sgiryd5nqwg3lfnwi8j9a25agqk13j";
    })
  ];

  sourceRoot = "kicad-${version}";

  cmakeFlags = ''
    -DKICAD_SKIP_BOOST=ON
    -DKICAD_BUILD_VERSION=${version}
    -DKICAD_REPO_NAME=stable
  '';

  enableParallelBuilding = true; # often fails on Hydra: fatal error: pcb_plot_params_lexer.h: No such file or directory

  buildInputs = [ cmake mesa wxGTK zlib libX11 gettext glew cairo curl openssl boost pkgconfig doxygen ];

  # They say they only support installs to /usr or /usr/local,
  # so we have to handle this.
  patchPhase = ''
    sed -i -e 's,/usr/local/kicad,'$out,g common/gestfich.cpp
  '';

  postUnpack = ''
    pushd $(pwd)
  '';

  postInstall = ''
    popd

    pushd kicad-library-*
    cmake -DCMAKE_INSTALL_PREFIX=$out
    make $MAKE_FLAGS
    make install
    popd

    pushd kicad-footprints-*
    mkdir -p $out/share/kicad/modules
    cp -R *.pretty $out/share/kicad/modules/
    popd
  '';


  meta = {
    description = "Free Software EDA Suite";
    homepage = http://www.kicad-pcb.org/;
    license = stdenv.lib.licenses.gpl2;
    maintainers = with stdenv.lib.maintainers; [viric];
    platforms = with stdenv.lib.platforms; linux;
    hydraPlatforms = []; # 'output limit exceeded' error on hydra
  };
}
{'fraction_non_alphanumeric': 0.13594412571713643, 'fraction_numerical': 0.03691693689199302, 'mean_word_length': 3.216614090431125, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 2, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 6, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2492197', 'n_tokens_mistral': 1734, 'n_tokens_neox': 1622, 'n_words': 291}