|
| 1 | +# [hyperion.rs](https://github.com/vtavernier/hyperion.rs) |
| 2 | + |
| 3 | +[](https://github.com/vtavernier/hyperion.rs/actions) |
| 4 | +[](https://vtavernier.github.io/hyperion.rs/hyperion/) |
| 5 | +[](LICENSE) |
| 6 | + |
| 7 | +hyperion.rs is a rewrite of |
| 8 | +[hyperion.ng](https://github.com/hyperion-project/hyperion.ng) in the Rust |
| 9 | +Programming Language. This version features: |
| 10 | + |
| 11 | +* Very low resource requirements (can be run on a single thread, useful for the |
| 12 | + Raspberry Pi Zero for example) |
| 13 | +* No memory leaks (most allocations are static anyways) |
| 14 | +* Easy to compile *and* cross-compile |
| 15 | + |
| 16 | +***Disclaimer: this is an early work-in-progress***: |
| 17 | +* A lot of internals may still change, in case you would like to contribute |
| 18 | + please contact me beforehand. |
| 19 | +* Only a small subset of the original project's features are currently |
| 20 | + supported. This means that unless you're using it in the exact same context as |
| 21 | + I am (Android TV Grabber + Raspberry Pi Zero W + WS2815 LED strip), this might |
| 22 | + not be for you. |
| 23 | + |
| 24 | +## Compatibility |
| 25 | + |
| 26 | +Currently implemented features: |
| 27 | + |
| 28 | +* Loading settings from the hyperion.ng database |
| 29 | +* Basic WS2812SPI device (no invert, no latch time) |
| 30 | +* JSON, Protobuf and Flatbuffers server |
| 31 | + |
| 32 | +## Migrating your settings |
| 33 | + |
| 34 | +Due to the ORM being used in this project, we need the settings database to have |
| 35 | +primary keys setup. This doesn't change the schema, but to ensure compatibility, |
| 36 | +it is best to use a separate database for hyperion.ng and hyperion.rs. |
| 37 | + |
| 38 | +This process will be more streamlined in the future, but for testing purposes |
| 39 | +you can follow these instructions: assuming you have the sqlite3 client |
| 40 | +installed, and you are in your home directory, with hyperion.rs being a clone of |
| 41 | +this repository: |
| 42 | + |
| 43 | +```bash |
| 44 | +# Create config directory for hyperion.rs |
| 45 | +$ mkdir -p .config/hyperion.rs/ |
| 46 | + |
| 47 | +# (if not done already) Install the ORM client diesel |
| 48 | +$ cargo install --force diesel_cli |
| 49 | + |
| 50 | +# Setup the database |
| 51 | +$ (cd hyperion.rs && DATABASE_URL=$HOME/.config/hyperion.rs/hyperion.db diesel setup) |
| 52 | + |
| 53 | +# Open sqlite3 |
| 54 | +$ sqlite3 |
| 55 | +> ATTACH ".hyperion/db/hyperion.db" AS db1; -- Attach the original hyperion.ng database |
| 56 | +> ATTACH ".config/hyperion.rs/hyperion.db" AS db2; -- Attach the new hyperion.rs database |
| 57 | +> -- Copy the tables |
| 58 | +> BEGIN TRANSACTION; |
| 59 | +> INSERT INTO db2.instances SELECT * FROM db1.instances; |
| 60 | +> INSERT INTO db2.auth SELECT * FROM db1.auth; |
| 61 | +> INSERT INTO db2.meta SELECT * FROM db1.meta; |
| 62 | +> INSERT INTO db2.settings SELECT * FROM db1.settings; |
| 63 | +> COMMIT; |
| 64 | +``` |
| 65 | + |
| 66 | +## Running hyperion.rs |
| 67 | + |
| 68 | +Once your settings database has been migrated, you can run hyperion.rs using |
| 69 | +`cargo`: |
| 70 | + |
| 71 | +```bash |
| 72 | +$ cargo run |
| 73 | +``` |
| 74 | + |
| 75 | +If running from a release archive, invoke the `hyperiond-rs` binary directly. |
| 76 | + |
| 77 | +## Cross-compiling |
| 78 | + |
| 79 | +Cross-compiling is done using [cross](https://github.com/rustembedded/cross). As |
| 80 | +hyperion.rs has native dependencies, we first need to prepare a Docker image |
| 81 | +with the required dependencies, and then build using the resulting image. |
| 82 | + |
| 83 | +*Note: these images will be published on dockerhub as the project stabilizes.* |
| 84 | + |
| 85 | +Let's say we are building for the Raspberry Pi Zero, which corresponds to the |
| 86 | +Rust target arm-unknown-linux-gnueabihf. |
| 87 | + |
| 88 | +```bash |
| 89 | +$ export TARGET=arm-unknown-linux-gnueabihf |
| 90 | + |
| 91 | +# Build the Docker image |
| 92 | +$ (cd docker && docker build . -f Dockerfile.$TARGET -t vtavernier/cross-hyperion:$TARGET) |
| 93 | + |
| 94 | +# (if not done already) Install cross |
| 95 | +$ cargo install --force cross |
| 96 | + |
| 97 | +# Build the project |
| 98 | +$ cross build --release --target $TARGET |
| 99 | + |
| 100 | +# The resulting binaries will be in target/$TARGET/release |
| 101 | +``` |
| 102 | + |
| 103 | +## License |
| 104 | + |
| 105 | +This work is licensed under the [MIT License](LICENSE). |
| 106 | + |
| 107 | +## Author |
| 108 | + |
| 109 | +Vincent Tavernier < [email protected]>. Original project and protocol |
| 110 | +source files by [hyperion-project](https://github.com/hyperion-project). |
0 commit comments