<commit_before>{ lib
, stdenv
, fetchurl
, xorg
, libxkbcommon
, systemd
, gcc-unwrapped
, electron_3
, wrapGAppsHook
, makeDesktopItem
}:

let
  libPath = lib.makeLibraryPath [
    libxkbcommon
    xorg.libXt
    systemd.lib
    stdenv.cc.cc.lib
  ];

  desktopItem = makeDesktopItem rec {
    name = "Obinskit";
    exec = "obinskit";
    icon = "obinskit.png";
    desktopName = "Obinskit";
    genericName = "Obinskit keyboard configurator";
    categories = "Utility";
  };

in stdenv.mkDerivation rec {
  pname = "obinskit";
  version = "1.1.4";

  src = fetchurl {
    url = "http://releases.obins.net/occ/linux/tar/ObinsKit_${version}_x64.tar.gz";
    sha256 = "0q422rmfn4k4ww1qlgrwdmxz4l10dxkd6piynbcw5cr4i5icnh2l";
  };

  unpackPhase = "tar -xzf $src";

  sourceRoot = "ObinsKit_${version}_x64";

  nativeBuildInputs = [ wrapGAppsHook ];

  dontConfigure = true;
  dontBuild = true;

  installPhase = ''
    mkdir -p $out/opt/obinskit
    install icudtl.dat $out/opt/obinskit/
    install natives_blob.bin $out/opt/obinskit/
    install v8_context_snapshot.bin $out/opt/obinskit/
    install blink_image_resources_200_percent.pak $out/opt/obinskit/
    install content_resources_200_percent.pak $out/opt/obinskit/
    install content_shell.pak $out/opt/obinskit/
    install ui_resources_200_percent.pak $out/opt/obinskit/
    install views_resources_200_percent.pak $out/opt/obinskit/
    cp -r resources $out/opt/obinskit/
    cp -r locales $out/opt/obinskit/

    mkdir -p $out/bin
    ln -s ${electron_3}/bin/electron $out/bin/obinskit

    mkdir -p $out/share/{applications,pixmaps}
    install resources/icons/tray-darwin@2x.png $out/share/pixmaps/obinskit.png
    ln -s ${desktopItem}/share/applications/* $out/share/applications
  '';

  preFixup = ''
    gappsWrapperArgs+=(
      --add-flags $out/opt/obinskit/resources/app.asar
      --prefix LD_LIBRARY_PATH : "${libPath}"
    )
  '';

  meta = with lib; {
    description = "Graphical configurator for Anne Pro and Anne Pro II keyboards";
    homepage = "http://en.obins.net/obinskit/";
    license = licenses.unfree;
    maintainers = [ maintainers.shou ];
    platforms = [ "x86_64-linux" ];
  };
}<commit_msg>obinskit: update to new electron_3 packaging<commit_after>{ stdenv
, fetchurl
, libxkbcommon
, systemd
, xorg
, electron_3
, makeWrapper
, makeDesktopItem
}:
let
  desktopItem = makeDesktopItem rec {
    name = "Obinskit";
    exec = "obinskit";
    icon = "obinskit";
    desktopName = "Obinskit";
    genericName = "Obinskit keyboard configurator";
    categories = "Utility";
  };

in
stdenv.mkDerivation rec {
  pname = "obinskit";
  version = "1.1.4";

  src = fetchurl {
    url = "http://releases.obins.net/occ/linux/tar/ObinsKit_${version}_x64.tar.gz";
    sha256 = "0q422rmfn4k4ww1qlgrwdmxz4l10dxkd6piynbcw5cr4i5icnh2l";
  };

  unpackPhase = "tar -xzf $src";

  sourceRoot = "ObinsKit_${version}_x64";

  nativeBuildInputs = [ makeWrapper ];

  dontConfigure = true;
  dontBuild = true;

  installPhase = ''
    mkdir -p $out/opt/obinskit

    cp -r resources $out/opt/obinskit/
    cp -r locales $out/opt/obinskit/

    mkdir -p $out/share/{applications,pixmaps}
    install resources/icons/tray-darwin@2x.png $out/share/pixmaps/obinskit.png
    ln -s ${desktopItem}/share/applications/* $out/share/applications
  '';

  postFixup = ''
    makeWrapper ${electron_3}/bin/electron $out/bin/${pname} \
      --add-flags $out/opt/obinskit/resources/app.asar \
      --prefix LD_LIBRARY_PATH : "${stdenv.lib.makeLibraryPath [ stdenv.cc.cc.lib libxkbcommon systemd.lib xorg.libXt ]}"
  '';

  meta = with stdenv.lib; {
    description = "Graphical configurator for Anne Pro and Anne Pro II keyboards";
    homepage = "http://en.obins.net/obinskit/"; # https is broken
    license = licenses.unfree;
    maintainers = with maintainers; [ shou ];
    platforms = [ "x86_64-linux" ];
  };
}
{'fraction_non_alphanumeric': 0.13125322331098505, 'fraction_numerical': 0.020113460546673543, 'mean_word_length': 3.3244147157190636, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 2, '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': '517346', 'n_tokens_mistral': 1513, 'n_tokens_neox': 1446, 'n_words': 261}