-
Notifications
You must be signed in to change notification settings - Fork 896
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
Begin supporting nix flakes build system #4238
Conversation
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'm not the one with the final say on this PR, but I think it should include a GitHub Actions job that verifies that the flake continues to build.
How often do you have to update the lockfile?
Does it make sense to have a flake without the lock file? Is that even possible? |
I think it doesn't make much sense, because one of the main purposes of nix is to provide reproducibility. That's why this PR provides both flake.nix and flake.lock |
I understand the value of reproducibility, but I am not convinced we want to maintain a pinned version of compilers and other dependencies as part of the source tree. I worry that would mean a collection of stale hashes which will get updated irregularly. If we only include the flake without the lock file, that would still mean others can supply their lock files easily, if they wish to pin the dependencies and establish reproducibility. We will just supply the Nix building instructions as part of the source tree. |
Updating the lock file is easy with nix flake update (https://nixos.org/manual/nix/stable/command-ref/new-cli/nix3-flake-update.html). You can even update one input only. If no lock file is committed to the repo, and there is github action for building with nix, that building process would pull a different nixpkgs every time, because nixpkgs (https://github.com/NixOS/nixpkgs) gets a lot of activity. For example at the time of writing this comment, the last commit was only 46 minutes ago. So I would propose committing the lock file, and maybe creating a bot that updates the lock from time to time? |
The key question is: What happens when the build breaks? If YosysHQ has someone who can and will fix the build, that makes it no different than any other source of breakage, whether it's broken immediately after a nixpkgs update, or at night when the cronjob runs. (For example upstream changes in iverilog recently broke our builds.) If YosysHQ does not, then the flake should probably just not be in the repo. |
Actually, one advantage of having the flake lockfile be committed that I think no one brought up yet is that it enables people to keep building historical revisions of Yosys in the exact environment that passed CI. @povik Is this something that will change how you feel about committing the lockfile? |
I have created a repo to maintain the flake out of tree: https://github.com/RCoeurjoly/yosys_flake/tree/main. I think @whitequark is right in that adding flake to this repo would create a burden on YosysHQ maintainers, so better to maintain it out of tree, kind of like how yosys is in nixpkgs right now. Thoughts? |
We have discussed this among Yosys maintainers and have come up with a plan to:
|
4ad1c52
to
bee2ad4
Compare
Just to be sure @RCoeurjoly, I am not asking you to implement all of it, @mmicko and I can look into some of it too, though any work you would do towards the plan is welcome, and would bring the flake getting merged closer. |
Sounds reasonable.
This behavior from nix is expected, since nix tries to be hermetic and one of the parts of that is not accessing the network, because cloning a repo at two different time points would result in two different packages, or derivations (in nix lingo). Options available of the top of my head:
|
It should be a submodule. It only isn't a submodule because I once tried to convert it to a submodule but some other horrors in the Yosys Makefile caused me to waste three days on it, after which I swore I will never attempt to improve Yosys Makefile again. I wish you luck. |
While it may make sense to make abc a submodule from a conceptual sense, I think this is too much of change affecting downstream users of Yosys to couple it to the work on the Nix flake. If abc can be made an input to the flake, I would go with that for now. |
I disagree with this reasoning. I think it should have been made a submodule years ago instead of whatever the hell it is right now. The current situation has been negatively affecting users of Yosys for long enough that it should just be fixed, and the current time is as good as any. |
I suppose we shouldn't not try fixing the status quo because it is the status quo, but it seems valid not to want to couple this to another large task. |
@RCoeurjoly How do you feel about converting @povik Generally speaking yes, but it's not like we're under pressure to ship flakes ASAP. |
Yes, my strong preference would be for abc to be a submodule, because it would enable us to compile inside the devShell. Otherwise, if abc is a flake input, working inside the devShell would be very inconvenient. |
Then I'd say let's make it into a submodule. I will have to redo a bunch of my build scripts and I will do it with joy. (I think mainly just replacing |
No contest here. Roland, if you want to tackle this, then please go ahead! |
I think adding abc as a submodule would be best done in another PR. |
Please be aware that use case where user downloads abc.tar.gz from release page and unpacks it in abc directory should also continue to work. |
I've written my own
I have tested this with |
How do you deal with the abc dependency? I am working on that here #4243 |
I didn't deal with it probably because I built it first with an impure shell which pulled in the dependency. I retried with a pure shell in a fresh checkout and it does indeed fail. I'm definitely in favor of a submodule |
So far there is:
Follow up actions would be to: