Skip to content

Commit

Permalink
Add devbox and pre-commit hook (#637)
Browse files Browse the repository at this point in the history
To further improve developer experience, this PR adds the following:
- devbox for a common development environment
- pre-commit hooks for formatting
  • Loading branch information
ineiti authored Nov 21, 2024
1 parent ac61f20 commit de46a53
Show file tree
Hide file tree
Showing 5 changed files with 533 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
devbox.lock binary linguist-generated=true eol=lf

7 changes: 7 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
repos:
- repo: https://github.com/doublify/pre-commit-rust
rev: v1.0
hooks:
- id: fmt
- id: cargo-check

31 changes: 31 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -137,10 +137,41 @@ To build webrtc crate:
cargo build [or clippy or test or fmt]
```

### Devbox

This repo now supports [devbox](https://www.jetify.com/devspace) for a better development experience.
In short, devbox allows to define a development environment by modifying the `PATH` variable in your shell.
It is based on nix and runs on Linux, MacOS, and WSL.
To use devbox, install it from [devbox installation](https://www.jetify.com/docs/devbox/installing_devbox/):

```bash
curl -fsSL https://get.jetify.com/devbox | bash
```

Now you can either use the different devbox scripts:

- test it: `devbox run test`
- build it: `devbox run build`
- format it: `devbux run format`

Or you can enter a shell with everything pre-installed:

```bash
devbox shell
```

## Open Source License

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.

## Contributing

Contributors or Pull Requests are Welcome!!!

If you want to contribute, please be sure to install the pre-commit hooks:

```bash
pre-commit install
```

Or use the devbox environment described above, which will do so automatically.
41 changes: 41 additions & 0 deletions devbox.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
{
"$schema": "https://raw.githubusercontent.com/jetify-com/devbox/0.10.7/.schema/devbox.schema.json",
"packages": {
"git": "latest",
"pre-commit": "latest",
"rustup": "latest",
"libiconv": "latest",
"darwin.apple_sdk.frameworks.SystemConfiguration": {
"platforms": ["x86_64-darwin", "aarch64-darwin"],
},
"darwin.apple_sdk.frameworks.Security": {
"platforms": ["x86_64-darwin", "aarch64-darwin"],
},
"darwin.apple_sdk.frameworks.CoreServices": {
"platforms": ["x86_64-darwin", "aarch64-darwin"],
},
"vim": "latest",
"less": "latest",
"openssh": "latest",
},
"shell": {
"init_hook": [
"pre-commit install",
"if [ ! -d $RUSTUP_HOME/toolchains/stable* ]; then rustup default stable; fi",
],
"scripts": {
"test": [
"cargo test",
],
"build": [
"cargo build",
],
"fmt": [
"cargo fmt",
],
},
},
"env": {
"LS_COLORS": "di=33",
},
}
Loading

0 comments on commit de46a53

Please sign in to comment.