You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by "comejv (via GitHub)" <gi...@apache.org> on 2025/07/24 19:11:38 UTC
[PR] tools/nix: Add Nix flake for reproducible dev environment [nuttx]
comejv opened a new pull request, #16763:
URL: https://github.com/apache/nuttx/pull/16763
# Add Nix flake for reproducible development environment
This pull request introduces a Nix flake (`flake.nix` and `flake.lock`) to provide a reproducible development shell for NuttX using Nix and flakes.
## Summary
- Adds a `devShell` with all required build tools and dependencies for NuttX, including CMake, Ninja, GNU Make, clang-tools, ARM toolchain, and other utilities (automake, bison, flex, genromfs, gettext, gperf, kconfig-frontends, libelf, expat, gmp, isl, libmpc, mpfr, ncurses, zlib, kconfiglib).
- Uses `flake-utils` to support multiple platforms.
- Sets up a shell hook to enable CMake compile commands and provide a welcome message.
- Based on `nixpkgs` `nixos-unstable` for up-to-date packages.
**Purpose:**
This change simplifies onboarding and ensures a consistent build environment across contributors. By pinning dependencies, it reduces "works on my machine" issues and makes it easier for new developers to get started with NuttX.
**References:**
- Nix Flakes documentation: https://nixos.wiki/wiki/Flakes
- Dependencies gathered from `tools/configure.sh`
## Impact
- **Users:** No impact on runtime or target builds; this only affects developer tooling.
- **Build Process:** Developers can now use `nix develop` to enter a fully provisioned shell with all necessary dependencies.
- **Documentation:** Usage instructions can be added to the repository documentation if desired.
- **Compatibility:** The flake is designed to work on all major platforms supported by Nix.
## Testing
- Verified by running `nix develop` and building NuttX on `x86_64-linux` with `cmake` and `make` (NixOS unstable, GCC ARM toolchain).
- Confirmed that all required tools are available in the shell and that the build completes successfully.
- No changes to target firmware or runtime behavior.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] tools/nix: Add Nix flake for reproducible dev environment [nuttx]
Posted by "xiaoxiang781216 (via GitHub)" <gi...@apache.org>.
xiaoxiang781216 merged PR #16763:
URL: https://github.com/apache/nuttx/pull/16763
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] tools/nix: Add Nix flake for reproducible dev environment [nuttx]
Posted by "anchao (via GitHub)" <gi...@apache.org>.
anchao commented on PR #16763:
URL: https://github.com/apache/nuttx/pull/16763#issuecomment-3182768999
@acassis @xiaoxiang781216 This is a bad start. Package manager configuration should not be merged into the nuttx kernel. If there is a need for manager integration, a wrapper should be made outside the repository instead of polluting the repository code.
There are so many package management projects. Do we plan to add a configuration for each build environment?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] tools/nix: Add Nix flake for reproducible dev environment [nuttx]
Posted by "anchao (via GitHub)" <gi...@apache.org>.
anchao commented on PR #16763:
URL: https://github.com/apache/nuttx/pull/16763#issuecomment-3186584098
> @comejv @anchao @xiaoxiang781216 I don't see Nix support as something bad, of course, there are many Package managers out here, but people are free to add it. After all this is an democratic RTOS. I just suggest including the following information in the header of Nix documentation: "Nix is not the official build system of NuttX, this support was contributed to help people to integrate NuttX easily".
>
> If we need to remove Nix, we need to remove CMakefile, since the official build system is based on Makefile
@comejv @acassis
> Should I revert and create another repo? Or maybe move it into tools? @anchao
> Nix isn't a build system though, it just handles dependencies. But I see your point
Nix is a positive change, especially with the detailed documentation provided in this commit. Thank you for your efforts. @comejv
> I don't see Nix support as something bad, of course, there are many Package managers out here, but people are free to add it. After all this is an democratic RTOS. I just suggest including the following information in the header of Nix documentation: "Nix is not the official build system of NuttX, this support was contributed to help people to integrate NuttX easily".
Similar to Zephyr West, Nuttx doesn't offer official 3-party package management or dependency management framework. If our milestone is Nix, we might need to comprehensively plan the improvements needed for community adoption of this framework (especially since Nuttx-apps has too many of external libraries that require conditional downloads).
From the current commit, it seems that nix only locks the download links and revisions of external dependency libraries, but this information is of no value for the Nuttx. Another problem is that it may not be a good choice to put the configuration file in the top-level directory. We could refer to zephyr or linux, whose top-level directory structure rarely changes and basically does not introduce unofficial configuration files.
https://github.com/torvalds/linux
https://github.com/zephyrproject-rtos/zephyr
I think it would be better if it was relocated to tools or other directories.
@acassis
> If we need to remove Nix, we need to remove CMakefile, since the official build system is based on Makefile
The significance of CMake is completely different. It solves the issue that the Makefile build system in Nuttx cannot be out of tree.
Today's IoT SOCs are becoming increasingly complex, completely different from the MCU chips of 10 years ago. Taking Espressif as an example, there are multiple MCUs in one chip. Using one set of code to compile the firmware of multiple MCUs at the same time is a big problem that the current system needs to solve.
Moreover, the initiator of the CMake improvement is actual user within the community @protobits @dagar . I merely, out of empathy, recognized that this improvement needs to be promoted to prevent NuttX from losing users in multi-MCU architecture SOCs.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] tools/nix: Add Nix flake for reproducible dev environment [nuttx]
Posted by "comejv (via GitHub)" <gi...@apache.org>.
comejv commented on PR #16763:
URL: https://github.com/apache/nuttx/pull/16763#issuecomment-3184290714
Should I revert and create another repo? Or maybe move it into tools? @anchao
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] tools/nix: Add Nix flake for reproducible dev environment [nuttx]
Posted by "acassis (via GitHub)" <gi...@apache.org>.
acassis commented on PR #16763:
URL: https://github.com/apache/nuttx/pull/16763#issuecomment-3186039211
@comejv @anchao @xiaoxiang781216 I don't see Nix support as something bad, of course, there are many Package managers out here, but people are free to add it. At the end it is an democratic RTOS. I just suggest including the following information in the header of Nix documentation: "Nix is not the official build system of NuttX, this support was contributed to help people to integrate NuttX easily".
If we need to remove Nix, we need to remove CMakefile, since the official build system is based on Makefile
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] tools/nix: Add Nix flake for reproducible dev environment [nuttx]
Posted by "acassis (via GitHub)" <gi...@apache.org>.
acassis commented on PR #16763:
URL: https://github.com/apache/nuttx/pull/16763#issuecomment-3189898454
> > @comejv @anchao @xiaoxiang781216 I don't see Nix support as something bad, of course, there are many Package managers out here, but people are free to add it. After all this is an democratic RTOS. I just suggest including the following information in the header of Nix documentation: "Nix is not the official build system of NuttX, this support was contributed to help people to integrate NuttX easily".
> > If we need to remove Nix, we need to remove CMakefile, since the official build system is based on Makefile
>
> @comejv @acassis
>
> > Should I revert and create another repo? Or maybe move it into tools? @anchao
> > Nix isn't a build system though, it just handles dependencies. But I see your point
>
> Nix is a positive change, especially with the detailed documentation provided in this commit. Thank you for your efforts. @comejv
>
> > I don't see Nix support as something bad, of course, there are many Package managers out here, but people are free to add it. After all this is an democratic RTOS. I just suggest including the following information in the header of Nix documentation: "Nix is not the official build system of NuttX, this support was contributed to help people to integrate NuttX easily".
>
> Similar to Zephyr West, Nuttx doesn't offer official 3-party package management or dependency management framework. If our milestone is Nix, we might need to comprehensively plan the improvements needed for community adoption of this framework (especially since Nuttx-apps has too many of external libraries that require conditional downloads).
>
> From the current commit, it seems that nix only locks the download links and revisions of external dependency libraries, but this information is of no value for the Nuttx. Another problem is that it may not be a good choice to put the configuration file in the top-level directory. We could refer to zephyr or linux, whose top-level directory structure rarely changes and basically does not introduce unofficial configuration files.
>
> https://github.com/torvalds/linux https://github.com/zephyrproject-rtos/zephyr
>
> I think it would be better if it was relocated to tools or other directories.
>
> @acassis
>
> > If we need to remove Nix, we need to remove CMakefile, since the official build system is based on Makefile
>
> The significance of CMake is completely different. It solves the issue that the Makefile build system in Nuttx cannot be out of tree. Today's IoT SOCs are becoming increasingly complex, completely different from the MCU chips of 10 years ago. Taking Espressif as an example, there are multiple MCUs in one chip. Using one set of code to compile the firmware of multiple MCUs at the same time is a big problem that the current system needs to solve.
>
> Moreover, the initiator of the CMake improvement is actual user within the community @protobits @dagar . I merely, out of empathy, recognized that this improvement needs to be promoted to prevent NuttX from losing users in multi-MCU architecture SOCs.
Thank you @anchao I got your point.
@comejv Please follow the anchao's suggestion and move it to tools/ and add the comment in the Documentation
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] tools/nix: Add Nix flake for reproducible dev environment [nuttx]
Posted by "comejv (via GitHub)" <gi...@apache.org>.
comejv commented on PR #16763:
URL: https://github.com/apache/nuttx/pull/16763#issuecomment-3119746718
I separated the two commits and fixed the underline being too short in the docs.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] tools/nix: Add Nix flake for reproducible dev environment [nuttx]
Posted by "xiaoxiang781216 (via GitHub)" <gi...@apache.org>.
xiaoxiang781216 commented on PR #16763:
URL: https://github.com/apache/nuttx/pull/16763#issuecomment-3116218377
@comejv please fix the documentation build warning:
```
Warning, treated as error:
/home/runner/work/nuttx/nuttx/Documentation/guides/nix_flake.rst:2:Title underline too short.
Nix Flake for Reproducible Development
====================================
make: *** [Makefile:48: html] Error 2
Error: Process completed with exit code 2.
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] tools/nix: Add Nix flake for reproducible dev environment [nuttx]
Posted by "acassis (via GitHub)" <gi...@apache.org>.
acassis commented on PR #16763:
URL: https://github.com/apache/nuttx/pull/16763#issuecomment-3114780039
@comejv please include a Documentation/ entry to let more people discover and use it.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] tools/nix: Add Nix flake for reproducible dev environment [nuttx]
Posted by "comejv (via GitHub)" <gi...@apache.org>.
comejv commented on PR #16763:
URL: https://github.com/apache/nuttx/pull/16763#issuecomment-3114820138
Woops, not sure if I should have force pushed there...
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] tools/nix: Add Nix flake for reproducible dev environment [nuttx]
Posted by "acassis (via GitHub)" <gi...@apache.org>.
acassis commented on PR #16763:
URL: https://github.com/apache/nuttx/pull/16763#issuecomment-3114981572
> Woops, not sure if I should have force pushed there... But I added a very simple doc page, and added it to the index.rst too. Do I need to do something else? I've never worked with this kind of docs.
Yes, git push forced is fine and it is the way to go.
Please fix this issue in your documentation:
/home/runner/work/nuttx/nuttx/Documentation/guides/nix_flake.rst:2:Title underline too short.
You can build the Documentation locally before submitting: enter inside Documentation/ and run "make html"
If you can please put the Documentation in a separated commit, this way it is easy to track in the Release Note
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] tools/nix: Add Nix flake for reproducible dev environment [nuttx]
Posted by "comejv (via GitHub)" <gi...@apache.org>.
comejv commented on PR #16763:
URL: https://github.com/apache/nuttx/pull/16763#issuecomment-3186313859
Nix isn't a build system though, it just handles dependencies. But I see your point
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org