<commit_before>{ stdenv
, fetchurl

, boost
, openssl
, pythonPackages
, zlib

, channel ? null
}:

let
  inherit (stdenv.lib)
    any
    enFlag
    replaceChars
    versionOlder;
  inherit (builtins.getAttr channel (import ./sources.nix))
    sha256
    version;
in

assert any (n: n == channel) [
  "1.0"
  "1.1"
];

let
  versionFormatted =
    # For initial minor releases drop the trailing zero
    if replaceChars ["${channel}."] [""] version == "0" then
      replaceChars ["."] ["_"] channel
    else
      replaceChars ["."] ["_"] version;
  libtorrentOlder = chan: args:
    if versionOlder channel chan then
      args
    else
      null;
in

stdenv.mkDerivation rec {
  name = "libtorrent-rasterbar-${version}";

  src = fetchurl {
    url = "https://github.com/arvidn/libtorrent/releases/download/"
      + "libtorrent-${versionFormatted}/${name}.tar.gz";
    inherit sha256;
  };

  buildInputs = [
    boost
    openssl
    pythonPackages.python
    pythonPackages.wrapPython
    stdenv.libc
    zlib
  ];

  configureFlags = [
    "--enable-largefile"
    "--disable-logging"
    "--disable-debug"<commit_msg>libtorrent-rasterbar: passing libc breaks cc-wrapper, #51<commit_after>{ stdenv
, fetchurl

, boost
, openssl
, pythonPackages
, zlib

, channel ? null
}:

let
  inherit (stdenv.lib)
    any
    enFlag
    replaceChars
    versionOlder;
  inherit (builtins.getAttr channel (import ./sources.nix))
    sha256
    version;
in

assert any (n: n == channel) [
  "1.0"
  "1.1"
];

let
  versionFormatted =
    # For initial minor releases drop the trailing zero
    if replaceChars ["${channel}."] [""] version == "0" then
      replaceChars ["."] ["_"] channel
    else
      replaceChars ["."] ["_"] version;
  libtorrentOlder = chan: args:
    if versionOlder channel chan then
      args
    else
      null;
in

stdenv.mkDerivation rec {
  name = "libtorrent-rasterbar-${version}";

  src = fetchurl {
    url = "https://github.com/arvidn/libtorrent/releases/download/"
      + "libtorrent-${versionFormatted}/${name}.tar.gz";
    inherit sha256;
  };

  buildInputs = [
    boost
    openssl
    pythonPackages.python
    pythonPackages.wrapPython
    zlib
  ];

  configureFlags = [
    "--enable-largefile"
    "--disable-logging"
    "--disable-debug"
{'fraction_non_alphanumeric': 0.13058720420683612, 'fraction_numerical': 0.010517090271691499, 'mean_word_length': 2.730392156862745, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3129762', 'n_tokens_mistral': 803, 'n_tokens_neox': 769, 'n_words': 175}