-
-
Notifications
You must be signed in to change notification settings - Fork 40.1k
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
[nix] Use niv and poetry2nix to more easily manage dependencies #11181
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.
#pragma weak
Is it possible to either update this more often or not pin versions? MILC is up to version 1.0.12 and we'll be releasing a new version that pulls in deps |
If versions weren't pinned, how would the newer MILC get picked up? Are you thinking you would just get it updated in In general pinning is exactly the right thing to do to make this work reliably, but of course manually bumping hashes etc. is not super convenient. If the project were to have a poetry manifest for the python deps then it would be pretty easy to automate this with poetry2nix, which can grab arbitrary pypi package versions (instead of being restricted to those registered in nixpkgs), but probably using poetry is a larger change that would need socialisation. |
For better or worse most platforms get "whatever the latest" is at install time. Our story for keeping everyone up to date is still being written. I recognize that this does not guarantee that it's always installable, but in practice we haven't run into an issue yet. This isn't a permanent situation, but it is the current situation. Homebrew users have pinned versions due to the nature of how homebrew works, but we have people within qmk motivated to keep that up to date. I'd like to make sure nix users aren't left behind if they're to be pinned as well. |
There's probably a few of us who'd be willing to make sure updates get into nixpkgs too. |
Could we start with this PR? Both hjson and MILC have updates. |
@purcell @skullydazed if I read this correctly, we were waiting on updates to python packages? What's the status? |
I've pushed some changes here that improve the Python side of the nix environment and allow us to have recent packages without explicitly overriding anything: we add a Poetry manifest, and then use poetry2nix to create our python env from that. I need to do a little more testing locally, but this should be much easier to maintain. |
Okay, this has now been rebased against master, includes the latest python dependencies listed there, and with this code I can use the |
This is pretty clever, but unfortunately we won't be able to accept |
Yeah, that should be possible. A |
I've made that change (using "nix" as the subdir) and I've also switched to "niv" for managing the pinned nixpkgs version, for easy future updates (e.g. "niv update nixpkgs"). |
I updated this to a newer nixpkgs snapshot too, just to keep things more current. I verified that I can still build a randomly-selected firmware. |
#12295 can be merged NOW, while this more advanced PR here is being discussed along with the general approach to python dependencies in qmk. |
I don't think this one should be too controversial tbh. I made the changes suggested by @skullydazed, and @fauxpark was in favour. |
As said in the other PR, I'm very much in favor of the poetry to nix approach here. Just saying the other one is a quick no-brainer. This one should be merged eventually, too (or now if people are happy). |
Got it, thanks for the support. |
Ugh, must have closed this by accident, apologies. I'll resolve the conflict now. |
The older nixpkgs snapshot did not contain nix changes to the compiler/linker hooks that are necessary for compatibility with MacOS Big Sur. The fix is simply to update to a newer snapshot.
There we go, just building locally to confirm. I'll update the PR description, though, since an interim update to shell.nix will technically have resolved the Big Sur compatibility issue. |
Confirmed working. |
Thanks for the merge, @skullydazed. |
…11181) * [nix] Update nixpkgs to avoid issues with Big Sur The older nixpkgs snapshot did not contain nix changes to the compiler/linker hooks that are necessary for compatibility with MacOS Big Sur. The fix is simply to update to a newer snapshot. * [nix] Add a poetry manifest and use poetry to build the Python env * [nix] Use niv to manage upstream sources like nixpkgs * [nix] Update to newer nixpkgs snapshot * [nix] Bump python package versions
…11181) * [nix] Update nixpkgs to avoid issues with Big Sur The older nixpkgs snapshot did not contain nix changes to the compiler/linker hooks that are necessary for compatibility with MacOS Big Sur. The fix is simply to update to a newer snapshot. * [nix] Add a poetry manifest and use poetry to build the Python env * [nix] Use niv to manage upstream sources like nixpkgs * [nix] Update to newer nixpkgs snapshot * [nix] Bump python package versions
…11181) * [nix] Update nixpkgs to avoid issues with Big Sur The older nixpkgs snapshot did not contain nix changes to the compiler/linker hooks that are necessary for compatibility with MacOS Big Sur. The fix is simply to update to a newer snapshot. * [nix] Add a poetry manifest and use poetry to build the Python env * [nix] Use niv to manage upstream sources like nixpkgs * [nix] Update to newer nixpkgs snapshot * [nix] Bump python package versions
Description
Here are some changes that improve the Python side of the nix environment and allow us to have recent packages without explicitly overriding anything: we add a Poetry manifest, and then use poetry2nix to create our python env from that. Additionally, the popular niv tool is introduced and used to manage the nixpkgs version.
In their basic form, these changes probably appear barely worth the effort: bear in mind, though, that the python packages are constantly evolving in PyPi while they are only intermittently frozen in nixpkgs, which means that if the qmk python dependencies need to be updated, then nix overrides or nixpkgs pull requests can be necessary in order to make those python packages available. The poetry2nix route instead allows the latest pypi packages to be pulled in, and this can be done independently of nixpkgs updates.
Types of Changes
Issues Fixed or Closed by This PR
N/A
Checklist