|
1 |
| -A template Rust project with fully functional and no-frills Nix support, as well as builtin VSCode configuration to get IDE experience without any manual setup (just [install direnv](https://nixos.asia/en/direnv), open in VSCode and accept the suggestions). It uses [crane](https://crane.dev/), via [rust-flake](https://github.com/juspay/rust-flake). |
| 1 | +# HWML |
2 | 2 |
|
3 |
| -> [!NOTE] |
4 |
| -> If you are looking for the original template based on [this blog post](https://srid.ca/rust-nix)'s use of `crate2nix`, browse from [this tag](https://github.com/srid/hwml/tree/crate2nix). The evolution of this template can be gleaned from [releases](https://github.com/srid/hwml/releases). |
| 3 | +[](https://github.com/youngar/hwml-rs/actions/workflows/ci.yml) |
5 | 4 |
|
6 |
| -## Usage |
| 5 | +HWML is an in-development hardware description language equiped with a powerful metaprogramming layer. |
7 | 6 |
|
8 |
| -You can use [omnix](https://omnix.page/om/init.html)[^omnix] to initialize this template: |
| 7 | +```hwml |
| 8 | +meta def option.map {a} {b} (f : ^a -> ^b)) (x : ^(option a)) : ^(option b) = |
| 9 | + match x with |
| 10 | + | some v => f v |
| 11 | + | none => none |
9 | 12 | ```
|
10 |
| -nix --accept-flake-config run github:juspay/omnix -- init github:srid/hwml -o ~/my-rust-project |
11 |
| -``` |
12 |
| - |
13 |
| -[^omnix]: If initializing manually, make sure to: |
14 |
| - - Change `name` in Cargo.toml. |
15 |
| - - Run `cargo generate-lockfile` in the nix shelld |
16 |
| - |
17 |
| -## Adapting this template |
18 |
| - |
19 |
| -- There are two CI workflows, and one of them uses Nix which is slower (unless you configure a cache) than the other one based on rustup. Pick one or the other depending on your trade-offs. |
20 |
| - |
21 |
| -## Development (Flakes) |
22 |
| - |
23 |
| -This repo uses [Flakes](https://nixos.asia/en/flakes) from the get-go. |
24 |
| - |
25 |
| -```bash |
26 |
| -# Dev shell |
27 |
| -nix develop |
28 |
| - |
29 |
| -# or run via cargo |
30 |
| -nix develop -c cargo run |
31 |
| - |
32 |
| -# build |
33 |
| -nix build |
34 |
| -``` |
35 |
| - |
36 |
| -We also provide a [`justfile`](https://just.systems/) for Makefile'esque commands to be run inside of the devShell. |
37 |
| - |
38 |
| -## Tips |
39 |
| - |
40 |
| -- Run `nix flake update` to update all flake inputs. |
41 |
| -- Run `nix --accept-flake-config run github:juspay/omnix ci` to build _all_ outputs. |
42 |
| -- [pre-commit] hooks will automatically be setup in Nix shell. You can also run `pre-commit run -a` manually to run the hooks (e.g.: to autoformat the project tree using `rustfmt`, `nixpkgs-fmt`, etc.). |
43 |
| - |
44 |
| -## Discussion |
45 |
| - |
46 |
| -- [Zulip](https://nixos.zulipchat.com/#narrow/stream/413950-nix) |
47 |
| - |
48 |
| -## See Also |
49 | 13 |
|
50 |
| -- [nixos.wiki: Packaging Rust projects with nix](https://nixos.wiki/wiki/Rust#Packaging_Rust_projects_with_nix) |
| 14 | +## Documentation |
| 15 | +- [Development](./doc/Development.md) |
0 commit comments