Auto merge of #28463 - mkg20001:nixos-mach, r=jdm

add NixOS support to mach and automatically re-launch mach in nix-shell

<!-- Please describe your changes on the following line: -->

This is a followup for #28454 which adds nixos support directly to mach, saving the user from typing `nix-shell` everytime

---
<!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `___` with appropriate data: -->
- [ ] `./mach build -d` does not report any errors
- [ ] `./mach test-tidy` does not report any errors
- [ ] These changes fix #___ (GitHub issue number if applicable)

<!-- Either: -->
- [ ] There are tests for these changes OR
- [x] These changes do not require tests because they just extend mach

<!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.-->

<!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. -->
This commit is contained in:
bors-servo 2021-06-25 10:20:57 -04:00 committed by GitHub
commit d12aa889a6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 22 additions and 1 deletions

View file

@ -383,6 +383,7 @@ def get_linux_distribution():
'debian gnu/linux',
'fedora',
'void',
'nixos',
]:
raise Exception('mach bootstrap does not support %s, please file a bug' % distrib)
@ -398,6 +399,15 @@ def bootstrap(context, force=False, specific=None):
elif "linux-gnu" in host_triple():
distrib, version = get_linux_distribution()
if distrib.lower() == 'nixos':
print('NixOS does not need bootstrap, it will automatically enter a nix-shell')
print('Just run ./mach build')
print('')
print('You will need to run a nix-shell if you are trying to run any of the built binaries')
print('To enter the nix-shell manually use:')
print(' $ nix-shell etc/shell.nix')
return
context.distro = distrib
context.distro_version = version
bootstrapper = LINUX_SPECIFIC_BOOTSTRAPPERS.get(specific, linux)