feat: Introduce Flake for development and builds
This PR introduces a Nix flake, allowing for InfiniTime to be built as a Flake, including a FHS development environment.
It's derived from #1850 and https://github.com/icewind1991/infinitime-builder/commit/c57c57f3c6a34c86eb816981d9b0ea56af4a09e5.
We also introduce flake-compat, allowing for non-Flake Nix mahcines to use the project as-is, both for building (default.nix), and development (shell.nix).
Additionally, we introduce .envrc, meaning that with direnv, the Nix Flake is activated automatically.
Fixes #1850.
I'm keeping this as a draft for now, because I want to check with the InfiniTime maintainers, that I'm using the correct nRF SDK, and GCC toolchain.
I also wanted to ask if the .envrc is acceptable as well.
Thanks.
We also need to document the Flake, and possibly add CI.
I can add the CI workflows to a new PR if needed. However, I'm not sure how documentation works in this project.
Build size and comparison to main:
| Section | Size | Difference |
|---|---|---|
| text | 380132B | 0B |
| data | 944B | 0B |
| bss | 22544B | 0B |
This PR is now ready for review. It is currently blocking https://github.com/InfiniTimeOrg/InfiniSim/pull/148, but once this PR merged, the [InfiniSim] one will be ready to be merged too
As someone with no Nix knowledge what steps must I take to test this PR locally?
@NeroBurner You would first need to install the Nix package manager. In terms of testing, you could test the Flake is correct by running nix flake check, and then to build the actual firmware, nix build would build the firmware, and output to result, which is a symlinked directory.
The same principle would apply to InfiniSim :)
I should also probably add CI checks for the Nix Flake to this PR and InfiniSim. Thoughts?