<commit_before>{stdenv, xcodewrapper}:
{name, app, device ? "iPhone", baseDir ? ""}:

stdenv.mkDerivation {
  name = stdenv.lib.replaceChars [" "] [""] name;
  buildCommand = ''
    ensureDir $out/bin
    cat > $out/bin/run-test-simulator << "EOF"
    #! ${stdenv.shell} -e

    cd "${app}/${baseDir}/*.app"
    "$(readlink "${xcodewrapper}/bin/iPhone Simulator")" -SimulateApplication './${name}' -SimulateDevice '${device}'
    EOF
    chmod +x $out/bin/run-test-simulator
  '';
}
<commit_msg>It's impossible to guess the name so we add an extra optional parameter to override it<commit_after>{stdenv, xcodewrapper}:
{name, appName ? null, app, device ? "iPhone", baseDir ? ""}:

let
  _appName = if appName == null then name else appName;
in
stdenv.mkDerivation {
  name = stdenv.lib.replaceChars [" "] [""] name;
  buildCommand = ''
    ensureDir $out/bin
    cat > $out/bin/run-test-simulator << "EOF"
    #! ${stdenv.shell} -e

    cd "${app}/${baseDir}/${_appName}.app"
    "$(readlink "${xcodewrapper}/bin/iPhone Simulator")" -SimulateApplication './${_appName}' -SimulateDevice '${device}'
    EOF
    chmod +x $out/bin/run-test-simulator
  '';
}

{'fraction_non_alphanumeric': 0.18598615916955016, 'fraction_numerical': 0.0, 'mean_word_length': 3.7224489795918365, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 5, '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': '3742573', 'n_tokens_mistral': 421, 'n_tokens_neox': 411, 'n_words': 91}