-
Notifications
You must be signed in to change notification settings - Fork 54
Fix Nix builds: force use of pyproject, fix pynrfjprog dependency spec #123
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
base: master
Are you sure you want to change the base?
Conversation
3993d27
to
dcbe3bc
Compare
I have also make @bradjc Is this still true? It turns out that there is no way to declare a dependency as optional in |
dcbe3bc
to
f2df5a6
Compare
|
As in literally |
I'm no Python expert, but yes, I believe that is how that works. See: https://stackoverflow.com/a/13681679 For what its worth, I agree with your frustration and really dislike Python's approach. On the other hand, with pyproject I don't think there's any other way that we can support optional dependencies. I can see whether there's a way around this. https://github.com/NordicSemiconductor/pynrfjprog itself is licensed under the "Nordic 5-Clause License" and ships with the required pre-built libraries (even though they are from the |
I have to say I'm pretty displeased with Python at this point. I wish there was a fork that kept the same language but got rid of all of these packaging headaches and just implemented reasonable features. For example, this proposal is frankly obvious and does not require a lengthy discussion. That all being said, unfortunately pynrfjprog makes |
@bradjc I managed to get the package switched over to this repository (away from the binary This is licensed under the Nordic 5-Clause license, which, amongst other restrictions does not allow reverse engineering, or using the software for non-Nordic chips: https://devzone.nordicsemi.com/nordic/nordic-blog/b/blog/posts/introducing-nordics-new-software-licensing-schemes As such, it's still very much unfree software. Therefore, Tockloader, with this as a required dependency, cannot be used without installing unfree software. This is a shame generally, but also means that users of package managers like Nix will be unable to install Tockloader without explicitly enabling unfree packages. It also disqualifies Tockloader from inclusion in many distribution's repositories. So I'd really like for us to figure out how to make this an optional dependency. |
I believe that the best and easiest path forward is to try and replicate whatever features currently rely on
... am I missing something? Do we need (I do think that needing to pass the |
I don't think replacing pynrfjprog is a blocker for this PR. |
@alevy Unfortunately, the So this is not something we want to merge at this point. |
passthru = { | ||
passthru = if withUnfreePkgs then { | ||
inherit nrf-command-line-tools; | ||
pynrfjprog = python3Packages.pynrfjprog; | ||
}; | ||
} else { }; |
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.
@alevy I don't think we need this change. We're just exposing the unfree packages for convenience here, and passthru
is ignored for regular package builds. Because of Nix's lazy eval, you wouldn't need to pull in any unfree dependencies for Tockloader alone, even if we unconditionally expose these packages here.
In other words, withUnfreePkgs
should really only influence Tockloader's build inputs alone.
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 mean... it was failing for me without that I think? But sure, can revert my commit
pynrfjprog is required for two things:
|
If we get that reliably supported some other way, would you be fine making |
I don't understand why we don't have something like |
I think there are two things going on here. The first, and I think the more "blocking" one is that As it stands, it is not possible to "install" tockloader without also installing these unfree packages. It's possible not to use them, but because they are in the project dependencies, they must be installed, even if you never use them and even if you are the kind of person who either prefers not to or is not allowed to install non-free software on your machine. The second is that Nix happens to make this distinction more explicit. So, if you want to install software marked non-free, you need to set an environment variable (or have a .config entry, as I do). It would be totally possible to have But it is |
Note, btw, that if tockloader used the Also, is the functionality that pynrfjprog used for really just equivalent to choosing the |
As far as I understand, the UART numbers are not reliable, at least on some platforms. I don't know whether this is across all platforms, or e.g., only on Windows or Linux. I've captured the USB traffic going to the J-Link and don't see any messages being exchanged, so it seems like
I think that would be a good, minimally invasive workaround. |
Edit: nevermind, the below error was because J-Link wasn't installed. J-Link is shipped with the All of this is very confusing, and means that just installing However, on the bright side, the new I'm giving this a shot right now, but here's something interesting along the way. This "automatically pick the right serial port" has never worked for me (hence wondering what
Now, Tockloader puts all of this in a large Anyways, this means testing whether I'm not breaking the existing |
With recent Nixpkgs revisions, Tockloader fails to build. This is because Nix attempts to use
setup.py
to build it, instead of using pyproject.Additionally, the version of the
nrf-command-line-tools
pinned indefault.nix
is more recent than the version required in thepyproject.toml
. This PR makes this dependency specification less strict, so that these versions are deemed compatible.Once this is merged, it'd be great if we could do a patch release of Tockloader, which we can then pin in the other Tock repositories.