<commit_before>{ lib
, stdenv
, fetchFromGitHub
, rustPlatform
, polaris-web
}:

rustPlatform.buildRustPackage rec {
  pname = "polaris";
  version = "0.13.5";

  src = fetchFromGitHub {
    owner = "agersant";
    repo = "polaris";
    rev = "${version}";
    sha256 = "sp1KDTzKvcGtuqL37fFnVgcnkIsmj5ZQji72BeyiFQE=";

    # The polaris version upstream in Cargo.lock is "0.0.0".
    # We're unable to simply patch it in the patch phase due to
    # rustPlatform.buildRustPackage fetching dependencies before applying patches.
    # If we patch it after fetching dependencies we get an error when
    # validating consistency between the final build and the prefetched deps.
    postFetch = ''
      # 'substituteInPlace' does not support multiline replacements?
      sed -i $out/Cargo.lock -z \
        -e 's/\[\[package\]\]\nname = "polaris"\nversion = "0.0.0"/[[package]]\nname = "polaris"\nversion = "'"${version}"'"/g'
    '';
  };

  cargoSha256 = "sha256-0VHrlUoyYu+UTUQUioftBDlQJfLd/axz6bGJs+YXSmE=";

  # Compile-time environment variables for where to find assets needed at runtime
  POLARIS_WEB_DIR = "${polaris-web}/share/polaris-web";
  POLARIS_SWAGGER_DIR = "${placeholder "out"}/share/polaris-swagger";

  postInstall = ''
    mkdir -p $out/share
    cp -a docs/swagger $out/share/polaris-swagger
  '';

  passthru.updateScript = ./update.sh;

  meta = with lib; {
    description = "Self-host your music collection, and access it from any computer and mobile device";
    longDescription = ''
      Polaris is a FOSS music streaming application, designed to let you enjoy your music collection<commit_msg>polaris: fix Os error 24: 'Too many open files' in checkPhase<commit_after>{ lib
, stdenv
, fetchFromGitHub
, rustPlatform
, polaris-web
}:

rustPlatform.buildRustPackage rec {
  pname = "polaris";
  version = "0.13.5";

  src = fetchFromGitHub {
    owner = "agersant";
    repo = "polaris";
    rev = "${version}";
    sha256 = "sp1KDTzKvcGtuqL37fFnVgcnkIsmj5ZQji72BeyiFQE=";

    # The polaris version upstream in Cargo.lock is "0.0.0".
    # We're unable to simply patch it in the patch phase due to
    # rustPlatform.buildRustPackage fetching dependencies before applying patches.
    # If we patch it after fetching dependencies we get an error when
    # validating consistency between the final build and the prefetched deps.
    postFetch = ''
      # 'substituteInPlace' does not support multiline replacements?
      sed -i $out/Cargo.lock -z \
        -e 's/\[\[package\]\]\nname = "polaris"\nversion = "0.0.0"/[[package]]\nname = "polaris"\nversion = "'"${version}"'"/g'
    '';
  };

  cargoSha256 = "sha256-0VHrlUoyYu+UTUQUioftBDlQJfLd/axz6bGJs+YXSmE=";

  # Compile-time environment variables for where to find assets needed at runtime
  POLARIS_WEB_DIR = "${polaris-web}/share/polaris-web";
  POLARIS_SWAGGER_DIR = "${placeholder "out"}/share/polaris-swagger";

  postInstall = ''
    mkdir -p $out/share
    cp -a docs/swagger $out/share/polaris-swagger
  '';

  preCheck = ''
    # 'Err' value: Os { code: 24, kind: Uncategorized, message: "Too many open files" }
    ulimit -n 4096
  '';

  passthru.updateScript = ./update.sh;

  meta = with lib; {
    description = "Self-host your music collection, and access it from any computer and mobile device";
    longDescription = ''
      Polaris is a FOSS music streaming application, designed to let you enjoy your music collection
{'fraction_non_alphanumeric': 0.11747516072472239, 'fraction_numerical': 0.018118059614260665, 'mean_word_length': 3.4745098039215687, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, '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': '5373893', 'n_tokens_mistral': 1212, 'n_tokens_neox': 1147, 'n_words': 321}