Skip to content
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

obj2voxel: init at 1.3.4 #254299

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

obj2voxel: init at 1.3.4 #254299

wants to merge 1 commit into from

Conversation

zeuner
Copy link
Contributor

@zeuner zeuner commented Sep 9, 2023

Description of changes

Add package for obj2voxel. Fixes #254298.

Things done

  • Built on platform(s)
    • x86_64-linux
    • aarch64-linux
    • x86_64-darwin
    • aarch64-darwin
  • For non-Linux: Is sandbox = true set in nix.conf? (See Nix manual)
  • 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/)
  • 23.11 Release Notes (or backporting 23.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.

@dotlambda dotlambda changed the title obj2voxel: new package obj2voxel: init at 1.3.4 Sep 9, 2023
Copy link
Member

@dotlambda dotlambda left a comment

Choose a reason for hiding this comment

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

meta.maintainers is missing and the commit message should follow https://github.com/NixOS/nixpkgs/blob/master/CONTRIBUTING.md#commit-conventions

pkgs/tools/graphics/obj2voxel/default.nix Outdated Show resolved Hide resolved
pkgs/tools/graphics/obj2voxel/default.nix Outdated Show resolved Hide resolved
Copy link
Member

Choose a reason for hiding this comment

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

The contents of this file should be commited in a separate commit. You can see the history of that file for good examples of commit messages. Also it needs the githubid. You can look at the top of the file for instructions on how to obtain it.

https://github.com/NixOS/nixpkgs/blob/master/CONTRIBUTING.md#commit-conventions

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Will split the commit. AFAIK, the current master branch doesn't require a githubId, though: https://github.com/NixOS/nixpkgs/blob/master/maintainers/maintainer-list.nix#L7

Copy link
Member

Choose a reason for hiding this comment

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

Oh, good to know. Then the split should be enough.

Copy link
Member

Choose a reason for hiding this comment

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

Please add the githubId. It helps if you ever change your GitHub handle.
Definitely add github. Otherwise you can't be pinged by https://github.com/ofborg when someone makes a change to this package.

Copy link
Member

Choose a reason for hiding this comment

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

The more likely scenario would be that I delete my Github handle once I figure out how to deal with various vendor lock-in issues that prevent this ATM.

Feel free to remove your GitHub handle from this file once you do so.


patches = [
# pull missing definitions (https://github.com/Eisenwave/voxel-io/pull/3)
./stdlib-defs.patch
Copy link
Member

Choose a reason for hiding this comment

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

Could you use fetchpatch with the url https://github.com/Eisenwave/voxel-io/pull/3.patch instead of commiting the file ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I have to look into that. Actually, I first thought about pulling the patch from the commit in the PR mentioned, but it's for a submodule, so it would have to be applied to a subdirectory of the source tree.

Copy link
Member

Choose a reason for hiding this comment

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

Its not a blocker. But when patches are available in a more or less stable url, then putting them in the tree is not really needed.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@nagy If I figure out a clean way to apply an external patch to a subdirectory of the source tree, I would actually prefer getting it from the PR. This would avoid duplicated effort since the build errors on aarch64-darwin I see through ofborg should also be pushed upstream.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@dotlambda The more likely scenario would be that I delete my Github handle once I figure out how to deal with various vendor lock-in issues that prevent this ATM.

Copy link
Member

Choose a reason for hiding this comment

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

fetchpatch can add a prefix

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I moved most patches to corresponding upstream PRs (Eisenwave/voxel-io#4, Eisenwave/voxel-io#3) and switched to fetchpatch. The remaining patch is specific to 1.3.4 as the upstream head already fixed it.

GIT_CONFIG_KEY_0 = "url.https://github.com/.insteadOf";
GIT_CONFIG_VALUE_0 = "[email protected]:";
}
);
Copy link
Member

Choose a reason for hiding this comment

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

Interesting construction. I assume that your firewall has prevented from loading the submodules via ssh? I Dont know if this is the right way to circumvent this though.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It's a workaround suggested here: #195117 (comment)

Not sure whether it's better to require SSH keys on build hosts.

Copy link
Member

Choose a reason for hiding this comment

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

Ok, then lets keep it. Maybe it will be adapted in fetchgit itself one day.

@@ -19882,6 +19882,8 @@ with pkgs;

obelisk = callPackage ../development/tools/ocaml/obelisk { menhir = ocamlPackages.menhir; };

obj2voxel = callPackage ../tools/graphics/obj2voxel { };
Copy link
Member

Choose a reason for hiding this comment

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

Could you also switch this to the new by-name structure introduced in #237439 ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done, seems to work.

Copy link
Member

@dotlambda dotlambda left a comment

Choose a reason for hiding this comment

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

What about meta.homepage and meta.mainProgram?

pkgs/tools/graphics/obj2voxel/default.nix Outdated Show resolved Hide resolved
@zeuner
Copy link
Contributor Author

zeuner commented Sep 10, 2023

meta.maintainers is missing and the commit message should follow https://github.com/NixOS/nixpkgs/blob/master/CONTRIBUTING.md#commit-conventions

Should be resolved.

@zeuner
Copy link
Contributor Author

zeuner commented Sep 10, 2023

What about meta.homepage and meta.mainProgram?

Not aware of a homepage, but mainProgram was added.

@dotlambda
Copy link
Member

Not aware of a homepage

https://github.com/Eisenwave/voxel-io

(
fetchpatch {
name = "fix-aarch64-darwin-type-mismatch.patch";
url = "https://patch-diff.githubusercontent.com/raw/Eisenwave/voxel-io/pull/4.diff";
Copy link
Member

Choose a reason for hiding this comment

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

Use a commit url like https://github.com/Eisenwave/voxel-io/commit/2f800f6aca8acd0cc18f9625b411c6dc2956f2ea.patch because a push to the PR branch would invalidate the hash.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Using a pull-related patch URL was suggested earlier, and I actually think it makes sense. In case the PR would change, it is likely that the changes are also useful for the maintenance of the nix package, thus justifying an update of the hash.

Copy link
Member

Choose a reason for hiding this comment

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

We want to be able to build this package in the far future too so we need stable URLs.

Copy link
Contributor Author

@zeuner zeuner Oct 5, 2023

Choose a reason for hiding this comment

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

Being able to build packages in the far future is a formidable goal. But if it is to be possible without resorting to cache.nixos.org, I doubt this is the right place to achieve it, though. It's not how Nix package are usually designed. E.g. even with git sources that could be potentially long-term stable, packages tend to reference (potentially unstable) tags instead of cryptographic hashes. I often encounter packages where the URL resource can't be retrieved anymore, or the hash has changed. Which shows that Nix has decided to take a compromise here. Stable URLs are being considered, but may be avoided if there is a reason to.

There is also a reason to reference pull requests instead of commit hashes because pull requests also refer to a specific goal with respect to the upstream source, and possibly the discussion around it. This helps maintainers because later on when changing the package, they can decide whether that specific goal is still relevant.

Nonetheless, the URLs have been changed now to URLs with the objective to remain stable over time. I hope this can relieve your concerns, while still keeping the possibility to look up the related pull request easily.

Copy link
Member

Choose a reason for hiding this comment

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

You can and should always reference the relevant PR and describe what it does in a comment right next to the patch URL, again best of both worlds.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added that comment. The stability of commit diff URLs should still not be overestimated, I also saw them disappear in case of force-pushes sometimes.

@@ -67,6 +67,7 @@ stdenv.mkDerivation (finalAttrs: {
meta = with lib; {
description = "Convert OBJ and STL files to voxels, with support for textures";
mainProgram = "obj2voxel";
homepage = "https://github.com/Eisenwave/obj2voxel/blob/master/README.adoc";
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
homepage = "https://github.com/Eisenwave/obj2voxel/blob/master/README.adoc";
homepage = "https://github.com/Eisenwave/obj2voxel";

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Any rationale for this requested change? When looking for a homepage, people usually expect a page where they can read about the project, and not a list of files (which is what is presented when just opening the repo URL). So the README file is what comes closest to a homepage.

Copy link
Member

Choose a reason for hiding this comment

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

The README is right there when scrolling down, so the request actually allows both users and developers get what they want.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Changed it to point right to the repo as this is how many other packages also do it currently. I still think repo and homepage are not synonymous, and there ought to be an extra field, with the current meaning of "homepage" with that fallback being emulated by doing a meta.homepage or meta.repo.

Copy link
Member

Choose a reason for hiding this comment

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

I sometimes abuse meta.downloadPage for the repo url.

gm6k = {
email = "[email protected]";
name = "Isidor Zeuner";
};
Copy link
Member

Choose a reason for hiding this comment

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

github and githubId are still missing

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Still not required: https://github.com/NixOS/nixpkgs/blob/master/maintainers/maintainer-list.nix#L7
"Optional, but at least one of email, matrix or githubId must be given"

Let's focus on issues relevant to this PR...

, stdenv
, fetchFromGitHub
, fetchpatch
, static ? stdenv.hostPlatform.isStatic
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
, static ? stdenv.hostPlatform.isStatic

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

(
fetchpatch {
name = "fix-aarch64-darwin-type-mismatch.patch";
url = "https://patch-diff.githubusercontent.com/raw/Eisenwave/voxel-io/pull/4.diff";
Copy link
Member

Choose a reason for hiding this comment

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

We want to be able to build this package in the far future too so we need stable URLs.

'';

cmakeFlags = [
"-DBUILD_SHARED_LIBS=${if static then "OFF" else "ON"}"
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
"-DBUILD_SHARED_LIBS=${if static then "OFF" else "ON"}"
"-DBUILD_SHARED_LIBS=${if stdenv.targetPlatform.isStatic then "OFF" else "ON"}"

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

mainProgram = "obj2voxel";
homepage = "https://github.com/Eisenwave/obj2voxel/blob/master/README.adoc";
license = licenses.mit;
platforms = platforms.all;
Copy link
Member

Choose a reason for hiding this comment

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

Maybe

Suggested change
platforms = platforms.all;
platforms = platforms.unix;

is more appropriate.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This seems remarkable, considering that the package does not use any libraries, CMake is known to be very portable, and pure standard C++ even more. So I would have expected that almost any platform can work (modulo maybe patching around some quirks). But since I have no non-unix platform to test here, I'll have to trust your assessment.

}
)
# already fixed in upstream git head
./1.3.4-fix-type-mismatch.patch
Copy link
Member

Choose a reason for hiding this comment

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

We can't use fetchpatch?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

IMHO, not easily. By now, upstream master avoids the issue because all these size_t typed variables have been changed to usize. But this is a rather global change not easily applied, so I decided towards a clear and small patch that just solves the issue remaining after applying the fixes that made it into pull requests.

IMHO, the next best solution would actually be to just build the upstream master. But for now, I decided to keep with the usual policy of building something that has a version number.

, fetchFromGitHub
, fetchpatch
, static ? stdenv.hostPlatform.isStatic
, config
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
, config

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

@zeuner
Copy link
Contributor Author

zeuner commented Oct 10, 2023

meta.maintainers is missing and the commit message should follow https://github.com/NixOS/nixpkgs/blob/master/CONTRIBUTING.md#commit-conventions

Fixed one month ago.

@zeuner zeuner requested a review from dotlambda October 10, 2023 12:39
Copy link
Member

@nagy nagy left a comment

Choose a reason for hiding this comment

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

If you squash all obj2voxel: related commits into one init commit ( so that we have one package and one maintainer commit ) then its fine for me.

@zeuner
Copy link
Contributor Author

zeuner commented Oct 10, 2023

If you squash all obj2voxel: related commits into one init commit ( so that we have one package and one maintainer commit ) then its fine for me.

Done.

@nixos-discourse
Copy link

This pull request has been mentioned on NixOS Discourse. There might be relevant details there:

https://discourse.nixos.org/t/how-to-handle-stuck-reviews/36883/1

(
fetchpatch {
name = "add-std-includes.patch";
url = "https://web.archive.org/web/20230914180442/https://patch-diff.githubusercontent.com/raw/Eisenwave/voxel-io/pull/3.diff";
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
url = "https://web.archive.org/web/20230914180442/https://patch-diff.githubusercontent.com/raw/Eisenwave/voxel-io/pull/3.diff";
url = "https://github.com/Eisenwave/voxel-io/compare/d902568de2d4afda254e533a5ee9e4ad5fe7d2be...2f800f6aca8acd0cc18f9625b411c6dc2956f2ea.patch";

And likewise for the other patch?

Kind of excessive going through archive.org for these just to get a permalink, isn't it?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Changed that as requested. Still, I'd like to point out that @dotlambda previously asked for stable URLs from which building in the far future is possible (see #254299 (comment)). The most straightforward way I know to achieve this is archive.org. github.com is known to lose commit information through garbage collection, e.g. in case of forced pushes.

@zeuner zeuner force-pushed the obj2voxel branch 2 times, most recently from d6a9b8e to 1ff13d6 Compare December 15, 2023 12:58
Copy link
Member

@rhendric rhendric left a comment

Choose a reason for hiding this comment

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

Haven't tested, but looks reasonable.

@nixos-discourse
Copy link

This pull request has been mentioned on NixOS Discourse. There might be relevant details there:

https://discourse.nixos.org/t/prs-ready-for-review/3032/3111

src = (
fetchFromGitHub {
owner = "Eisenwave";
repo = finalAttrs.pname;
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
repo = finalAttrs.pname;
repo = "obj2voxel";

If we append something to pname, that would no longer be true

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Doesn't sound unreasonable, but wouldn't it be more appropriate to apply this change using a treewide commit supplemented by some contributor documentation to be read by all contributors?

I'm asking because using pname to construct repo URLs seems to be very common even among new packages, as verified by doing

grep -r 'repo = .*pname' pkgs/by-name

(pkgs/by-name being a fairly new mechanism)

).overrideAttrs (
_: {
GIT_CONFIG_COUNT = 1;
GIT_CONFIG_KEY_0 = "url.https://github.com/.insteadOf";
Copy link
Member

Choose a reason for hiding this comment

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

Would be nice if we could upstream the url change

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good idea, done: Eisenwave/obj2voxel#9

For the time being, the workaround might still be necessary.

@Mic92
Copy link
Member

Mic92 commented Dec 18, 2023

I would not merge any new packages with @zeuner as the only maintainer until this is sorted: #273146 (comment)

@mweinelt mweinelt marked this pull request as draft December 18, 2023 19:03
@zeuner
Copy link
Contributor Author

zeuner commented Dec 20, 2023

I would not merge any new packages with @zeuner as the only maintainer until this is sorted: #273146 (comment)

I'm not sure what you would want to "sort" in the PR you mentioned. @infinisil already merged a PR which implements the requested code changes about a week ago (#273332), so technically, the PR is done.

If you are unhappy with the outcome of a non-related PR, you may express that in the particular PR, or open a new one if appropriate. But if you don't have anything to add to this PR, it doesn't belong here.

@zeuner
Copy link
Contributor Author

zeuner commented Dec 20, 2023

@mweinelt I saw your review comments (#254299 (comment) #254299 (comment)) and already addressed them. So I don't understand why you would mark this PR as a draft. If you see anything that should be changed in your opinion, please state it clearly so it can be addressed.

@zeuner zeuner marked this pull request as ready for review December 20, 2023 06:34
@zeuner zeuner force-pushed the obj2voxel branch 2 times, most recently from 229899b to 53d85a2 Compare December 21, 2023 01:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Package request: obj2voxel
8 participants