Depthaiv3 alpha15#402019
Conversation
170f800 to
b902544
Compare
b902544 to
4406da9
Compare
|
The Porting |
I was working on ROS stuff at #355629, but it stalled because it was noted that ROS is pretty actively developed. If you want I can restart the effort. |
AFAIK Would like to do one more pass of the DAI package and mark the optional stuff and split package into multiple outputs. Also it might be work to make two definitions - one that does not have dependencies on GUI stuff (good for containers) and then full blown implementation. |
|
FIY |
a0a6b55 to
0bff900
Compare
b0d4a30 to
f5db0dd
Compare
|
Rebased and removed the already merged commits for Should I also squash the commits for |
Nope! These are different packages and should keep their separate commits. The individual commits for each package probably should be squashed into one commit per package, but this is no means a requirement. See #347586 |
Agreed on that. Well meant just per package as each has several changes so that there's just one |
|
There are additional points. IMHO I'd split the definition into multiple subpackages:
Also there are tests but they require HW attached or available on either the USB or network. Therefore they can't be just enabled and executed as part of the derivation, right? Or is there as it's similar to GPU as they are also not available in the sandbox environment but do have test suites. If so could set up hardware to run the tests to see if everything is working (I just use subset of the DAI features that in my case so far work). |
c399786 to
82d9152
Compare
|
So pushed changes tracking the |
|
Looks like you grabbed an unrelated home-assistant commit when rebasing. |
|
@Pandapip1 switched to |
82d9152 to
9cf32e7
Compare
9cf32e7 to
61bb2e6
Compare
Split the package into multiple based on enabled features.
Also the nix package builds as a part of Lastly I'd like to also split further the outputs - probably |
21f1b34 to
86d47f1
Compare
86d47f1 to
b86b6db
Compare
|
What needs to improve/minimize is the |
|
Any idea how to handle the check if the package is split? |
|
@Pandapip1 could I ask you for in-depth review? |
Pandapip1
left a comment
There was a problem hiding this comment.
First pass. Please excuse any typos, this was written on my phone over a train ride.
| @@ -0,0 +1 @@ | |||
| { lib, callPackage }: callPackage ./package.nix { inherit lib; } | |||
There was a problem hiding this comment.
Why is this here? This seemingly serves no purpose.
|
|
||
| catch2_3WithSharedLibs = catch2_3.overrideAttrs (oldAttrs: { | ||
| cmakeFlags = (oldAttrs.cmakeFlags or [ ]) ++ [ | ||
| "-DBUILD_SHARED_LIBS=ON" |
There was a problem hiding this comment.
This should be stdenv.hostPlatform.isStatic, not just always on. Also, consider using the helper for readability:
| "-DBUILD_SHARED_LIBS=ON" | |
| (lib.cmakeBool "BUILD_SHARED_LIBS" (!(stdenv.hostPlatform.isStatic))) |
Also, this seems like an oversight and you should feel free to add this to the actual catch2_3 package.
| # Latest commits are not compatible, use older version | ||
| ws-protocolCompat = ws-protocol.overrideAttrs (old: { |
There was a problem hiding this comment.
Non-blocking, but:
- Has this been reported yet;
- If it has, can you add a comment with a link to the issue?
Also, is there a specific commit that broke it? If so, consider adding a patch that reverts that commit.
| patches = [ ./001-Ws-protocol-add-missing-libs.patch ]; | ||
| }); | ||
|
|
||
| prefixVar = "\${" + "prefix}"; |
There was a problem hiding this comment.
| prefixVar = "\${" + "prefix}"; | |
| prefixVar = "''${prefix}"; |
This is apparently how you properly escape this.
| # Latest commits are not compatible, use older version | ||
| xtensorCompat = xtensor.overrideAttrs (old: { |
There was a problem hiding this comment.
Likewise, if there's an existing issue please link to it, else please create one.
| src = fetchFromGitHub { | ||
| owner = "foxglove"; | ||
| repo = "ws-protocol"; | ||
| tag = "releases/cpp/v${finalAttrs.version}"; |
There was a problem hiding this comment.
Is there any reason this can't be used?
tag = "v${finalAttrs.version}";
Never mind, this is actually correct. That's actually horrible.
| hash = "sha256-JMCwxShOOv1PSrlKiPGtsCgKJVR+7ds9otKrlPHfIio="; | ||
| }; | ||
|
|
||
| # On Darwin the `openssl` and `zlib` are not found during linking |
There was a problem hiding this comment.
Has this been reported upstream?
|
|
||
| sourceRoot = "${finalAttrs.src.name}/cpp/foxglove-websocket"; | ||
|
|
||
| cmakeFlags = [ (lib.cmakeBool "BUILD_SHARED_LIBS" true) ]; |
There was a problem hiding this comment.
You know the drill
| cmakeFlags = [ (lib.cmakeBool "BUILD_SHARED_LIBS" true) ]; | |
| cmakeFlags = [ (lib.cmakeBool "BUILD_SHARED_LIBS" (!(stdenv.hostPlatform.isStatic))) ]; |
| cat > $out/lib/pkgconfig/foxglove-websocket.pc << EOF | ||
| Name: foxglove-websocket | ||
| Description: Foxglove WebSocket Protocol Implementation | ||
| Version: ${finalAttrs.version} |
There was a problem hiding this comment.
Consider:
| Version: ${finalAttrs.version} | |
| Version: $version |
I'm pretty sure this is preferred. I could be wrong though.
| inherit (callPackage ../by-name/de/depthai-core/package.nix { }) | ||
| depthai-core | ||
| depthai-core-minimal | ||
| depthai-core-full | ||
| ; |
There was a problem hiding this comment.
Okay, a few things:
- default.nix is seemingly unused then and should be removed;
package.nixes in by-name should resolve to a derivation, not an attrset. The fact that it's not and then you're masking it inall-packages.nixis very cursed and will likely break something at some point.- To fix 2, just use
depthai-core-full = depthai-core.override { ... }inall-packages.nix
There was a problem hiding this comment.
Consider adding pytestCheckHook, and a pythonImportsCheck
| nativeBuildInputs = [ flit-core ]; | ||
| propagatedBuildInputs = [ | ||
| docutils | ||
| libclang | ||
| ]; |
There was a problem hiding this comment.
| nativeBuildInputs = [ flit-core ]; | |
| propagatedBuildInputs = [ | |
| docutils | |
| libclang | |
| ]; | |
| build-system = [ flit-core ]; | |
| dependencies = [ | |
| docutils | |
| libclang | |
| ]; |
python packages are weird and use different naming. I think there's some additional handling that happens when you name things correctly.
|
|
||
| # Create foxglove-websocketConfigVersion.cmake | ||
| cat > $out/lib/cmake/foxglove-websocket/foxglove-websocketConfigVersion.cmake << EOF | ||
| set(PACKAGE_VERSION "${finalAttrs.version}") |
There was a problem hiding this comment.
| set(PACKAGE_VERSION "${finalAttrs.version}") | |
| set(PACKAGE_VERSION "$version") |
Missed this too. Again, not required but I seem to recall this is recommended over string templates.
| # foxglove-websocket CMake configuration file | ||
|
|
||
| # Compute installation prefix relative to this file | ||
| get_filename_component(_IMPORT_PREFIX "\''${CMAKE_CURRENT_LIST_DIR}/../../.." ABSOLUTE) |
There was a problem hiding this comment.
I don't think that \ is required. Could be wrong, but:
| get_filename_component(_IMPORT_PREFIX "\''${CMAKE_CURRENT_LIST_DIR}/../../.." ABSOLUTE) | |
| get_filename_component(_IMPORT_PREFIX "''${CMAKE_CURRENT_LIST_DIR}/../../.." ABSOLUTE) |
|
|
||
| cmakeFlags = [ | ||
| (lib.cmakeBool "BUILD_EXAMPLE" true) | ||
| (lib.cmakeBool "BUILD_TESTS" true) |
There was a problem hiding this comment.
These should be run in checkPhase.
| }); | ||
|
|
||
| # Latest commits are not compatible, use older version | ||
| ws-protocolCompat = ws-protocol.overrideAttrs (old: { |
There was a problem hiding this comment.
old is seemingly not used
| ws-protocolCompat = ws-protocol.overrideAttrs (old: { | |
| ws-protocolCompat = ws-protocol.overrideAttrs { |
| }); | ||
|
|
||
| # Latest commits are not compatible, use older version | ||
| xlinkCompat = xlink.overrideAttrs (old: { |
There was a problem hiding this comment.
old is seemingly not used
| xlinkCompat = xlink.overrideAttrs (old: { | |
| xlinkCompat = xlink.overrideAttrs { |
| pyOpencv4WithGtk = python3Packages.opencv4.override { | ||
| enableGtk2 = true; # For GTK2 support | ||
| enableGtk3 = true; # For GTK3 support | ||
| }; |
There was a problem hiding this comment.
| pyOpencv4WithGtk = python3Packages.opencv4.override { | |
| enableGtk2 = true; # For GTK2 support | |
| enableGtk3 = true; # For GTK3 support | |
| }; |
Unused
| rerun_sdk = fetchzip { | ||
| url = "https://github.com/rerun-io/rerun/releases/download/0.16.1/rerun_cpp_sdk.zip"; | ||
| hash = "sha256-tYwcRjlU8m+OHkwdbQeM+X5outF0NFbj8Ee3y5h9+l0="; | ||
| stripRoot = false; # Important for zip files to preserve the directory structure | ||
| }; |
There was a problem hiding this comment.
Can't this be a fetchFromGitHub?
|
|
||
| preConfigure = '' | ||
| echo "Fixing xtensor.pc.in for Nix compatibility..." | ||
| find . -name xtensor.pc.in -exec sed -i 's|${prefixVar}/@CMAKE_INSTALL_LIBDIR@|@CMAKE_INSTALL_FULL_LIBDIR@|g' {} \; |
There was a problem hiding this comment.
prefixVar is only ever used here. Consider:
| find . -name xtensor.pc.in -exec sed -i 's|${prefixVar}/@CMAKE_INSTALL_LIBDIR@|@CMAKE_INSTALL_FULL_LIBDIR@|g' {} \; | |
| find . -name xtensor.pc.in -exec sed -i 's|''${prefix}/@CMAKE_INSTALL_LIBDIR@|@CMAKE_INSTALL_FULL_LIBDIR@|g' {} \; |
and dropping the variable
No porblem. Thanks, started on the fixes |
|
As I'm no longer affiliated with Luxonis I must put this into a draft mode. If there would be anyone willing to take up the mantel feel free :) @MaticTonin would you take on the challenge? |
|
I have been very slowly going through the code and cleaning it up for a while now. It will take a lot more time to have a mergeable PR ready, but if somebody wants to take a look/collaborate, I can put up a draft PR. |
Add DepthAI package which is basically OpenCV running on Edge devices made by Luxonis.
Currently work in progress therefore marked as Draft, would like to decrease the amoutn of patches by upstreaming some of the changes like
Package request
Github repo link
Upstreaming the flake environment
WIP Dependencies:
CC: @jayrahdevore @tmayoff @hacker1024 @Pandapip1
Things done
nix.conf? (See Nix manual)sandbox = relaxedsandbox = truenix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD". Note: all changes have to be committed, also see nixpkgs-review usage./result/bin/)Add a 👍 reaction to pull requests you find important.