Skip to content

Commit de46a53

Browse files
authored
Add devbox and pre-commit hook (#637)
To further improve developer experience, this PR adds the following: - devbox for a common development environment - pre-commit hooks for formatting
1 parent ac61f20 commit de46a53

File tree

5 files changed

+533
-0
lines changed

5 files changed

+533
-0
lines changed

.gitattributes

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
devbox.lock binary linguist-generated=true eol=lf
2+

.pre-commit-config.yaml

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
repos:
2+
- repo: https://github.com/doublify/pre-commit-rust
3+
rev: v1.0
4+
hooks:
5+
- id: fmt
6+
- id: cargo-check
7+

README.md

+31
Original file line numberDiff line numberDiff line change
@@ -137,10 +137,41 @@ To build webrtc crate:
137137
cargo build [or clippy or test or fmt]
138138
```
139139

140+
### Devbox
141+
142+
This repo now supports [devbox](https://www.jetify.com/devspace) for a better development experience.
143+
In short, devbox allows to define a development environment by modifying the `PATH` variable in your shell.
144+
It is based on nix and runs on Linux, MacOS, and WSL.
145+
To use devbox, install it from [devbox installation](https://www.jetify.com/docs/devbox/installing_devbox/):
146+
147+
```bash
148+
curl -fsSL https://get.jetify.com/devbox | bash
149+
```
150+
151+
Now you can either use the different devbox scripts:
152+
153+
- test it: `devbox run test`
154+
- build it: `devbox run build`
155+
- format it: `devbux run format`
156+
157+
Or you can enter a shell with everything pre-installed:
158+
159+
```bash
160+
devbox shell
161+
```
162+
140163
## Open Source License
141164

142165
Dual licensing under both MIT and Apache-2.0 is the currently accepted standard by the Rust language community and has been used for both the compiler and many public libraries since (see <https://doc.rust-lang.org/1.6.0/complement-project-faq.html#why-dual-mitasl2-license>). In order to match the community standards, webrtc-rs is using the dual MIT+Apache-2.0 license.
143166

144167
## Contributing
145168

146169
Contributors or Pull Requests are Welcome!!!
170+
171+
If you want to contribute, please be sure to install the pre-commit hooks:
172+
173+
```bash
174+
pre-commit install
175+
```
176+
177+
Or use the devbox environment described above, which will do so automatically.

devbox.json

+41
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
{
2+
"$schema": "https://raw.githubusercontent.com/jetify-com/devbox/0.10.7/.schema/devbox.schema.json",
3+
"packages": {
4+
"git": "latest",
5+
"pre-commit": "latest",
6+
"rustup": "latest",
7+
"libiconv": "latest",
8+
"darwin.apple_sdk.frameworks.SystemConfiguration": {
9+
"platforms": ["x86_64-darwin", "aarch64-darwin"],
10+
},
11+
"darwin.apple_sdk.frameworks.Security": {
12+
"platforms": ["x86_64-darwin", "aarch64-darwin"],
13+
},
14+
"darwin.apple_sdk.frameworks.CoreServices": {
15+
"platforms": ["x86_64-darwin", "aarch64-darwin"],
16+
},
17+
"vim": "latest",
18+
"less": "latest",
19+
"openssh": "latest",
20+
},
21+
"shell": {
22+
"init_hook": [
23+
"pre-commit install",
24+
"if [ ! -d $RUSTUP_HOME/toolchains/stable* ]; then rustup default stable; fi",
25+
],
26+
"scripts": {
27+
"test": [
28+
"cargo test",
29+
],
30+
"build": [
31+
"cargo build",
32+
],
33+
"fmt": [
34+
"cargo fmt",
35+
],
36+
},
37+
},
38+
"env": {
39+
"LS_COLORS": "di=33",
40+
},
41+
}

0 commit comments

Comments
 (0)