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

minion: init at 3.0.12 #350303

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

minion: init at 3.0.12 #350303

wants to merge 1 commit into from

Conversation

PatrickDaG
Copy link
Contributor

@PatrickDaG PatrickDaG commented Oct 21, 2024

New package minion a MMO Addon manager for WOW and ESO from https://minion.mmoui.com/.
Close #142868

Adapted from @Vodurden, big thanks, and if you want to be credited somehow lmk.

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.

@Scrumplex
Copy link
Member

diff --git a/pkgs/by-name/mi/minion/package.nix b/pkgs/by-name/mi/minion/package.nix
index 19cd5de8d478..a166e5d67679 100644
--- a/pkgs/by-name/mi/minion/package.nix
+++ b/pkgs/by-name/mi/minion/package.nix
@@ -2,23 +2,27 @@
   stdenvNoCC,
   lib,
   fetchzip,
-  openjdk22,
+  openjfx21,
+  openjdk21,
   makeDesktopItem,
-  javaPackages,
-  gsettings-desktop-schemas,
-  gtk3,
+  wrapGAppsHook3,
+  makeBinaryWrapper,
 }:
 
 let
-  openjfx = javaPackages.openjfx22.override { withWebKit = true; };
-  jdk = openjdk22.override (
-    prev:
-    prev
-    // {
-      enableJavaFX = true;
-      inherit openjfx;
-    }
-  );
+  openjfx = openjfx21.override { withWebKit = true; };
+  openjdk = openjdk21.override {
+    enableJavaFX = true;
+    inherit openjfx;
+  };
+
+  jvmArgs = [
+    "-cp $out/share/minion/lib"
+    "--add-exports=javafx.graphics/com.sun.javafx.css=ALL-UNNAMED"
+    "--add-exports=javafx.graphics/javafx.scene.image=ALL-UNNAMED"
+    "--add-opens=javafx.graphics/javafx.scene.image=ALL-UNNAMED"
+    "--add-opens=java.base/java.lang=ALL-UNNAMED"
+  ];
 in
 stdenvNoCC.mkDerivation rec {
   version = "3.0.12";
@@ -30,26 +34,24 @@ stdenvNoCC.mkDerivation rec {
     stripRoot = false;
   };
 
+  nativeBuildInputs = [
+    makeBinaryWrapper
+    wrapGAppsHook3
+  ];
+
+  dontWrapGApps = true;
+
   installPhase = ''
-    mkdir -p "$out/bin"
-    mkdir -p "$out/lib/${pname}"
-    cp ./Minion-jfx.jar "$out/lib/${pname}/Minion-jfx.jar"
-    cp -r ./lib "$out/lib/${pname}/lib"
+    runHook preInstall
 
-    cat > "$out/bin/${pname}" << EOF
-    #!${stdenvNoCC.shell}
-    CLASSPATH="$out/lib"
-    XDG_DATA_DIRS="${gsettings-desktop-schemas}/share/gsettings-schemas/${gsettings-desktop-schemas.name}:${gtk3}/share/gsettings-schemas/${gtk3.name}:XDG_DATA_DIRS"
-    exec ${lib.getExe jdk} \
-    --add-exports=javafx.graphics/com.sun.javafx.css=ALL-UNNAMED \
-    --add-exports=javafx.graphics/javafx.scene.image=ALL-UNNAMED \
-    --add-opens=javafx.graphics/javafx.scene.image=ALL-UNNAMED \
-    --add-opens=java.base/java.lang=ALL-UNNAMED \
-    -cp "$CLASSPATH ./lib" -jar "$out/lib/${pname}/Minion-jfx.jar" "\$@"
-    EOF
+    install -D Minion-jfx.jar "$out/share/minion/Minion-jfx.jar"
+    cp -r ./lib "$out/share/minion/"
 
-    chmod a+x "$out/bin/${pname}"
+    makeWrapper ${lib.getExe openjdk} $out/bin/minion \
+      "''${gappsWrapperArgs[@]}" \
+      --add-flags "${lib.concatStringsSep " " jvmArgs} -jar $out/share/minion/Minion-jfx.jar"
 
+    runHook postInstall
   '';
 
   desktopItems = [
@@ -67,7 +69,7 @@ stdenvNoCC.mkDerivation rec {
     homepage = "https://minion.mmoui.com/";
     license = lib.licenses.unfree;
     platforms = lib.platforms.all;
-    mainProgram = minion;
+    mainProgram = "minion";
     maintainers = with lib.maintainers; [ patrickdag ];
   };
 }

@PatrickDaG
Copy link
Contributor Author

Turns out openjdk isn't actually a package, but an basically an alias that on linux evaluates to a normal build of openjdk but on darwin it realizes as zulu package, which doesn't support overwriting the openjfx version at build time. This resulted in the eval fails we've been getting. I'm sure there is a way around that, or maybe the overwrite isn't even needed on those builds, but in absence of any apple hardware I can't really test it so I've had to disable darwin support for now.

@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 10.rebuild-linux: 1-10 10.rebuild-linux: 1 labels Oct 30, 2024
@Vodurden
Copy link
Contributor

Thanks for taking this, I don't use my personal version anymore so I'm glad it was useful to someone else 🙂

openjfx = openjfx21.override { withWebKit = true; };
openjdk = openjdk21.override {
enableJavaFX = true;
inherit openjfx;
Copy link
Member

Choose a reason for hiding this comment

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

The JDK derivation was changed recently, and the override doesn't eval anymore.

Suggested change
inherit openjfx;
openjfx_jdk = openjfx;

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: 0 This PR does not cause any packages to rebuild 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
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Package request: Minion AddOn Manager (java version)
3 participants