<commit_before>{ stdenv, fetchFromGitHub, zlib, libusb1, cmake, qt5, enableGUI ? false }:

let version = "1.4.1-37-gb6fe7f8"; in

stdenv.mkDerivation {
  name = "heimdall-${version}";

  src = fetchFromGitHub {
    owner  = "Benjamin-Dobell";
    repo   = "Heimdall";
    rev    = "v${version}";
    sha256 = "10c71k251wxd05j6c76qlar5sd73zam1c1g2cq3cscqayd7rzafg";
  };

  buildInputs = [ zlib libusb1 cmake ];
  patchPhase = stdenv.lib.optional (!enableGUI) ''
    sed -i '/heimdall-frontend/d' CMakeLists.txt
  '';
  enableParallelBuilding = true;
  cmakeFlags = [
    "-DQt5Widgets_DIR=${qt5.qtbase.dev}/lib/cmake/Qt5Widgets"
    "-DQt5Gui_DIR=${qt5.qtbase.dev}/lib/cmake/Qt5Gui"
    "-DQt5Core_DIR=${qt5.qtbase.dev}/lib/cmake/Qt5Core"
    "-DBUILD_TYPE=Release"
  ];

  preConfigure = ''
    # Give ownership of the Galaxy S USB device to the logged in user.
    substituteInPlace heimdall/60-heimdall.rules --replace 'MODE="0666"' 'TAG+="uaccess"'
  '';

  installPhase = ''
    mkdir -p $out/bin $out/share/doc/heimdall $out/lib/udev/rules.d
    cp "bin/"* $out/bin/
    cp ../Linux/README $out/share/doc/heimdall
    cp ../heimdall/60-heimdall.rules $out/lib/udev/rules.d
  '';

  meta = {
    homepage = "http://www.glassechidna.com.au/products/heimdall/";
    description = "A cross-platform tool suite to flash firmware onto Samsung Galaxy S devices";
    license = stdenv.lib.licenses.mit;
    platforms = stdenv.lib.platforms.linux;<commit_msg>heimdall: clean up the build expression<commit_after>{ stdenv, fetchFromGitHub, zlib, libusb1, cmake, qt5, enableGUI ? false }:

let version = "1.4.1-37-gb6fe7f8"; in

stdenv.mkDerivation {
  name = "heimdall-${version}";

  src = fetchFromGitHub {
    owner  = "Benjamin-Dobell";
    repo   = "Heimdall";
    rev    = "v${version}";
    sha256 = "10c71k251wxd05j6c76qlar5sd73zam1c1g2cq3cscqayd7rzafg";
  };

  buildInputs = [ zlib libusb1 cmake ];

  cmakeFlags = [
    "-DBUILD_TYPE=Release"
    "-DDISABLE_FRONTEND=${if enableGUI then "OFF" else "ON"}"
  ] ++ stdenv.lib.optionals enableGUI [
    "-DQt5Widgets_DIR=${qt5.qtbase.dev}/lib/cmake/Qt5Widgets"
    "-DQt5Gui_DIR=${qt5.qtbase.dev}/lib/cmake/Qt5Gui"
    "-DQt5Core_DIR=${qt5.qtbase.dev}/lib/cmake/Qt5Core"
  ];

  preConfigure = ''
    # Give ownership of the Galaxy S USB device to the logged in user.
    substituteInPlace heimdall/60-heimdall.rules --replace 'MODE="0666"' 'TAG+="uaccess"'

    # Fix version string reported by the executable.
    sed -i -e 's/version = "v.*"/version = "v${version}"/' heimdall/source/Interface.cpp
  '';

  installPhase = ''
    mkdir -p $out/bin $out/share/doc/heimdall $out/lib/udev/rules.d
    cp "bin/"* $out/bin/
    cp ../Linux/README $out/share/doc/heimdall
    cp ../heimdall/60-heimdall.rules $out/lib/udev/rules.d
  '';

  enableParallelBuilding = true;

  meta = {
    homepage = "http://www.glassechidna.com.au/products/heimdall/";
    description = "A cross-platform tool suite to flash firmware onto Samsung Galaxy S devices";
    license = stdenv.lib.licenses.mit;
    platforms = stdenv.lib.platforms.linux;
{'fraction_non_alphanumeric': 0.15102305943488145, 'fraction_numerical': 0.03312763884378045, 'mean_word_length': 3.3812233285917497, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7133058', 'n_tokens_mistral': 1262, 'n_tokens_neox': 1205, 'n_words': 215}