diff --git a/.github/workflows/nix.yml b/.github/workflows/nix.yml index a1bff8fcec3..0bd6ed4f2b9 100644 --- a/.github/workflows/nix.yml +++ b/.github/workflows/nix.yml @@ -12,7 +12,7 @@ jobs: os: [ubuntu, macos] steps: - uses: actions/checkout@v4 - - uses: cachix/install-nix-action@v27 + - uses: cachix/install-nix-action@v31 # TODO: the "sofa" account on cachix does not exist yet #- uses: cachix/cachix-action@v15 #with: diff --git a/flake.nix b/flake.nix index 47cd9840fe7..188fede19c2 100644 --- a/flake.nix +++ b/flake.nix @@ -28,7 +28,8 @@ devShells.default = pkgs.mkShell { inputsFrom = [ self'.packages.default ]; }; packages = { default = self'.packages.sofa; - sofa = pkgs.callPackage ./package.nix { }; + sofa = pkgs.callPackage ./package.nix { inherit (self'.packages) tight_inclusion; }; + tight_inclusion = pkgs.callPackage ./tight_inclusion.nix { }; }; }; }; diff --git a/package.nix b/package.nix index 41af729d90a..a8318256bb1 100644 --- a/package.nix +++ b/package.nix @@ -10,7 +10,9 @@ qt6Packages, libGL, metis, + nlohmann_json, stdenv, + tight_inclusion, tinyxml-2, zlib, }: @@ -53,7 +55,9 @@ stdenv.mkDerivation (finalAttrs: { qt6Packages.qtbase libGL metis + nlohmann_json tinyxml-2 + tight_inclusion zlib ]; diff --git a/tight_inclusion.nix b/tight_inclusion.nix new file mode 100644 index 00000000000..b11b7e1dcb4 --- /dev/null +++ b/tight_inclusion.nix @@ -0,0 +1,71 @@ +{ + lib, + + stdenv, + fetchFromGitHub, + + cmake, + + eigen, + spdlog, +}: + +let + cf = fetchFromGitHub { + owner = "conda-forge"; + repo = "tight-inclusion-feedstock"; + rev = "ad0bb48ec12aa991ae208252cdd7e61fa37bdc10"; + hash = "sha256-4v6h1c2fe0DK5z/s86B7oUyUBAYXTnMHzOpBM91NEpY="; + }; + +in + +stdenv.mkDerivation (finalAttrs: { + pname = "tight-inclusion"; + version = "1.0.6"; + + src = fetchFromGitHub { + owner = "Continuous-Collision-Detection"; + repo = "Tight-Inclusion"; + tag = "v${finalAttrs.version}"; + hash = "sha256-Yq79qShpA5VmPan+QV05GrGrmsoUuVFCrJDK7F207Qs="; + }; + + patches = [ + "${cf}/recipe/patches/0001-Export-target-install-header-in-right-dir-still-need.patch" + "${cf}/recipe/patches/0002-Export-symbols-on-windows.patch" + "${cf}/recipe/patches/0003-patch-for-conda-forge-package.patch" + "${cf}/recipe/patches/0004-add-cmake-config-file-homogenize-project-name.patch" + "${cf}/recipe/patches/0005-fix-installation-of-configured-config.hpp-file.patch" + ]; + + postPatch = '' + # we don't need the bin + substituteInPlace CMakeLists.txt \ + --replace-fail \ + "add_subdirectory(app)" \ + "" + ''; + + nativeBuildInputs = [ + cmake + ]; + + propagatedBuildInputs = [ + eigen + spdlog + ]; + + cmakeFlags = [ + "-DBUILD_SHARED_LIBS=ON" + "-DTIGHT_INCLUSION_TOPLEVEL_PROJECT=ON" + ]; + + meta = { + description = "Conservative continuous collision detection (CCD) method with support for minimum separation"; + homepage = "https://github.com/Continuous-Collision-Detection/Tight-Inclusion"; + license = lib.licenses.mit; + maintainers = with lib.maintainers; [ nim65s ]; + platforms = lib.platforms.unix; + }; +})