After final improvements to the official formatter implementation,
this commit now performs the first treewide reformat of Nix files using it.
This is part of the implementation of RFC 166.
Only "inactive" files are reformatted, meaning only files that
aren't being touched by any PR with activity in the past 2 months.
This is to avoid conflicts for PRs that might soon be merged.
Later we can do a full treewide reformat to get the rest,
which should not cause as many conflicts.
A CI check has already been running for some time to ensure that new and
already-formatted files are formatted, so the files being reformatted here
should also stay formatted.
This commit was automatically created and can be verified using
nix-build a08b3a4d19.tar.gz \
--argstr baseRev 57b193d8dd
result/bin/apply-formatting $NIXPKGS_PATH
This commit:
- Bumps the nanopb version
- Adds all runtime configuration options
- Implements proper cross-compilation support which is the main use-case of the library.
- Uses newer `finalAttrs` form of `mkDerivation` to allow for easier attribute overrides.
The cross-compilation support is achieved by splitting the package into two sub-packages
consisting of the build-time generator and the runtime library.
Nanopb explicitely supports this by providing specialized `GENERATOR` and
`RUNTIME` CMake configuration options.
The top-level package uses `propagatedNativeBuildInputs` and `propagatedBuildInputs` to propagate
the sub-packages and also adds convenient symlinks to make certain use cases easier.
== GENERATOR ==
The generator is a mostly ready-to-be-packaged python module tree.
We patch the library to also include the missing `__init__.py` and we
also fix the `PYTHON_INSTDIR` variable to follow best practice and to
prevent the library from attempting to install to a global directory.
We package the python module using `buildPythonPackage` and internally
override python in order to wrap the `nanopb_generator.py` executable.
We do *not* wrap `nanob_generator.py` due to it also being imported directly from python when
used through `protoc-gen-nanopb`.
== RUNTIME ==
The runtime is a simple library that consists of the common
functionality among generated headers/sources.
It is configured through `preprocessor definitions` and consumer projects *must*
be compiled with the same definitions.
This is currently achieved by exposing all configuration options through the top-level overrides and
patching the CMakeLists.txt so that the definitions are added to the to-be-installed
CMake targets as PUBLIC properties.