From a2446b4ea1efd0b2a78bc4e885cb3d4d7996f144 Mon Sep 17 00:00:00 2001 From: Richard Marko Date: Sun, 12 Apr 2020 13:27:07 +0200 Subject: [PATCH] README: add Hacking section Co-Authored-By: Cole Helbling --- README.md | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/README.md b/README.md index eec6549..523318a 100644 --- a/README.md +++ b/README.md @@ -229,6 +229,46 @@ corruption. See also: https://github.com/NixOS/ofborg/wiki/Operating-a-Builder +# Hacking + +```shell +$ git clone https://github.com/NixOS/ofborg/ +$ cd ofborg +$ nix-shell ./shell.nix +$ cd ofborg # enter the subdirectory with Rust code +# make your changes +$ cargo build +$ cargo check +$ cargo test +``` + +To test whether or not Continuous Integration will pass with your changes, you +can run the following commands from the root of your checkout: + +```shell +$ nix-shell --run checkPhase -A mozilla-rust-overlay # checks rustfmt and clippy +$ nix-shell --run checkPhase # runs the test suite +$ nix-build -A ofborg.rs # build ofborg +``` + +Currently there is no easy way to set up a test instance of ofborg. If `cargo +check` and `cargo test` both succeed, feel free to Pull Request your changes. +Make sure to format your code with `cargo fmt` and check for additional warnings +with `cargo clippy`. If you added, removed, or updated the dependencies, also be +sure to update Carnix by running +[`./nix/update-carnix.sh`](./nix/update-carnix.sh). + +To disable warnings as errors, run your command with an empty `RUSTFLAGS`. For +example: + +```shell +$ RUSTFLAGS= cargo clippy +``` + +This will override the default of `-D warnings` set in +[`shell.nix`](./shell.nix), which tells Rust to error if it detects any +warnings. + ## old php stuff... Only Graham needs to do this, since I run the only remaining PHP