<commit_before>argsOuter@{...}:
let
  # specifying args defaults in this slightly non-standard way to allow us to include the default values in `args`
  args = rec {
    pkgs = import <nixpkgs> {};
    pythonPackages = pkgs.python36Packages;
    forDev = true;
    localOverridesPath = ./local.nix;
  } // argsOuter;
in (with args; {
  digitalMarketplaceAdminFrontendEnv = (pkgs.stdenv.mkDerivation rec {
    name = "digitalmarketplace-admin-frontend-env";
    shortName = "dm-adm-fe";
    buildInputs = [
      pythonPackages.python
      pkgs.glibcLocales
      pkgs.nodejs-8_x
      pkgs.yarn
      pkgs.libffi
      pkgs.libyaml
      # pip requires git to fetch some of its dependencies
      pkgs.git
      # for `cryptography`
      pkgs.openssl
      pkgs.cacert
    ] ++ pkgs.stdenv.lib.optionals forDev ([
        # for lxml
        pkgs.libxml2
        pkgs.libxslt
        # for frontend tests
        pkgs.phantomjs
      ] ++ pkgs.stdenv.lib.optionals pkgs.stdenv.isDarwin [
        # for watchdog... not that it works on darwin yet anyway, but it will/would need them
        pkgs.darwin.apple_sdk.frameworks.CoreServices
        pkgs.darwin.cf-private
      ]
    );

    hardeningDisable = pkgs.stdenv.lib.optionals pkgs.stdenv.isDarwin [ "format" ];<commit_msg>default.nix: add sitecustomize.py to prioritize non-nix python paths (i.e. the venv ones) over nix ones<commit_after>argsOuter@{...}:
let
  # specifying args defaults in this slightly non-standard way to allow us to include the default values in `args`
  args = rec {
    pkgs = import <nixpkgs> {};
    pythonPackages = pkgs.python36Packages;
    forDev = true;
    localOverridesPath = ./local.nix;
  } // argsOuter;
  sitePrioNonNix = args.pkgs.writeTextFile {
    name = "site-prio-non-nix";
    destination = "/${args.pythonPackages.python.sitePackages}/sitecustomize.py";
    text = ''
      import sys
      first_nix_i = next((i for i, p in enumerate(sys.path) if p.startswith("/nix/")), 1)
      # after the first nix-provided path in sys.path (presumably the python stdlib itself), re-sort all non-nix
      # paths to be before the nix paths. this is helped by python's sort being a stable-sort
      sys.path[first_nix_i+1:] = sorted(sys.path[first_nix_i+1:], key=lambda p: p.startswith("/nix/"))
    '';
  };
in (with args; {
  digitalMarketplaceAdminFrontendEnv = (pkgs.stdenv.mkDerivation rec {
    name = "digitalmarketplace-admin-frontend-env";
    shortName = "dm-adm-fe";
    buildInputs = [
      pythonPackages.python
      sitePrioNonNix
      pkgs.glibcLocales
      pkgs.nodejs-8_x
      pkgs.yarn
      pkgs.libffi
      pkgs.libyaml
      # pip requires git to fetch some of its dependencies
      pkgs.git
      # for `cryptography`
      pkgs.openssl
      pkgs.cacert
    ] ++ pkgs.stdenv.lib.optionals forDev ([
        # for lxml
        pkgs.libxml2
        pkgs.libxslt
        # for frontend tests
        pkgs.phantomjs
      ] ++ pkgs.stdenv.lib.optionals pkgs.stdenv.isDarwin [
        # for watchdog... not that it works on darwin yet anyway, but it will/would need them
        pkgs.darwin.apple_sdk.frameworks.CoreServices
        pkgs.darwin.cf-private
      ]
    );

    hardeningDisable = pkgs.stdenv.lib.optionals pkgs.stdenv.isDarwin [ "format" ];
{'fraction_non_alphanumeric': 0.10268948655256724, 'fraction_numerical': 0.0033618581907090463, 'mean_word_length': 2.5731441048034935, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 4}, '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': '285023', 'n_tokens_mistral': 1182, 'n_tokens_neox': 1097, 'n_words': 262}