InfiniTime icon indicating copy to clipboard operation
InfiniTime copied to clipboard

feat: Introduce Flake for development and builds

Open shymega opened this issue 1 year ago • 8 comments

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.

shymega avatar Sep 11 '24 11:09 shymega

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.

shymega avatar Sep 11 '24 11:09 shymega

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.

shymega avatar Sep 11 '24 11:09 shymega

Build size and comparison to main:

Section Size Difference
text 380132B 0B
data 944B 0B
bss 22544B 0B

Run in InfiniEmu

github-actions[bot] avatar Sep 11 '24 11:09 github-actions[bot]

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

shymega avatar Nov 13 '24 21:11 shymega

As someone with no Nix knowledge what steps must I take to test this PR locally?

NeroBurner avatar Mar 16 '25 02:03 NeroBurner

@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.

shymega avatar Mar 24 '25 19:03 shymega

The same principle would apply to InfiniSim :)

shymega avatar Mar 24 '25 19:03 shymega

I should also probably add CI checks for the Nix Flake to this PR and InfiniSim. Thoughts?

shymega avatar Mar 24 '25 19:03 shymega