-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Create a nix flake for reproducible development and build environments #165
Conversation
8b88b7b
to
68832f7
Compare
68832f7
to
cab0750
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I love this!!
Still, I want to raise two things.
-
Some chapter to the Bridle Getting Started Guide should really be added to walk users through setting up their workstation with nix
-
Abstracting away the system package dependencies that way is plain fantastic. Pinning down the zephyr pypi requirements is something different to me though. They are moving with the Zepyhr upstream and we need to make sure that these files are kept up to date. I do agree though that this is a blind spot in Zephyr upstream that as of today prevents reproducible builds with the upstream available tooling alone. Looking forward to discussing this further though.
cab0750
to
916a727
Compare
22f3419
to
958a777
Compare
You can find the documentation preview for this PR at this link. It will be updated about 10 minutes after the documentation build succeeds. Note: This comment is automatically posted by the Documentation Publishing GitHub Action. |
I've reworked this a bit, hopefully making it simpler to use and to understand. All python dependencies are now collected in I've also used the Both Finally I've added a section to the documentation on how to start using the flake, although without going into detail on the underlying principles of nix and flakes (that is better explained elsewere, anyway). |
7b3be57
to
bb8a674
Compare
3c61bcd
to
860fc18
Compare
860fc18
to
a86b93e
Compare
In light of west2nix now being available, which in combination with pyproject2nix solves all these problems much more elegantly, I have reworked the flake to use those instead. This has made things much simpler, since python dependencies are resolved directly from the I've also moved the additionally packaged python dependencies into an external repository, so updating them won't require action in this one. |
6f71389
to
78cdbec
Compare
78cdbec
to
acbf6ae
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
many, many thanks for all your efforts. I'm planning to merge this thread in until v3.6.0 release of Bridle on end of March '24.
The provided devshell contains the Zephyr SDK, Zephyr provided host tools, as well as a python environment with all packages specified by Zephyr and Bridle. Signed-off-by: Sarah Renkhoff <[email protected]>
Signed-off-by: Sarah Renkhoff <[email protected]>
Signed-off-by: Sarah Renkhoff <[email protected]>
Signed-off-by: Sarah Renkhoff <[email protected]>
Signed-off-by: Sarah Renkhoff <[email protected]>
Signed-off-by: Sarah Renkhoff <[email protected]>
Signed-off-by: Sarah Renkhoff <[email protected]>
Signed-off-by: Sarah Renkhoff <[email protected]>
2ff6e51
to
e0f9409
Compare
This PR adds a nix flake definition, which provides as output a devshell, i.e. a development environment containing all necessary tools and libraries to work with bridle.
This (optionally) removes the dependency on any distribution packages installed via
apt
(or equivalent) apart from Nix itself, and removes the need forpip
andvirtualenv
entirely.To evaluate the flake, install Nix (the package manager), e.g. by
apt install nix
. Then either addexperimental-features = nix-command flakes
to~/.config/nix/nix.conf
, or add--experimental-features 'nix-command flakes'
to anynix
command.After that, simply navigate to the bridle directory, and run
nix develop
to enter the devshell environment.As a proof-of-concept, the PR also includes a subflake
nix-workspace
, which provides a fully fetched and initialized west workspace. This can be used to define derivations that include west commands, as demonstrated by thebridle-doc
package also provided by the main flake. This makes it possible to generate the full documentation set by runningnix build .#bridle-doc
, also without installing any further dependencies or creating a local workspace.This subflake is auto-generated via a python script, also currently located in
nix-workspace
. This script parses the project's west manifest and generates corresponding flake inputs, which can then be locked. Re-generating the subflake is only needed after manifest changes, otherwise upstream changes will be brought in vianix flake update
as normal.Note that the setup still suffers from an issue with subflakes, which requires building the required outputs from the subflake at least once to create a reference in the local nix store, before the main flake can reference it. In this case this means running
nix build nix-workspace#workspace
.