Skip to content

pmp-library: init at 3.0.0#405747

Closed
yzx9 wants to merge 1 commit intoNixOS:masterfrom
yzx9:pmp-library
Closed

pmp-library: init at 3.0.0#405747
yzx9 wants to merge 1 commit intoNixOS:masterfrom
yzx9:pmp-library

Conversation

@yzx9
Copy link
Copy Markdown
Contributor

@yzx9 yzx9 commented May 10, 2025

Homepage: https://www.pmp-library.org
Code: https://github.com/pmp-library/pmp-library


The Polygon Mesh Processing Library is a modern C++ open-source library for processing and visualizing polygon surface meshes. Its main features are:

  • An efficient and easy-to-use mesh data structure
  • Standard algorithms such as decimation, remeshing, subdivision, or smoothing
  • Ready-to-use visualization tools
  • Seamless cross-compilation to JavaScript

Things done

  • Built on platform(s)
    • x86_64-linux
    • aarch64-linux
    • x86_64-darwin
    • aarch64-darwin
  • For non-Linux: Is sandboxing enabled in nix.conf? (See Nix manual)
    • sandbox = relaxed
    • sandbox = true
  • Tested, as applicable:
  • Tested compilation of all packages that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD". Note: all changes have to be committed, also see nixpkgs-review usage
  • Tested basic functionality of all binary files (usually in ./result/bin/)
  • 25.05 Release Notes (or backporting 24.11 and 25.05 Release notes)
    • (Package updates) Added a release notes entry if the change is major or breaking
    • (Module updates) Added a release notes entry if the change is significant
    • (Module addition) Added a release notes entry if adding a new NixOS module
  • Fits CONTRIBUTING.md.

Add a 👍 reaction to pull requests you find important.

@github-actions github-actions Bot added 10.rebuild-darwin: 1 This PR causes 1 package to rebuild on Darwin. 10.rebuild-darwin: 1-10 This PR causes between 1 and 10 packages to rebuild on Darwin. 10.rebuild-linux: 1 This PR causes 1 package to rebuild on Linux. 10.rebuild-linux: 1-10 This PR causes between 1 and 10 packages to rebuild on Linux. labels May 10, 2025
@yzx9 yzx9 force-pushed the pmp-library branch 3 times, most recently from bd96d87 to 691e1dc Compare May 10, 2025 02:55
@yzx9 yzx9 changed the title pmp-libray: init at 3.0.0 pmp-library: init at 3.0.0 May 16, 2025
@yzx9 yzx9 force-pushed the pmp-library branch 2 times, most recently from f866bde to fb6cd52 Compare May 31, 2025 08:09
Copy link
Copy Markdown

@GirardR1006 GirardR1006 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not a CMake expert here. I checked that the package builds, does not add other dependencies and ran nixpkg-review for completeness.

Copy link
Copy Markdown

@ghost ghost left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Recs made:

  1. Reorganize parameter list, placing update script and overridable attr at the bottom.
  2. Revise patch comment to be more clear about purpose.
  3. Use lib.cmakeFeature instead of string literal.
  4. Replace doCheck with check for cross-comp (this is standard instead of doCheck = true;)
  5. Reorganize meta attrs.
  6. Add meta.longDescription.
diff --git a/pkgs/by-name/pm/pmp-library/package.nix b/pkgs/by-name/pm/pmp-library/package.nix
index d70334dd3738..de3abbc6bd46 100644
--- a/pkgs/by-name/pm/pmp-library/package.nix
+++ b/pkgs/by-name/pm/pmp-library/package.nix
@@ -5,9 +5,6 @@
   cmake,
   eigen,
   gtest,
-  nix-update-script,
-
-  withViewer ? false,
   glew,
   glfw,
   libGL,
@@ -16,8 +13,9 @@
   libXi,
   libXinerama,
   libXrandr,
+  nix-update-script,
+  withViewer ? false,
 }:
-
 stdenv.mkDerivation (finalAttrs: {
   pname = "pmp-library";
   version = "3.0.0";
@@ -35,7 +33,8 @@ stdenv.mkDerivation (finalAttrs: {
   ];

   patches = [
-    # use embedded imgui since it's not easy to patch
+    # Vendor in nixpkgs libraries for `glew` and `glfw`, imgui is
+    # unvendored due to a build failure
     ./cmake_find_package.patch
   ];

@@ -62,22 +61,31 @@ stdenv.mkDerivation (finalAttrs: {
     (lib.cmakeBool "PMP_BUILD_DOCS" false)
     (lib.cmakeBool "PMP_BUILD_EXAMPLES" false)
     (lib.cmakeBool "PMP_BUILD_VIS" withViewer)
-    "-DEIGEN3_INCLUDE_DIR=${eigen}/include/eigen3"
+    (lib.cmakeFeature "EIGEN3_INCLUDE_DIR" "${eigen}/include/eigen3")
   ];

-  doCheck = true;
-  nativeCheckInputs = [
-    gtest
-  ];
+  doCheck = stdenv.buildPlatform.canExecute stdenv.hostPlatform;
+
+  nativeCheckInputs = [ gtest ];

   passthru.updateScript = nix-update-script { };

   meta = {
-    homepage = "https://www.pmp-library.org";
     description = "Polygon Mesh Processing Library";
+    longDescription = ''
+      The Polygon Mesh Processing Library is a modern C++ open-source
+      library for processing and visualizing polygon surface meshes. Its
+      main features are:
+
+      - An efficient and easy-to-use mesh data structure
+      - Standard algorithms such as decimation, remeshing, subdivision, or smoothing
+      - Ready-to-use visualization tools
+      - Seamless cross-compilation to JavaScript
+    '';
+    homepage = "https://www.pmp-library.org";
     changelog = "https://github.com/pmp-library/pmp-library/blob/${finalAttrs.version}/CHANGELOG.md";
-    platforms = lib.platforms.all;
     license = lib.licenses.mit;
     maintainers = with lib.maintainers; [ yzx9 ];
+    platforms = lib.platforms.all;
   };
 })

@yzx9 yzx9 requested a review from a user June 3, 2025 13:03
Copy link
Copy Markdown

@ghost ghost left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review 2

  • Revise description.
diff --git a/pkgs/by-name/pm/pmp-library/package.nix b/pkgs/by-name/pm/pmp-library/package.nix
index 2f8a95c038fd..1a7a5bc10202 100644
--- a/pkgs/by-name/pm/pmp-library/package.nix
+++ b/pkgs/by-name/pm/pmp-library/package.nix
@@ -72,7 +72,7 @@ stdenv.mkDerivation (finalAttrs: {
   passthru.updateScript = nix-update-script { };

   meta = {
-    description = "Polygon Mesh Processing Library";
+    description = "Library for processing and visualizing polygon surface meshes";
     longDescription = ''
       The Polygon Mesh Processing Library is a modern C++ open-source
       library for processing and visualizing polygon surface meshes.

@yzx9
Copy link
Copy Markdown
Contributor Author

yzx9 commented Jun 4, 2025

Thanks @normalcea for your detailed review!

I’d prefer to keep the current official description, as it doesn’t violate the nixpkgs contribution conventions and clearly reflects the library’s purpose and name.

Also, I noticed that the package uses an MIT-style license, which isn’t currently reflected in nixpkgs. Should I go ahead and update the license field?

@ghost
Copy link
Copy Markdown

ghost commented Jun 4, 2025

Your welcome,

Regarding package description as per https://github.com/NixOS/nixpkgs/blob/master/pkgs/README.md#meta-attributes

Not start with the package name.

More generally, it should not refer to the package name.

"Polygon Mesh Processing Library" is the expanded acronym of the package's project name (pmp-library).

"Library for processing and visualizing polygon surface meshes" is better for describing the package itself. "C++ Library for processing and visualizing polygon surface meshes" would also work as well. This is also taken from the project homepage (https://www.pmp-library.org/)

MIT-style license

Agh, well that's not good. I think we have to contact upstream in this case since this is a legal issue now. If you wish to open up an issue in upstream's GitHub issue tracker that's up to you since this possibly blocks inclusion into nixpkgs until this is settled.

Otherwise someone in nixpkgs legal should look at this since I'm not a lawyer.

@yzx9 yzx9 force-pushed the pmp-library branch 2 times, most recently from 25b8cc3 to 5f70fb1 Compare June 9, 2025 08:36
@yzx9
Copy link
Copy Markdown
Contributor Author

yzx9 commented Jun 9, 2025

I have updated the meta.license field to reflect the upstream license.

Copy link
Copy Markdown

@ghost ghost left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • Opened an issue with them to see if they'll just revert to using a plain old MIT license.
  • Removed whitespace between meta attrs and comment
  • Removed let binding for simplicity.
  • This license was introduced in commit pmp-library/pmp-library@5137606 which was in 2019 and they have a custom spdxId as well so I added that.
diff --git a/pkgs/by-name/pm/pmp-library/package.nix b/pkgs/by-name/pm/pmp-library/package.nix
index beb9c14b9fdf..5096a71d6935 100644
--- a/pkgs/by-name/pm/pmp-library/package.nix
+++ b/pkgs/by-name/pm/pmp-library/package.nix
@@ -85,20 +85,16 @@ stdenv.mkDerivation (finalAttrs: {
     '';
     homepage = "https://www.pmp-library.org";
     changelog = "https://github.com/pmp-library/pmp-library/blob/${finalAttrs.version}/CHANGELOG.md";
-
     # Upstream uses a MIT-style license with an explicit employer disclaimer
     # to clarify that the contributor’s employer bears no responsibility.
-    license =
-      let
-        name = "MIT License with employer disclaimer";
-      in
-      {
-        shortName = name;
-        fullName = name;
-        free = true;
-        redistributable = true;
-        url = "https://github.com/pmp-library/pmp-library/blob/${finalAttrs.version}/LICENSE.txt";
-      };
+    license = {
+      shortName = "MIT License with employer disclaimer";
+      fullName = "MIT License with employer disclaimer";
+      spdxId = "MIT-with-employer-disclaimer";
+      free = true;
+      redistributable = true;
+      url = "https://github.com/pmp-library/pmp-library/blob/${finalAttrs.version}/LICENSE.txt";
+    };
     maintainers = with lib.maintainers; [ yzx9 ];
     platforms = lib.platforms.all;
   };

I didn't realize that lib.mkLicense isn't exposed in nixpkgs and lives entirely in lib/licenses.nix the more you know.

@yzx9
Copy link
Copy Markdown
Contributor Author

yzx9 commented Jun 10, 2025

Many thanks for your help! I’ve followed your suggestions, except for adding spdxId, since the custom license doesn’t exist in the SPDX License list, and the field isn’t required in nixpkgs.

@nixpkgs-ci nixpkgs-ci Bot added the 12.approvals: 1 This PR was reviewed and approved by one person. label Jun 25, 2025
@nixpkgs-ci nixpkgs-ci Bot added the 2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md label Dec 8, 2025
@yzx9
Copy link
Copy Markdown
Contributor Author

yzx9 commented Dec 10, 2025

nixpkgs-review result

Generated using nixpkgs-review.

Command: nixpkgs-review pr 405747
Commit: d194b7334f28373cb1df070a8b7b10e84ac98c8b


x86_64-linux

✅ 3 packages built:
  • nixpkgs-manual
  • pmp-library
  • pmp-library.dev

aarch64-darwin

❌ 2 packages failed to build:
  • pmp-library
  • pmp-library.dev
✅ 1 package built:
  • nixpkgs-manual

Error logs: `aarch64-darwin`
pmp-library
[ 32%] Building CXX object src/pmp/CMakeFiles/pmp.dir/algorithms/smoothing.cpp.o
[ 33%] Building CXX object src/pmp/CMakeFiles/pmp.dir/algorithms/subdivision.cpp.o
[ 35%] Building CXX object src/pmp/CMakeFiles/pmp.dir/algorithms/triangulation.cpp.o
1 error generated.
[ 37%] Building CXX object src/pmp/CMakeFiles/pmp.dir/algorithms/utilities.cpp.o
make[2]: *** [tests/CMakeFiles/googletest.dir/build.make:79: tests/CMakeFiles/googletest.dir/__/external/googletest-1.13.0/googletest/src/gtest-all.cc.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:230: tests/CMakeFiles/googletest.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs....
[ 39%] Building CXX object src/pmp/CMakeFiles/pmp.dir/io/io.cpp.o
[ 41%] Building CXX object src/pmp/CMakeFiles/pmp.dir/io/read_obj.cpp.o
[ 42%] Building CXX object src/pmp/CMakeFiles/pmp.dir/io/read_off.cpp.o
[ 44%] Building CXX object src/pmp/CMakeFiles/pmp.dir/io/read_pmp.cpp.o
[ 46%] Building CXX object src/pmp/CMakeFiles/pmp.dir/io/read_stl.cpp.o
[ 48%] Building CXX object src/pmp/CMakeFiles/pmp.dir/io/write_obj.cpp.o
[ 50%] Building CXX object src/pmp/CMakeFiles/pmp.dir/io/write_off.cpp.o
[ 51%] Building CXX object src/pmp/CMakeFiles/pmp.dir/io/write_pmp.cpp.o
[ 53%] Building CXX object src/pmp/CMakeFiles/pmp.dir/io/write_stl.cpp.o
[ 55%] Linking CXX shared library ../../libpmp.dylib
[ 55%] Built target pmp
make: *** [Makefile:146: all] Error 2

@yzx9
Copy link
Copy Markdown
Contributor Author

yzx9 commented Dec 10, 2025

Hi @normalcea, I noticed that this package is currently broken on Darwin. I'm still willing to fix it if it's acceptable to keep it, or we could mark it as unfree instead. Otherwise, I'll close this PR.

@nixpkgs-ci nixpkgs-ci Bot removed the 2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md label Dec 10, 2025
@ghost
Copy link
Copy Markdown

ghost commented Dec 10, 2025

@yzx9

Darwin support is not required for a package to be included (though broken meta attribute should be added if the package supports darwin builds but our derivation doesn't succeed). One thing that is concerning is that this library doesn't have any dependents in tree, which would make it a leaf package with no clear userbase.

I think this PR should be retired for the time being until a package arrives in-tree that uses this library. There hasn't been a new upstream release in 2 years as well.

The licensing issue isn't a dealbreaker since the disclaimer listed doesn't add any additional clauses to the MIT license since all liability is voided anyway. So it has nothing to do with that thankfully (though it is still very annoying).

@yzx9
Copy link
Copy Markdown
Contributor Author

yzx9 commented Dec 11, 2025

@normalcea Thanks for the review! That makes sense. I’ll close this PR since I’ve actually forgotten why I added this package in the first place. If anyone needs this package, please let me know.

@yzx9 yzx9 closed this Dec 11, 2025
@yzx9 yzx9 deleted the pmp-library branch December 11, 2025 01:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

8.has: package (new) This PR adds a new package 10.rebuild-darwin: 1-10 This PR causes between 1 and 10 packages to rebuild on Darwin. 10.rebuild-darwin: 1 This PR causes 1 package to rebuild on Darwin. 10.rebuild-linux: 1-10 This PR causes between 1 and 10 packages to rebuild on Linux. 10.rebuild-linux: 1 This PR causes 1 package to rebuild on Linux. 12.approvals: 1 This PR was reviewed and approved by one person.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants