diff --git a/flake.lock b/flake.lock index 306a559..1d7f127 100644 --- a/flake.lock +++ b/flake.lock @@ -20,11 +20,11 @@ "systems": "systems" }, "locked": { - "lastModified": 1705309234, - "narHash": "sha256-uNRRNRKmJyCRC/8y1RqBkqWBLM034y4qN7EprSdmgyA=", + "lastModified": 1731533236, + "narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=", "owner": "numtide", "repo": "flake-utils", - "rev": "1ef2e671c3b0c19053962c07dbda38332dcebf26", + "rev": "11707dc2f618dd54ca8739b309ec4fc024de578b", "type": "github" }, "original": { @@ -95,27 +95,26 @@ }, "nixpkgs_2": { "locked": { - "lastModified": 1712307699, - "narHash": "sha256-/PzHcPvBvJeZTY9JCEtbNljYLecwggveHQ2oHPlTycA=", - "owner": "NixOS", + "lastModified": 1737552376, + "narHash": "sha256-Dh3mcaPiZr/1Bd3+LXDO0Izxku3w1mXKEkCr3hVs8Jg=", + "owner": "nixos", "repo": "nixpkgs", - "rev": "3541c7628de9414f999ced044c95a284584f4ec1", + "rev": "a910ca0ea5b9ae5079d689e641a368d819f2b710", "type": "github" }, "original": { - "owner": "NixOS", - "ref": "master", + "owner": "nixos", "repo": "nixpkgs", "type": "github" } }, "nixpkgs_3": { "locked": { - "lastModified": 1707268954, - "narHash": "sha256-2en1kvde3cJVc3ZnTy8QeD2oKcseLFjYPLKhIGDanQ0=", + "lastModified": 1733581040, + "narHash": "sha256-Qn3nPMSopRQJgmvHzVqPcE3I03zJyl8cSbgnnltfFDY=", "owner": "lopsided98", "repo": "nixpkgs", - "rev": "f8e2ebd66d097614d51a56a755450d4ae1632df1", + "rev": "22c3f2cf41a0e70184334a958e6b124fb0ce3e01", "type": "github" }, "original": { @@ -146,11 +145,11 @@ "nixpkgs": "nixpkgs_3" }, "locked": { - "lastModified": 1715462692, - "narHash": "sha256-ClDP5aXC46y4wyHhEETWHitqIoNLDrt6uRX2HpZtmd0=", + "lastModified": 1736986092, + "narHash": "sha256-HdVJ5cCIORyy7m57VnunC8kBd6r5B680M8sUhAr7mzo=", "owner": "lopsided98", "repo": "nix-ros-overlay", - "rev": "f1c32375c27e59a2e8107d52357a5ee44b3c4413", + "rev": "503be406769b14b7907c52000d41a3e6a3531f08", "type": "github" }, "original": { diff --git a/flake.nix b/flake.nix index d3a0835..504a0d3 100644 --- a/flake.nix +++ b/flake.nix @@ -1,7 +1,7 @@ { description = "Robossembler Development Environments on Nix"; inputs = { - nixpkgs.url = "github:NixOS/nixpkgs?ref=master"; + nixpkgs.url = "github:nixos/nixpkgs"; flake-utils.follows = "ros-overlay/flake-utils"; ros-overlay.url = "github:lopsided98/nix-ros-overlay?ref=develop"; ros-nixpkgs.follows = "ros-overlay/nixpkgs"; @@ -24,6 +24,7 @@ (import ./overlay.nix) gazebo-overlay.overlays.default ]; + config.allowUnfree = true; }; ros = import ros-nixpkgs { inherit system; overlays = [ ros-overlay.overlays.default @@ -34,41 +35,51 @@ rlib = import ./. { inherit pkgs; - inherit (pkgs) lib mayo rbs-workbench cad-gen cg-gen; + inherit (pkgs) lib rbs-workbench cad-gen cg-gen; inherit (pkgs.stdenv) mkDerivation; inherit (pkgs.libsForQt5) wrapQtAppsHook; }; packages = { - inherit (pkgs) cad-gen cg-gen blender; + inherit (pkgs) cad-gen cg-gen blender cad-gen-docker; }; inherit ros pkgs; devShells = { default = - let - my-python-packages = p: with p; [ - unified-planning - pybullet - scipy - spatialmath - rcg-pipeline - rbs-workbench - ]; - in - pkgs.mkShell { - packages = (with pkgs; [ freecad mayo ]) ++ [ (pkgs.python3.withPackages my-python-packages) ]; - }; + let + my-python-packages = p: with p; [ + unified-planning + scipy + spatialmath + rcg-pipeline + rbs-workbench + ]; + in + pkgs.mkShell { + packages = (with pkgs; [ freecad ]) ++ [ (pkgs.python3.withPackages my-python-packages) ]; + }; + + test = + let + my-python-packages = p: with p; [ scenario ]; + in + pkgs.mkShell { + packages = [ (pkgs.python3.withPackages my-python-packages) ]; + }; ros = pkgs.mkShell { name = "ROS environment"; packages = [ + pkgs.vcstool ros.colcon + pkgs.scenario (with ros.rosPackages.humble; buildEnv { paths = [ ros-core rmw-fastrtps-dynamic-cpp + rviz2 ]; }) ]; @@ -76,7 +87,7 @@ RMW_IMPLEMENTATION = "rmw_fastrtps_dynamic_cpp"; }; - all = pkgs.mkShell { packages = with pkgs; [ fstl mayo cad-gen cg-gen ]; }; + all = pkgs.mkShell { packages = with pkgs; [ fstl cad-gen cg-gen ]; }; ci = pkgs.mkShell { buildInputs = [ pkgs.jq ]; }; @@ -85,24 +96,36 @@ perception = let perception-packages = p: with p; [ - torch + pytorchWithCuda torchvision torchaudio detectron2 + scipy + pyrr + pillow + numpy + opencv4 + boto3 + tensorboardx + albumentations + simplejson + + ultralytics ]; in pkgs.mkShell { - packages = [ (pkgs.python3.withPackages perception-packages) ]; + packages = [ pkgs.s3cmd pkgs.libGL ] ++ [ (pkgs.python3.withPackages perception-packages) ]; }; - }; + }; } ); nixConfig = { - extra-substituters = [ "https://ros.cachix.org" "https://robossembler.cachix.org" ]; + extra-substituters = [ "https://ros.cachix.org" "https://robossembler.cachix.org" "https://cuda-maintainers.cachix.org" ]; extra-trusted-public-keys = [ "ros.cachix.org-1:dSyZxI8geDCJrwgvCOHDoAfOm5sV1wCPjBkKL+38Rvo=" "robossembler.cachix.org-1:56jBJHroRQSGpZFkW8XMquuzQTjAF/XTo6MogmBM7SQ=" + "cuda-maintainers.cachix.org-1:0dq3bujKpuEPMCX6U4WylrUDZ9JyUG0VpVZa7CNfq5E=" ]; }; } diff --git a/pkgs/cmake-build-extension/default.nix b/pkgs/cmake-build-extension/default.nix new file mode 100644 index 0000000..92cb381 --- /dev/null +++ b/pkgs/cmake-build-extension/default.nix @@ -0,0 +1,50 @@ +{ + lib, + buildPythonPackage, + fetchFromGitHub, + setuptools, + setuptools-scm, + wheel, + gitpython, + cmake, + ninja, + pkg-config +}: + +buildPythonPackage rec { + pname = "cmake-build-extension"; + version = "0.6.1"; + pyproject = true; + + src = fetchFromGitHub { + owner = "diegoferigo"; + repo = "cmake-build-extension"; + rev = "v${version}"; + hash = "sha256-taAwxa7Sv+xc8xJRnNM6V7WPcL+TWZOkngwuqjAslzc="; + }; + + # nativeBuildInputs = [ cmake ]; + # buildInputs = [ cmake ninja ]; + dontUseCmakeConfigure = true; + + propagatedBuildInputs = [ gitpython ]; + + build-system = [ + cmake + ninja + setuptools + setuptools-scm + wheel + ]; + + pythonImportsCheck = [ + "cmake_build_extension" + ]; + + meta = { + description = "Setuptools extension to build and package CMake projects"; + homepage = "https://github.com/diegoferigo/cmake-build-extension"; + license = lib.licenses.mit; + maintainers = with lib.maintainers; [ ]; + }; +} diff --git a/pkgs/coremltools/default.nix b/pkgs/coremltools/default.nix new file mode 100644 index 0000000..a714377 --- /dev/null +++ b/pkgs/coremltools/default.nix @@ -0,0 +1,36 @@ +{ + lib, + buildPythonPackage, + fetchFromGitHub, + setuptools, + wheel, +}: + +buildPythonPackage rec { + pname = "coremltools"; + version = "8.0"; + pyproject = true; + + src = fetchFromGitHub { + owner = "apple"; + repo = "coremltools"; + rev = version; + hash = "sha256-nMrOtG8kAvz7DxYcf2Dh5f65zbTPSuUfoU7XL2Cx1Aw="; + }; + + build-system = [ + setuptools + wheel + ]; + + pythonImportsCheck = [ + "coremltools" + ]; + + meta = { + description = "Core ML tools contain supporting tools for Core ML model conversion, editing, and validation"; + homepage = "https://github.com/apple/coremltools"; + license = lib.licenses.bsd3; + maintainers = with lib.maintainers; [ ]; + }; +} diff --git a/pkgs/default.nix b/pkgs/default.nix index b4319af..70ec705 100644 --- a/pkgs/default.nix +++ b/pkgs/default.nix @@ -12,7 +12,7 @@ self: super: with self.lib; let pname = "bpy"; src = self.fetchurl { url = "https://download.blender.org/source/${old.pname}-${old.version}.tar.xz"; - hash = "sha256-3AAtguPDQMk4VcZoRzDQGAG2aaKbHMa3XuuZC6aecj8="; + hash = "sha256-4LfgcP9wbSNma6kOuZqFutuN+oC4SNro0zUb8l1Hr/k="; }; cmakeFlags = old.cmakeFlags ++ [ "-DWITH_PYTHON_INSTALL=OFF" @@ -44,6 +44,21 @@ in { }; }; + # Docker Images + + cad-gen-docker = self.dockerTools.buildImage { + name = "cad-gen-docker"; + tag = "latest"; + copyToRoot = self.buildEnv { + name = "image-root"; + paths = with self; [ cad-gen ]; + pathsToLink = [ "/bin" ]; + }; + }; + + tiny-process-library = self.callPackage ./scenario/tiny-process-library.nix { }; + ycm = self.callPackage ./scenario/ycm-cmake-modules.nix { }; + # Python packages @@ -60,6 +75,39 @@ in { hash = "sha256-X1LTOfbIAMy6gToNYS0JpeJpHi0jHPsEjrnCq2c9U0E="; }; }); + # torchWithCuda = python-prev.torchWithCuda.overridePythonAttrs (oldAttrs: { + # extraRunpaths = [ "${super.lib.getLib self.cudaPackages.cuda_nvrtc}/lib" ]; + # postPhases = super.lib.optionals self.stdenv.hostPlatform.isUnix ["postPatchelfPhase" ]; + # postPatchelfPhase = '' + # while IFS= read -r -d $'\0' elf ; do + # for extra in $extraRunpaths ; do + # echo patchelf "$elf" --add-rpath "$extra" >&2 + # patchelf "$elf" --add-rpath "$extra" + # done + # done < <( + # find "''${!outputLib}" "$out" -type f -iname '*.so' -print0 + # ) + # ''; + # }); + torchvision = python-prev.torchvision.override { + torch = python-final.pytorchWithCuda; + }; + torchaudio = python-prev.torchaudio.override { + torch = python-final.pytorchWithCuda; + }; + detectron2 = python-prev.detectron2.override { + torch = python-final.pytorchWithCuda; + torchvision = python-final.torchvision; + }; + ultralytics-thop = self.python3Packages.callPackage ./ultralytics-thop { torch = python-final.pytorchWithCuda; }; + coremltools = self.python3Packages.callPackage ./coremltools { }; + lap = self.python3Packages.callPackage ./lap { }; + pybboxes = self.python3Packages.callPackage ./pybboxes { }; + sahi = self.python3Packages.callPackage ./sahi { inherit (python-final) pybboxes; }; + ultralytics = self.python3Packages.callPackage ./ultralytics { + inherit (python-final) coremltools lap ultralytics-thop; + torch = python-final.pytorchWithCuda; + }; unified-planning = self.python3Packages.callPackage ./unified-planning { }; bpy-wheel = self.python3Packages.callPackage ./bpy-wheel { }; pysdf = self.python3Packages.callPackage ./pysdf { }; @@ -74,6 +122,9 @@ in { rbs-workbench = self.python3Packages.callPackage ./freecad.robossembler { inherit (python-final) freecad-lib; inherit rbsFrameworkSrc; }; freecad-lib = self.python3Packages.toPythonModule (self.callPackage ./freecad-lib { }); bpy-lib = self.python3Packages.toPythonModule bpy; + cmake-build-extension = self.python3Packages.callPackage ./cmake-build-extension { }; + scenario = self.python3Packages.callPackage ./scenario { inherit (python-final) cmake-build-extension; }; + idyntree = self.python3Packages.callPackage ./idyntree { inherit (python-final) cmake-build-extension; }; } ) ]; diff --git a/pkgs/freecad.robossembler/default.nix b/pkgs/freecad.robossembler/default.nix index dafd9f8..83adcdf 100644 --- a/pkgs/freecad.robossembler/default.nix +++ b/pkgs/freecad.robossembler/default.nix @@ -32,7 +32,7 @@ buildPythonPackage rec { freecad-lib ]; - pythonImportsCheck = [ "freecad.robossembler" ]; + # pythonImportsCheck = [ "freecad.robossembler" ]; doCheck = false; diff --git a/pkgs/idyntree/cmake-fix-libxml2-find-package.patch b/pkgs/idyntree/cmake-fix-libxml2-find-package.patch new file mode 100644 index 0000000..8c2010d --- /dev/null +++ b/pkgs/idyntree/cmake-fix-libxml2-find-package.patch @@ -0,0 +1,13 @@ +diff --color -ur a/CMakeLists.txt b/CMakeLists.txt +--- a/CMakeLists.txt 2021-05-30 13:46:22.256040282 +0200 ++++ b/CMakeLists.txt 2021-05-30 14:15:42.530181216 +0200 +@@ -333,7 +333,7 @@ + # So, try first to find the CMake module provided by libxml2 package, then fallback + # on the CMake's FindLibXml2.cmake module (which can lack some definition, especially + # in static build case). +-find_package(LibXml2 QUIET NO_MODULE) ++find_package(LibXml2 QUIET MODULE) + if(DEFINED LIBXML2_VERSION_STRING) + set(LIBXML2_FOUND ON) + set(LIBXML2_INCLUDE_DIR ${LIBXML2_INCLUDE_DIRS}) +Seulement dans b: good.patch \ No newline at end of file diff --git a/pkgs/idyntree/default.nix b/pkgs/idyntree/default.nix new file mode 100644 index 0000000..66a4b8d --- /dev/null +++ b/pkgs/idyntree/default.nix @@ -0,0 +1,62 @@ +{ + lib, + buildPythonPackage, + fetchFromGitHub, + cmake, + ninja, + cmake-build-extension, + numpy, + setuptools, + setuptools-scm, + wheel, + eigen, + libxml2, + assimp, + swig, + pybind11, +}: + +buildPythonPackage rec { + pname = "idyntree"; + version = "13.1.1"; + pyproject = true; + + src = fetchFromGitHub { + owner = "robotology"; + repo = "idyntree"; + rev = "v${version}"; + hash = "sha256-OD00X5xjcti7GthAkluM7GxUHZ9tl0ne4HhflHsW2qk="; + }; + + nativeBuildInputs = [ swig pybind11 ]; + + buildInputs = [ assimp eigen libxml2.dev ]; + + build-system = [ + cmake + ninja + cmake-build-extension + numpy + setuptools + setuptools-scm + wheel + ]; + + dontUseCmakeConfigure = true; + + cmakeFlags = [ + "-DIDYNTREE_USES_PYTHON_PYBIND11='ON'" + ]; + + pythonImportsCheck = [ + "idyntree" + ]; + + meta = { + description = "Multibody Dynamics Library designed for Free Floating Robots"; + homepage = "https://github.com/robotology/idyntree"; + changelog = "https://github.com/robotology/idyntree/blob/${src.rev}/CHANGELOG.md"; + license = lib.licenses.bsd3; + maintainers = with lib.maintainers; [ ]; + }; +} diff --git a/pkgs/lap/default.nix b/pkgs/lap/default.nix new file mode 100644 index 0000000..0ed0160 --- /dev/null +++ b/pkgs/lap/default.nix @@ -0,0 +1,38 @@ +{ + lib, + buildPythonPackage, + fetchFromGitHub, + cython, + numpy, + setuptools, +}: + +buildPythonPackage rec { + pname = "lap"; + version = "0.5.12"; + pyproject = true; + + src = fetchFromGitHub { + owner = "gatagat"; + repo = "lap"; + rev = "v${version}"; + hash = "sha256-ktLwdeb7UWhdihOhdeYIi6Geyp7aJsVPPec22MtI9Jo="; + }; + + build-system = [ + cython + numpy + setuptools + ]; + + pythonImportsCheck = [ + "lap" + ]; + + meta = { + description = "Linear Assignment Problem solver (LAPJV/LAPMOD"; + homepage = "https://github.com/gatagat/lap"; + license = lib.licenses.bsd2; + maintainers = with lib.maintainers; [ ]; + }; +} diff --git a/pkgs/pybboxes/default.nix b/pkgs/pybboxes/default.nix new file mode 100644 index 0000000..8d401da --- /dev/null +++ b/pkgs/pybboxes/default.nix @@ -0,0 +1,47 @@ +{ + lib, + buildPythonPackage, + fetchFromGitHub, + setuptools, + wheel, + numpy, + pycocotools, + pyyaml, +}: + +buildPythonPackage rec { + pname = "pybboxes"; + version = "0.2.0"; + pyproject = true; + + src = fetchFromGitHub { + owner = "devrimcavusoglu"; + repo = "pybboxes"; + rev = version; + hash = "sha256-3JP6gLm62Atq8RJYb4AMPUcGyzyrXMG/ayqvMCNk9g8="; + }; + + build-system = [ + setuptools + wheel + ]; + + dependencies = [ + numpy + pycocotools + pyyaml + ]; + + doCheck = false; + + pythonImportsCheck = [ + "pybboxes" + ]; + + meta = { + description = "Light weight toolkit for bounding boxes providing conversion between bounding box types and simple computations"; + homepage = "https://github.com/devrimcavusoglu/pybboxes"; + license = lib.licenses.mit; + maintainers = with lib.maintainers; [ ]; + }; +} diff --git a/pkgs/sahi/default.nix b/pkgs/sahi/default.nix new file mode 100644 index 0000000..38f2194 --- /dev/null +++ b/pkgs/sahi/default.nix @@ -0,0 +1,61 @@ +{ + lib, + buildPythonPackage, + fetchFromGitHub, + setuptools, + wheel, + click, + fire, + numpy, + opencv-python, + pillow, + pybboxes, + pyyaml, + requests, + shapely, + terminaltables, + tqdm, +}: + +buildPythonPackage rec { + pname = "sahi"; + version = "0.11.20"; + pyproject = true; + + src = fetchFromGitHub { + owner = "obss"; + repo = "sahi"; + rev = version; + hash = "sha256-TFphsF55El32siGdE1WJLnyVXGfaE32Nttvdcy/oqk0="; + }; + + build-system = [ + setuptools + wheel + ]; + + dependencies = [ + click + fire + numpy + opencv-python + pillow + pybboxes + pyyaml + requests + shapely + terminaltables + tqdm + ]; + + pythonImportsCheck = [ + "sahi" + ]; + + meta = { + description = "Framework agnostic sliced/tiled inference + interactive ui + error analysis plots"; + homepage = "https://github.com/obss/sahi"; + license = lib.licenses.mit; + maintainers = with lib.maintainers; [ ]; + }; +} diff --git a/pkgs/scenario/default.nix b/pkgs/scenario/default.nix new file mode 100644 index 0000000..a71b7b8 --- /dev/null +++ b/pkgs/scenario/default.nix @@ -0,0 +1,70 @@ +{ + lib, + buildPythonPackage, + fetchFromGitHub, + cmake, + ninja, + cmake-build-extension, + #idyntree, + setuptools, + setuptools-scm, + wheel, + tiny-process-library, + ycm, + pkg-config, + fetchgit +}: + +buildPythonPackage rec { + pname = "scenario"; + version = "1.4.0"; + pyproject = true; + + src = fetchFromGitHub { + owner = "movefasta"; + repo = "scenario"; + rev = "6bf8f7227778a55aef335599e8d127c061af5bf6"; + hash = "sha256-QWBVIr4WaPHLzoRNm8p781k3obvywP+s0YbqP1+Tzd0="; + }; + + patches = [ ./ignition.patch ]; + + postPatch = '' + substituteInPlace deps/CMakeLists.txt \ + --replace "GIT_REPOSITORY https://github.com/robotology/ycm.git" "SOURCE_DIR ${ycm.src}" \ + --replace "GIT_REPOSITORY https://gitlab.com/eidheim/tiny-process-library.git" "SOURCE_DIR ${tiny-process-library.src}" \ + --replace "SCENARIO_CALL_FROM_SETUP_PY AND NOT USE_IGNITION" "FALSE" + substituteInPlace pyproject.toml --replace-fail '"idyntree>=3.1",' "" + substituteInPlace setup.py --replace-fail 'cmake_depends_on=["idyntree"],' "" + ''; + + # nativeBuildInputs = [ pkg-config ]; + + build-system = [ + cmake + ninja + cmake-build-extension + #idyntree + setuptools + setuptools-scm + wheel + ]; + + cmakeFlags = [ + "-DSCENARIO_USE_IGNITION=FALSE" + "-DSCENARIO_BUILD_SHARED_LIBRARY=ON" + ]; + + dontUseCmakeConfigure = true; + + pythonImportsCheck = [ + "scenario" + ]; + + meta = { + description = ""; + homepage = "https://github.com/movefasta/scenario"; + license = lib.licenses.mit; + maintainers = with lib.maintainers; [ ]; + }; +} diff --git a/pkgs/scenario/ignition.patch b/pkgs/scenario/ignition.patch new file mode 100644 index 0000000..20e950d --- /dev/null +++ b/pkgs/scenario/ignition.patch @@ -0,0 +1,12 @@ +diff --git a/setup.py b/setup.py +index 9352f44..e204b0d 100644 +--- a/setup.py ++++ b/setup.py +@@ -16,6 +16,7 @@ setuptools.setup( + cmake_configure_options=[ + "-DSCENARIO_CALL_FROM_SETUP_PY:BOOL=ON", + "-DSCENARIO_BUILD_SHARED_LIBRARY:BOOL=OFF", ++ '-DIGNITION_DISTRIBUTION="ignition-gazebo"', + f"-DPython3_EXECUTABLE:PATH={sys.executable}", + ], + disable_editable=True, diff --git a/pkgs/scenario/mkder.nix b/pkgs/scenario/mkder.nix new file mode 100644 index 0000000..b882230 --- /dev/null +++ b/pkgs/scenario/mkder.nix @@ -0,0 +1,31 @@ +{ + lib, + stdenv, + fetchFromGitHub, + cmake, +}: + +stdenv.mkDerivation rec { + pname = "scenario"; + version = "unstable-2024-10-08"; + + src = fetchFromGitHub { + owner = "movefasta"; + repo = "scenario"; + rev = "6bf8f7227778a55aef335599e8d127c061af5bf6"; + hash = "sha256-QWBVIr4WaPHLzoRNm8p781k3obvywP+s0YbqP1+Tzd0="; + }; + + nativeBuildInputs = [ + cmake + ]; + + meta = { + description = ""; + homepage = "https://github.com/movefasta/scenario"; + license = lib.licenses.unfree; # FIXME: nix-init did not find a license + maintainers = with lib.maintainers; [ ]; + mainProgram = "scenario"; + platforms = lib.platforms.all; + }; +} diff --git a/pkgs/scenario/tiny-process-library.nix b/pkgs/scenario/tiny-process-library.nix new file mode 100644 index 0000000..646a233 --- /dev/null +++ b/pkgs/scenario/tiny-process-library.nix @@ -0,0 +1,31 @@ +{ + lib, + stdenv, + fetchFromGitLab, + cmake, +}: + +stdenv.mkDerivation rec { + pname = "tiny-process-library"; + version = "2.0.4"; + + src = fetchFromGitLab { + owner = "eidheim"; + repo = "tiny-process-library"; + rev = "v${version}"; + hash = "sha256-ntg0e3Ox5swCoimZG6gwpD2eKKFQx5+vXq77cK+wT1Y="; + }; + + nativeBuildInputs = [ + cmake + ]; + + meta = { + description = "A small platform independent library making it simple to create and stop new processes in C++, as well as writing to stdin and reading from stdout and stderr of a new process"; + homepage = "https://gitlab.com/eidheim/tiny-process-library"; + license = lib.licenses.mit; + maintainers = with lib.maintainers; [ ]; + mainProgram = "tiny-process-library"; + platforms = lib.platforms.all; + }; +} diff --git a/pkgs/scenario/ycm-cmake-modules.nix b/pkgs/scenario/ycm-cmake-modules.nix new file mode 100644 index 0000000..13435c7 --- /dev/null +++ b/pkgs/scenario/ycm-cmake-modules.nix @@ -0,0 +1,32 @@ +{ + lib, + stdenv, + fetchFromGitHub, + cmake, +}: + +stdenv.mkDerivation rec { + pname = "ycm-cmake-modules"; + version = "0.18.1"; + + src = fetchFromGitHub { + owner = "robotology"; + repo = "ycm-cmake-modules"; + rev = "v${version}"; + hash = "sha256-7kmXvFrb4HFZyie5FurYeChCEivfkxBe+X5bYXirQqc="; + }; + + nativeBuildInputs = [ + cmake + ]; + + meta = { + description = "YCM (YCM CMake modules) is a collection of various useful CMake modules"; + homepage = "https://github.com/robotology/ycm-cmake-modules"; + changelog = "https://github.com/robotology/ycm-cmake-modules/blob/${src.rev}/CHANGELOG.md"; + license = lib.licenses.unfree; # FIXME: nix-init did not find a license + maintainers = with lib.maintainers; [ ]; + mainProgram = "ycm-cmake-modules"; + platforms = lib.platforms.all; + }; +} diff --git a/pkgs/ultralytics-thop/default.nix b/pkgs/ultralytics-thop/default.nix new file mode 100644 index 0000000..9be3b2c --- /dev/null +++ b/pkgs/ultralytics-thop/default.nix @@ -0,0 +1,44 @@ +{ + lib, + buildPythonPackage, + fetchFromGitHub, + setuptools, + wheel, + numpy, + torch, +}: + +buildPythonPackage rec { + pname = "thop"; + version = "2.0.13"; + pyproject = true; + + src = fetchFromGitHub { + owner = "ultralytics"; + repo = "thop"; + rev = "v${version}"; + hash = "sha256-VgHRDXKRZjCE8RR+77GgTGiXeq5e1Bo4l4N72DMRc+s="; + }; + + build-system = [ + setuptools + wheel + ]; + + dependencies = [ + numpy + setuptools + torch + ]; + + pythonImportsCheck = [ + "thop" + ]; + + meta = { + description = "Profile PyTorch models for FLOPs and parameters, helping to evaluate computational efficiency and memory usage"; + homepage = "https://github.com/ultralytics/thop"; + license = lib.licenses.agpl3Only; + maintainers = with lib.maintainers; [ ]; + }; +} diff --git a/pkgs/ultralytics/default.nix b/pkgs/ultralytics/default.nix new file mode 100644 index 0000000..51195ef --- /dev/null +++ b/pkgs/ultralytics/default.nix @@ -0,0 +1,159 @@ +{ + lib, + buildPythonPackage, + fetchFromGitHub, + setuptools, + wheel, + beautifulsoup4, + onnxruntime, + # sahi, + lap, + matplotlib, + numpy, + opencv-python, + pandas, + pillow, + psutil, + py-cpuinfo, + pyyaml, + requests, + scipy, + seaborn, + torch, + torchvision, + tqdm, + ultralytics-thop, + coverage, + ipython, + mkdocs, + mkdocs-jupyter, + #mkdocs-macros-plugin, + mkdocs-material, + mkdocs-redirects, + #mkdocs-ultralytics-plugin, + mkdocstrings, + pytest, + pytest-cov, + coremltools, + flatbuffers, + h5py, + keras, + onnx, + openvino, + scikit-learn, + tensorflow, + #tensorflowjs, + tensorstore, + albumentations, + #hub-sdk, + pycocotools, + #comet, + dvclive, + tensorboard, + shapely, + streamlit, + pytestCheckHook, +}: + +buildPythonPackage rec { + pname = "ultralytics"; + version = "8.3.61"; + pyproject = true; + + src = fetchFromGitHub { + owner = "ultralytics"; + repo = "ultralytics"; + rev = "v${version}"; + hash = "sha256-0BMOFjVSYDFj3vfDccMCHnM1FqHesXYMWR4yCSs4oac="; + }; + + build-system = [ + setuptools + wheel + ]; + + dependencies = [ + lap + matplotlib + numpy + opencv-python + pandas + pillow + psutil + py-cpuinfo + pyyaml + requests + scipy + seaborn + torch + torchvision + tqdm + ultralytics-thop + ]; + + optional-dependencies = { + dev = [ + coverage + ipython + mkdocs + mkdocs-jupyter + #mkdocs-macros-plugin + mkdocs-material + mkdocs-redirects + #mkdocs-ultralytics-plugin + mkdocstrings + pytest + pytest-cov + ]; + export = [ + coremltools + flatbuffers + h5py + keras + numpy + onnx + openvino + scikit-learn + tensorflow + #tensorflowjs + tensorstore + ]; + extra = [ + albumentations + #hub-sdk + ipython + pycocotools + ]; + logging = [ + # comet + dvclive + tensorboard + ]; + solutions = [ + shapely + streamlit + ]; + }; + + preBuild = '' + sed -i '/torchvision>=0.9.0/d' pyproject.toml + ''; + + nativeCheckInputs = [ + beautifulsoup4 + onnxruntime + shapely + # sahi + ]; + + pythonImportsCheck = [ + "ultralytics" + ]; + + meta = { + description = "Ultralytics YOLO11"; + homepage = "https://github.com/ultralytics/ultralytics"; + license = lib.licenses.agpl3Only; + maintainers = with lib.maintainers; [ ]; + }; +}