<commit_before>{ mkDerivation, stdenv, lib, fetchFromGitHub, fetchpatch, procps
, qtbase, qtwebengine, qtwebkit
, cmake
, syncthing
, preferQWebView ? false
, preferNative   ? true }:

mkDerivation rec {
  version = "0.5.8";
  pname = "qsyncthingtray";

  src = fetchFromGitHub {
    owner  = "sieren";
    repo   = "QSyncthingTray";
    rev    = version;
    sha256 = "1n9g4j7qznvg9zl6x163pi9f7wsc3x6q76i33psnm7x2v1i22x5w";
  };

  buildInputs = [ qtbase qtwebengine ] ++ lib.optional preferQWebView qtwebkit;

  nativeBuildInputs = [ cmake ];

  cmakeFlags = [ ]
    ++ lib.optional preferQWebView "-DQST_BUILD_WEBKIT=1"
    ++ lib.optional preferNative   "-DQST_BUILD_NATIVEBROWSER=1";

  patches = [ (fetchpatch {
    name = "support_native_browser.patch";
    url = "https://patch-diff.githubusercontent.com/raw/sieren/QSyncthingTray/pull/225.patch";
    sha256 = "0w665xdlsbjxs977pdpzaclxpswf7xys1q3rxriz181lhk2y66yy";
  }) ] ++ lib.optional (!preferQWebView && !preferNative) ./qsyncthingtray-0.5.8-qt-5.6.3.patch;

  postPatch = ''
    ${lib.optionalString stdenv.isLinux ''
      substituteInPlace includes/platforms/linux/posixUtils.hpp \
        --replace '"/usr/local/bin/syncthing"'         '"${syncthing}/bin/syncthing"' \
        --replace '"pgrep -x'                          '"${procps}/bin/pgrep -x'
    ''}

    ${lib.optionalString stdenv.isDarwin ''
      substituteInPlace includes/platforms/darwin/macUtils.hpp \
        --replace '"/usr/local/bin/syncthing"'         '"${syncthing}/bin/syncthing"'
    ''}
  '';

  installPhase = let qst = "qsyncthingtray"; in ''
    runHook preInstall

    mkdir -p $out/bin
    install -m755 QSyncthingTray $out/bin/${qst}
    ln -s $out/bin/${qst} $out/bin/QSyncthingTray

    runHook postInstall
  '';

  meta = with lib; {
    homepage = "https://github.com/sieren/QSyncthingTray/";
    description = "A Traybar Application for Syncthing written in C++";
    longDescription = ''
        A cross-platform status bar for Syncthing.
        Currently supports macOS, Windows and Linux.
        Written in C++ with Qt.
    '';
    license = licenses.lgpl3;
    maintainers = with maintainers; [ zraexy peterhoeg ];
    platforms = platforms.all;
    # 0.5.7 segfaults when opening the main panel with qt 5.7 and fails to compile with qt 5.8
    # but qt > 5.6 works when only using the native browser
    # https://github.com/sieren/QSyncthingTray/issues/223
    broken = (builtins.compareVersions qtbase.version "5.7.0" >= 0 && !preferNative);
  };
}
<commit_msg>qsyncthingtray: Mark broken on master<commit_after>{ mkDerivation, stdenv, lib, fetchFromGitHub, fetchpatch, procps
, qtbase, qtwebengine, qtwebkit
, cmake
, syncthing
, preferQWebView ? false
, preferNative   ? true }:

mkDerivation rec {
  version = "0.5.8";
  pname = "qsyncthingtray";

  src = fetchFromGitHub {
    owner  = "sieren";
    repo   = "QSyncthingTray";
    rev    = version;
    sha256 = "1n9g4j7qznvg9zl6x163pi9f7wsc3x6q76i33psnm7x2v1i22x5w";
  };

  buildInputs = [ qtbase qtwebengine ] ++ lib.optional preferQWebView qtwebkit;

  nativeBuildInputs = [ cmake ];

  cmakeFlags = [ ]
    ++ lib.optional preferQWebView "-DQST_BUILD_WEBKIT=1"
    ++ lib.optional preferNative   "-DQST_BUILD_NATIVEBROWSER=1";

  patches = [ (fetchpatch {
    name = "support_native_browser.patch";
    url = "https://patch-diff.githubusercontent.com/raw/sieren/QSyncthingTray/pull/225.patch";
    sha256 = "0w665xdlsbjxs977pdpzaclxpswf7xys1q3rxriz181lhk2y66yy";
  }) ] ++ lib.optional (!preferQWebView && !preferNative) ./qsyncthingtray-0.5.8-qt-5.6.3.patch;

  postPatch = ''
    ${lib.optionalString stdenv.isLinux ''
      substituteInPlace includes/platforms/linux/posixUtils.hpp \
        --replace '"/usr/local/bin/syncthing"'         '"${syncthing}/bin/syncthing"' \
        --replace '"pgrep -x'                          '"${procps}/bin/pgrep -x'
    ''}

    ${lib.optionalString stdenv.isDarwin ''
      substituteInPlace includes/platforms/darwin/macUtils.hpp \
        --replace '"/usr/local/bin/syncthing"'         '"${syncthing}/bin/syncthing"'
    ''}
  '';

  installPhase = let qst = "qsyncthingtray"; in ''
    runHook preInstall

    mkdir -p $out/bin
    install -m755 QSyncthingTray $out/bin/${qst}
    ln -s $out/bin/${qst} $out/bin/QSyncthingTray

    runHook postInstall
  '';

  meta = with lib; {
    homepage = "https://github.com/sieren/QSyncthingTray/";
    description = "A Traybar Application for Syncthing written in C++";
    longDescription = ''
        A cross-platform status bar for Syncthing.
        Currently supports macOS, Windows and Linux.
        Written in C++ with Qt.
    '';
    license = licenses.lgpl3;
    maintainers = with maintainers; [ <NAME> ];
    platforms = platforms.all;
    # 0.5.7 segfaults when opening the main panel with qt 5.7 and fails to compile with qt 5.8
    # but qt > 5.6 works when only using the native browser
    # https://github.com/sieren/QSyncthingTray/issues/223
    broken = (builtins.compareVersions qtbase.version "5.7.0" >= 0 && !preferNative) || stdenv.isDarwin;
  };
}

{'fraction_non_alphanumeric': 0.12989568982483762, 'fraction_numerical': 0.03109624089746113, 'mean_word_length': 3.0558659217877095, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 8, 'https://': 6, 'lorem ipsum': 0, 'www.': 0, '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': '3742565', 'n_tokens_mistral': 1962, 'n_tokens_neox': 1846, 'n_words': 352}