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

material-maker: init at 1.3 #331491

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

material-maker: init at 1.3 #331491

wants to merge 2 commits into from

Conversation

aurreland
Copy link

@aurreland aurreland commented Aug 1, 2024

Description of changes

Material Maker is a Tool based on Godot Engine that can be used to create textures procedurally and paint 3D models.

https://www.materialmaker.org/

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/)
  • 24.11 Release Notes (or backporting 23.11 and 24.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 the 8.has: maintainer-list (update) This PR changes `maintainers/maintainer-list.nix` label Aug 1, 2024
@nixos-discourse
Copy link

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

https://discourse.nixos.org/t/package-godot-projects-to-nixpkgs/49923/15

@NixOSInfra NixOSInfra added the 12. first-time contribution This PR is the author's first one; please be gentle! label Aug 1, 2024
@ofborg ofborg bot added 8.has: package (new) This PR adds a new package 11.by: package-maintainer This PR was created by the maintainer of the package it changes 10.rebuild-darwin: 0 This PR does not cause any packages to rebuild on Darwin 10.rebuild-linux: 1-10 10.rebuild-linux: 1 labels Aug 1, 2024
@aurreland
Copy link
Author

Its running checks for darwin, I've not package it for darwin because i doesnt have a mac and it would be pointless as they could install it via a .dmg. Should i try to add darwin compatibity or maybe enable something so it doesnt bother about it ?

@eljamm
Copy link
Contributor

eljamm commented Aug 1, 2024

If it can be done, I don't see why we shouldn't package this for mac as well. We should refactor the current derivation first, though, then we'll look into doing that.

I'm currently in the process if reviewing this, so you can expect my suggestions shortly.

By the way, perhaps it's best if you mark this PR as draft, since it's not ready to be merged.

@aurreland aurreland marked this pull request as draft August 1, 2024 14:11
Comment on lines 132 to 137
meta = with lib; {
homepage = "https://www.materialmaker.org/";
description = "Tool based on Godot Engine that can be used to create textures procedurally and paint 3D models.";
license = licenses.mit;
platforms = [ "x86_64-linux" ];
maintainers = with maintainers; [ aurreland ];
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
meta = with lib; {
homepage = "https://www.materialmaker.org/";
description = "Tool based on Godot Engine that can be used to create textures procedurally and paint 3D models.";
license = licenses.mit;
platforms = [ "x86_64-linux" ];
maintainers = with maintainers; [ aurreland ];
meta = {
homepage = "https://www.materialmaker.org/";
description = "Tool based on Godot Engine that can be used to create textures procedurally and paint 3D models.";
license = lib.licenses.mit;
platforms = lib.platforms.x86_64-linux;
maintainers = with lib.maintainers; [ aurreland ];

See #208242

pkgs/by-name/ma/material-maker/package.nix Outdated Show resolved Hide resolved
pkgs/by-name/ma/material-maker/package.nix Outdated Show resolved Hide resolved
pkgs/by-name/ma/material-maker/package.nix Outdated Show resolved Hide resolved
pkgs/by-name/ma/material-maker/package.nix Show resolved Hide resolved
Comment on lines 26 to 32
pname = "material-maker";
version = "1.3";

src = if stdenv.isLinux then fetchurl {
url = "https://github.com/RodZill4/material-maker/releases/download/1.3/material_maker_1_3_linux.tar.gz";
hash = "sha256-Y8+ZwXy3zqnsxqqaZeVgFSxLzmUkq+rBzbq8tEDc8/g=";
} else throw "unsupported platform";
Copy link
Contributor

Choose a reason for hiding this comment

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

Use fetchzip instead of fetchurl since it auto-unpacks. We can also reuse the defined attributes like pname, version and versionUnderscore

Suggested change
pname = "material-maker";
version = "1.3";
src = if stdenv.isLinux then fetchurl {
url = "https://github.com/RodZill4/material-maker/releases/download/1.3/material_maker_1_3_linux.tar.gz";
hash = "sha256-Y8+ZwXy3zqnsxqqaZeVgFSxLzmUkq+rBzbq8tEDc8/g=";
} else throw "unsupported platform";
pname = "material-maker";
inherit version;
src =
if stdenv.isLinux then
fetchzip {
url = "https://github.com/RodZill4/${pname}/releases/download/${version}/material_maker_${versionUnderscore}_linux.tar.gz";
hash = "sha256-WEu5gVfnswB5zYzu3leOL+hKOBzJbn48gHQKshlfOh4=";
}
else
throw "unsupported platform";

pkgs/by-name/ma/material-maker/package.nix Outdated Show resolved Hide resolved
pkgs/by-name/ma/material-maker/package.nix Outdated Show resolved Hide resolved
pkgs/by-name/ma/material-maker/package.nix Outdated Show resolved Hide resolved
pkgs/by-name/ma/material-maker/package.nix Outdated Show resolved Hide resolved
pkgs/by-name/ma/material-maker/package.nix Outdated Show resolved Hide resolved
pkgs/by-name/ma/material-maker/package.nix Outdated Show resolved Hide resolved
pkgs/by-name/ma/material-maker/package.nix Outdated Show resolved Hide resolved
@eljamm
Copy link
Contributor

eljamm commented Aug 1, 2024

As a tip, you can batch commit multiple suggestions from the Files Changed tab, so you don't have to do it for each of them.

See Incorporating feedback in your pull request - GitHub Docs

@aurreland
Copy link
Author

Thanks for the huge work eljamm and d-brasher, i will look into how we could add support for darwin.

@eljamm
Copy link
Contributor

eljamm commented Aug 1, 2024

Since we're using finalAttrs, you'll have to precede every variable name that was defined inside the derivation with that. So:

  • ${version} -> ${version} (stays version because we defined it in the let in block
  • ${pname} -> ${finalAttrs.pname}
  • ${meta.description} -> ${finalAttrs.meta.description}
  • ...

@aurreland
Copy link
Author

Good to know will change to this

@eljamm
Copy link
Contributor

eljamm commented Aug 1, 2024

Just as a plus, since we're inheriting version in the derivation, we can also do ${finalAttrs.version}, but that won't work for versionUnderscore since it wasn't inherited.

@aurreland
Copy link
Author

Should i pass it to ready now ?

@eljamm
Copy link
Contributor

eljamm commented Aug 1, 2024

Not yet, we still need to add darwin support.

@aurreland
Copy link
Author

How could we add support for darwin, because we are using binary do they work out of the box ? or should we try to remake the package to be compiled like lorien does ?

@eljamm
Copy link
Contributor

eljamm commented Aug 1, 2024

If the platform is Darwin, we just copy the source to the Applications folder, as far as I know, at least.

@aurreland
Copy link
Author

I will try tomorrow on an old mac i got, but i won't be able to do much till 24/08 as i am going on a vacation.

@eljamm
Copy link
Contributor

eljamm commented Aug 1, 2024

Well, in that case you can open this PR for review because I think this is good enough to be merged.

If we can figure out how to package and test this on mac, then we'll include it here tomorrow, else we can add that in a separate PR if this gets merged first.

@aurreland aurreland marked this pull request as ready for review August 1, 2024 16:12
Copy link
Contributor

@eljamm eljamm left a comment

Choose a reason for hiding this comment

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

LGTM

@d-brasher
Copy link
Contributor

I think it could be a good thing to squash the commits in order to have just
maintainers: add aurreland (mind the s!) and material-maker: init at 1.3

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

@eljamm
Copy link
Contributor

eljamm commented Aug 1, 2024

I totally forgot about that 🤦

Thanks!

@aurreland aurreland force-pushed the master branch 2 times, most recently from 27bfd22 to a1b6cfb Compare August 4, 2024 12:57
cp -r $src/doc $out/share
cp -r $src/examples $examples

for output in ${builtins.concatStringsSep " " finalAttrs.meta.outputsToInstall}; do
Copy link
Contributor

@eljamm eljamm Aug 4, 2024

Choose a reason for hiding this comment

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

Suggested change
for output in ${builtins.concatStringsSep " " finalAttrs.meta.outputsToInstall}; do
for output in $(getAllOutputNames); do

As I understand it, meta.outputsToInstall is used for the default outputs, which isn't a problem here since doc and examples are in the default already.

However, we will typically change outputs, so we need to match all cases from that. Also, if meta.outputsToInstall changes, the package will be rebuilt, and we don't want that to happen as changes to meta shouldn't cause a rebuild.

Example, try to build with:

nix-build -E 'with import ./. {}; (material-maker.overrideAttrs { outputs = ["out" "doc"]; })'
  • If outputsToInstall = finalAttrs.outputs;: No problem since overriding outputs will also override outputsToInstall and everything works. However, this doesn't sound correct to me because outputsToInstall is the default and shouldn't depend on outputs.

  • If we pin outputsToInstall = [ "out" "doc" "examples" ];: This doesn't work since we're looping over outputsToInstall which has "examples", but the overriden outputs does not, and so the destination $examples will not exist.

platforms = lib.platforms.darwin ++ (lib.intersectLists lib.platforms.linux lib.platforms.x86_64);
maintainers = with lib.maintainers; [ aurreland ];
mainProgram = "material-maker";
outputsToInstall = finalAttrs.outputs;
Copy link
Contributor

Choose a reason for hiding this comment

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

It might be better to specify the outputs directly, here:

Suggested change
outputsToInstall = finalAttrs.outputs;
outputsToInstall = [
"out"
"doc"
"examples"
];

If outputs change, that shouldn't change the default outputs, right?

Copy link
Author

Choose a reason for hiding this comment

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

So we should move

cp -r $src/doc $out/share
cp -r $src/examples $examples

into the for loop ?

Copy link
Contributor

@eljamm eljamm Aug 4, 2024

Choose a reason for hiding this comment

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

I was kinda thinking the same as well, sure.

Copy link
Contributor

@eljamm eljamm left a comment

Choose a reason for hiding this comment

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

Thanks a lot @aurreland and @d-brasher for your amazing contributions.

This looks good to me 😁

@eljamm eljamm added the 12.approvals: 1 This PR was reviewed and approved by one reputable person label Aug 4, 2024
@d-brasher
Copy link
Contributor

d-brasher commented Aug 4, 2024

Result of nixpkgs-review pr 331491 run on x86_64-linux 1

3 packages built:
  • material-maker
  • material-maker.doc
  • material-maker.examples

Also tested basic app functionality.

Copy link
Contributor

@d-brasher d-brasher left a comment

Choose a reason for hiding this comment

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

LGTM, too!

@d-brasher d-brasher added 12.approvals: 2 This PR was reviewed and approved by two reputable people and removed 12.approvals: 1 This PR was reviewed and approved by one reputable person labels Aug 4, 2024
@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-already-reviewed/2617/1881

@aurreland
Copy link
Author

I think we can remove finalAttrs, I'll do it this evening if you don't see any problem.

@aurreland
Copy link
Author

Its currently not being used in the package. And I don't know if it's useful to have it in. It's difficult to find good docs about it.

@aurreland
Copy link
Author

And if we keep it, should we use less let in and more finalAttrs refs?

@d-brasher
Copy link
Contributor

This issue is the only thing I can find about let in vs finalAttrs.
It appears to be debated, but finalAttrs has the advantage to allow easy overrides.

You could indeed drop the use of let in and move everything inside mkDerivation using finalAttrs (imho it would be better), but I am by no means an expert on this.

If you choose to keep the let in as is, I think you can remove finalAttrs.

@aurreland
Copy link
Author

I'll look into moving everything into finalAttrs.

@aurreland
Copy link
Author

Does this looks good to you ? I'll squash when its finalized

@d-brasher
Copy link
Contributor

looks fine to me 👍

Co-Authored-By: d-brasher <[email protected]>
Co-Authored-By: Fedi Jamoussi <[email protected]>
@aurreland
Copy link
Author

We should be done this time

@wegank wegank removed the 12.approvals: 2 This PR was reviewed and approved by two reputable people label Aug 10, 2024
@sivizius
Copy link
Contributor

Duplicate of #315483?

@FliegendeWurst FliegendeWurst added the needs_merger (old Marvin label, do not use) label Dec 2, 2024
@FliegendeWurst FliegendeWurst removed the needs_merger (old Marvin label, do not use) label Dec 12, 2024
@FliegendeWurst FliegendeWurst added the 2.status: merge conflict This PR has merge conflicts with the target branch label Dec 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
2.status: merge conflict This PR has merge conflicts with the target branch 8.has: maintainer-list (update) This PR changes `maintainers/maintainer-list.nix` 8.has: package (new) This PR adds a new package 10.rebuild-darwin: 1-10 10.rebuild-darwin: 1 10.rebuild-linux: 1-10 10.rebuild-linux: 1 11.by: package-maintainer This PR was created by the maintainer of the package it changes 12. first-time contribution This PR is the author's first one; please be gentle!
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants