<commit_before>let
  nixpkgsRev = "605f21e375f0065868023874988164766e7896b0";
  nixpkgs = builtins.fetchTarball {
    name = "nixpkgs-${nixpkgsRev}";
    url = "https://github.com/nixos/nixpkgs/archive/${nixpkgsRev}.tar.gz";
    sha256 = "1mbm0nxkysxi9p4d4v2h6p32rni3wl10qm9hlqa2dy25yzamvjm9";
  };
  pkgs = import nixpkgs { };

  fenixRev = "9e3384c61656487b10226a3366a12c37393b21d9";
  fenixPackages = import (builtins.fetchTarball {
    name = "fenix-${fenixRev}";
    url = "https://github.com/nix-community/fenix/archive/${fenixRev}.tar.gz";
    sha256 = "10kjfa00fs98cvs137x5kr5dmfblmkz8ya5ribb5l0dnfnpgvf5s";
  }) { };

  rustToolchain = fenixPackages.fromToolchainFile {
    file = ./rust-toolchain.toml;
    sha256 = "5LJRZfmLYjC5UZBmZoLomMz9P5OTjP+te5TI9RX8gZI=";
  };
  inherit (fenixPackages) rust-analyzer;

  # Should match .nvmrc
  # Also see: https://nixos.wiki/wiki/Node.js#Example_nix_shell_for_Node.js_development
  # (but note building Node from source takes aaages)
  nodejs = pkgs.nodejs-16_x;
in pkgs.mkShell {
  buildInputs = [
    rustToolchain
    rust-analyzer
    pkgs.cargo-watch
    pkgs.cargo-udeps
    pkgs.cargo-audit
    pkgs.cargo-outdated
    pkgs.cargo-tarpaulin
    nodejs
    pkgs.ninja
  ] ++ (if pkgs.stdenv.isDarwin then [
    # Fixes for MacOS Catalina
    # https://github.com/NixOS/nixpkgs/issues/120688
    pkgs.libiconv
    pkgs.darwin.apple_sdk.frameworks.CoreServices
  ] else
    [ ]);
}<commit_msg>Use lib.optionals in shell.nix<commit_after>let
  nixpkgsRev = "605f21e375f0065868023874988164766e7896b0";
  nixpkgs = builtins.fetchTarball {
    name = "nixpkgs-${nixpkgsRev}";
    url = "https://github.com/nixos/nixpkgs/archive/${nixpkgsRev}.tar.gz";
    sha256 = "1mbm0nxkysxi9p4d4v2h6p32rni3wl10qm9hlqa2dy25yzamvjm9";
  };
  pkgs = import nixpkgs { };
  lib = pkgs.lib;

  fenixRev = "9e3384c61656487b10226a3366a12c37393b21d9";
  fenixPackages = import (builtins.fetchTarball {
    name = "fenix-${fenixRev}";
    url = "https://github.com/nix-community/fenix/archive/${fenixRev}.tar.gz";
    sha256 = "10kjfa00fs98cvs137x5kr5dmfblmkz8ya5ribb5l0dnfnpgvf5s";
  }) { };

  rustToolchain = fenixPackages.fromToolchainFile {
    file = ./rust-toolchain.toml;
    sha256 = "5LJRZfmLYjC5UZBmZoLomMz9P5OTjP+te5TI9RX8gZI=";
  };
  inherit (fenixPackages) rust-analyzer;

  # Should match .nvmrc
  # Also see: https://nixos.wiki/wiki/Node.js#Example_nix_shell_for_Node.js_development
  # (but note building Node from source takes aaages)
  nodejs = pkgs.nodejs-16_x;
in pkgs.mkShell {
  buildInputs = [
    rustToolchain
    rust-analyzer
    pkgs.cargo-watch
    pkgs.cargo-udeps
    pkgs.cargo-audit
    pkgs.cargo-outdated
    pkgs.cargo-tarpaulin
    nodejs
    pkgs.ninja
  ] ++ (lib.optionals pkgs.stdenv.isDarwin [
    # Fixes for MacOS Catalina
    # https://github.com/NixOS/nixpkgs/issues/120688
    pkgs.libiconv
    pkgs.darwin.apple_sdk.frameworks.CoreServices
  ]);
}
{'fraction_non_alphanumeric': 0.11961722488038277, 'fraction_numerical': 0.08475734791524266, 'mean_word_length': 3.79050736497545, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 8, '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': '1907466', 'n_tokens_mistral': 1440, 'n_tokens_neox': 1264, 'n_words': 149}