Thanks for your interest in contributing to this project! PRs and issues are welcome.
For larger changes, please start a discussion by creating an issue.
First, make sure you can build and run the project:
- Ensure you have Rust and Docker installed.
- Checkout this repo:
git clone https://github.com/railwayapp/nixpacks.git
- Build the source:
cargo build
- Run the tests:
cargo test
- Build an example:
cargo run -- build examples/node --name node
- Run the example:
docker run node
You should see Hello from Node
printed to the console.
When debugging it can be useful to see the intermediate files that Nixpacks generates (e.g. Dockerfile
). You can do this by saving the build artifact to a specific directory instead of to a temp dir, by executing the following command:
cargo run -- build examples/node --out test
Note: The test
directory will contain everything that would be built with Docker. All the files that Nixpacks generates are in .nixpacks
. You can manually build the image with docker build test -f test/.nixpacks/Dockerfile
.
Nixpacks uses insta for snapshot tests. We use snapshot tests to generate and compare all build plans for the test apps in examples/
. If a snapshot test fails due to a change to a provider, that is okay. It just means the snapshot needs to be reviewed and accepted. To test and review all snapshots, you can
- Install insta:
cargo install cargo-insta
- Test and review the generate plan tests:
cargo insta test --review --test generate_plan_tests
orcargo snapshot
The snapshots are checked into CI and are reviewed as part of every PR. They ensure that a change to one part of Nixpacks does not unexpectedly change an unrelated part.
Read the docs for more information on cargo insta
.
The easiest way to contribute is to add support for new languages. There is a list of languages we would like to add here, but languages not on the list are welcome as well. To gauge interest you can always create an issue before working on an implementation.
To make a PR follow GitHubs guide.
PRs are all checked with
cargo check
cargo test
cargo clippy
so you can run these locally to ensure CI passes.
Most PRs should include tests.