def main(): pwd = dirname(realpath(__file__)) os.environ['py_ver_str'] = '3.7.5' os.environ['system'] = 'x86_64-linux' os.environ['out_file'] = f'{pwd}/overrides.nix' os.environ['disable_checks'] = 'true' with open(pwd + "/../mach_nix/provider_defaults.toml") as f: provider_settings = toml.load(f) if os.path.isfile("./providers.toml"): with open(pwd + "./providers.toml") as f: provider_settings.update(toml.load(f)) provider_settings.update(dict( # _default = "conda" )) os.environ['providers'] = json.dumps(provider_settings) nixpkgs_json = tempfile.mktemp() cmd = f'nix-build {pwd}/../mach_nix/nix/nixpkgs-json.nix -o {nixpkgs_json} --show-trace' sp.check_call(cmd, shell=True) os.environ['nixpkgs_json'] = nixpkgs_json pypi_deps_db = tempfile.mktemp() cmd = f'nix-build {pwd}/../mach_nix/nix/deps-db-and-fetcher.nix -A pypi_deps_db_src -o {pypi_deps_db} --show-trace' sp.check_call(cmd, shell=True) os.environ['pypi_deps_db_src'] = pypi_deps_db providers = tempfile.mktemp() cmd = f'nix-build {pwd}/../mach_nix/nix/lib.nix -A parseProvidersToJson -o {providers} --show-trace' sp.check_call(cmd, shell=True) os.environ['providers'] = providers conda_channels_json = tempfile.mktemp() cmd = f'nix-build {pwd}/../mach_nix/nix/conda-channels.nix -A condaChannelsJson -o {conda_channels_json} --show-trace' sp.check_call(cmd, shell=True) os.environ['conda_channels_json'] = conda_channels_json for key in ('PYPI_FETCHER_COMMIT', 'PYPI_FETCHER_SHA256'): with open(f"{pypi_deps_db}/{key}") as f: os.environ[key.lower()] = f.read() with open(pwd + "/reqs.txt") as f: os.environ['requirements'] = f.read() # generates and writes nix expression into ./debug/expr.nix start = time() generate.main() dur = round(time() - start, 1) print(f"resolving took: {dur}s")
os.environ['py_ver_str'] = '3.7.5' os.environ['out_file'] = f'{pwd}/expr.nix' os.environ['disable_checks'] = 'true' os.environ['prefer_nixpkgs'] = 'true' nixpkgs_json = tempfile.mktemp() cmd = f'nix-build {pwd}/nixpkgs-json.nix -o {nixpkgs_json}' print(cmd) sp.check_call(cmd, shell=True) os.environ['nixpkgs_json'] = nixpkgs_json pypi_deps_db = tempfile.mktemp() cmd = f'nix-build {pwd}/pypi-deps-db.nix -o {pypi_deps_db}' sp.check_call(cmd, shell=True) os.environ['pypi_deps_db_data_dir'] = pypi_deps_db + "/data" for key in ('NIXPKGS_COMMIT', 'NIXPKGS_TARBALL_SHA256'): with open(f"{pwd}/../mach_nix/nix/{key}") as f: os.environ[key.lower()] = f.read() for key in ('PYPI_FETCHER_COMMIT', 'PYPI_FETCHER_TARBALL_SHA256'): with open(f"{pypi_deps_db}/{key}") as f: os.environ[key.lower()] = f.read() os.environ['requirements'] = 'requests' # generates and writes nix expression into ./debug/expr.nix main()