Merge pull request #309460 from r-ryantm/auto-update/home-manager
[NixPkgs.git] / pkgs / build-support / rust / sysroot / cargo.py
blob9d970eff79e8800d8039f738c1a0c76252a80691
1 import os
2 import toml
4 rust_src = os.environ['RUSTC_SRC']
5 orig_cargo = os.environ['ORIG_CARGO'] if 'ORIG_CARGO' in os.environ else None
7 base = {
8 'package': {
9 'name': 'nixpkgs-sysroot-stub-crate',
10 'version': '0.0.0',
11 'authors': ['The Rust Project Developers'],
12 'edition': '2018',
14 'dependencies': {
15 'compiler_builtins': {
16 'version': '0.1.0',
17 'features': ['rustc-dep-of-std', 'mem'],
19 'core': {
20 'path': os.path.join(rust_src, 'core'),
22 'alloc': {
23 'path': os.path.join(rust_src, 'alloc'),
26 'patch': {
27 'crates-io': {
28 'rustc-std-workspace-core': {
29 'path': os.path.join(rust_src, 'rustc-std-workspace-core'),
31 'rustc-std-workspace-alloc': {
32 'path': os.path.join(rust_src, 'rustc-std-workspace-alloc'),
38 if orig_cargo is not None:
39 with open(orig_cargo, 'r') as f:
40 src = toml.loads(f.read())
41 if 'profile' in src:
42 base['profile'] = src['profile']
44 out = toml.dumps(base)
46 with open('Cargo.toml', 'x') as f:
47 f.write(out)