From a35ae3a2d05cbf6dc6ac21a6f3267a7df2e13fdb Mon Sep 17 00:00:00 2001 From: Gary Guo Date: Tue, 30 Jan 2024 10:11:08 +0000 Subject: [PATCH 1/2] sweethome3d: fix libGL startup failure Currently SweetHome3D cannot run on NixOS. It startups with Profiles [GL4bc, GL3bc, GL2, GLES1] not available on device null error, and the cause is by inability to find libGL/libEGL. Add libGL to path to fix this. This also allows to remove MESA override. --- pkgs/applications/misc/sweethome3d/default.nix | 8 +++----- pkgs/applications/misc/sweethome3d/editors.nix | 1 + 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/pkgs/applications/misc/sweethome3d/default.nix b/pkgs/applications/misc/sweethome3d/default.nix index 5755c5610281..bc3e1f4b7d25 100644 --- a/pkgs/applications/misc/sweethome3d/default.nix +++ b/pkgs/applications/misc/sweethome3d/default.nix @@ -13,6 +13,7 @@ , autoPatchelfHook , libXxf86vm , unzip +, libGL }: let @@ -75,13 +76,9 @@ let cp "${sweethome3dItem}/share/applications/"* $out/share/applications - # MESA_GL_VERSION_OVERRIDE is needed since the update from MESA 19.3.3 to 20.0.2: - # without it a "Profiles [GL4bc, GL3bc, GL2, GLES1] not available on device null" - # exception is thrown on startup. - # https://discourse.nixos.org/t/glx-not-recognised-after-mesa-update/6753 makeWrapper ${jre8}/bin/java $out/bin/$exec \ - --set MESA_GL_VERSION_OVERRIDE 2.1 \ --prefix XDG_DATA_DIRS : "$XDG_ICON_DIRS:${gtk3.out}/share:${gsettings-desktop-schemas}/share:$out/share:$GSETTINGS_SCHEMAS_PATH" \ + --prefix LD_LIBRARY_PATH : "${lib.makeLibraryPath [ libGL ]}" \ --add-flags "-Dsun.java2d.opengl=true -jar $out/share/java/${module}-${version}.jar -cp $out/share/java/Furniture.jar:$out/share/java/Textures.jar:$out/share/java/Help.jar -d${toString stdenv.hostPlatform.parsed.cpu.bits}" @@ -102,6 +99,7 @@ let inherit license; maintainers = [ lib.maintainers.edwtjo ]; platforms = lib.platforms.linux; + mainProgram = exec; }; }; diff --git a/pkgs/applications/misc/sweethome3d/editors.nix b/pkgs/applications/misc/sweethome3d/editors.nix index 6c737f469c67..f12f059e22af 100644 --- a/pkgs/applications/misc/sweethome3d/editors.nix +++ b/pkgs/applications/misc/sweethome3d/editors.nix @@ -77,6 +77,7 @@ let inherit license; maintainers = [ lib.maintainers.edwtjo ]; platforms = lib.platforms.linux; + mainProgram = exec; }; }; From ba45aa9f6edfc2efcc3640568ea3914513638a82 Mon Sep 17 00:00:00 2001 From: Gary Guo Date: Tue, 30 Jan 2024 10:29:36 +0000 Subject: [PATCH 2/2] sweethome3d: upgrade JDK/JRE The comment about 6.5 is no longer relevant. I have tested building and running with latest JDK/JRE and it works well, with more updated look & feel. --- pkgs/applications/misc/sweethome3d/default.nix | 10 ++++------ pkgs/applications/misc/sweethome3d/editors.nix | 10 ++++------ 2 files changed, 8 insertions(+), 12 deletions(-) diff --git a/pkgs/applications/misc/sweethome3d/default.nix b/pkgs/applications/misc/sweethome3d/default.nix index bc3e1f4b7d25..2c8f9993fed5 100644 --- a/pkgs/applications/misc/sweethome3d/default.nix +++ b/pkgs/applications/misc/sweethome3d/default.nix @@ -3,9 +3,7 @@ , fetchurl , makeWrapper , makeDesktopItem -# sweethome3d 6.5.2 does not yet fully build&run with jdk 9 and later? -, jdk8 -, jre8 +, jdk , ant , gtk3 , gsettings-desktop-schemas @@ -43,7 +41,7 @@ let }; postPatch = '' - addAutoPatchelfSearchPath ${jre8}/lib/openjdk/jre/lib/ + addAutoPatchelfSearchPath ${jdk}/lib/openjdk/lib/ autoPatchelf lib # Nix cannot see the runtime references to the paths we just patched in @@ -53,7 +51,7 @@ let ''; nativeBuildInputs = [ makeWrapper unzip autoPatchelfHook ]; - buildInputs = [ ant jdk8 p7zip gtk3 gsettings-desktop-schemas libXxf86vm ]; + buildInputs = [ ant jdk p7zip gtk3 gsettings-desktop-schemas libXxf86vm ]; buildPhase = '' runHook preBuild @@ -76,7 +74,7 @@ let cp "${sweethome3dItem}/share/applications/"* $out/share/applications - makeWrapper ${jre8}/bin/java $out/bin/$exec \ + makeWrapper ${jdk}/bin/java $out/bin/$exec \ --prefix XDG_DATA_DIRS : "$XDG_ICON_DIRS:${gtk3.out}/share:${gsettings-desktop-schemas}/share:$out/share:$GSETTINGS_SCHEMAS_PATH" \ --prefix LD_LIBRARY_PATH : "${lib.makeLibraryPath [ libGL ]}" \ --add-flags "-Dsun.java2d.opengl=true -jar $out/share/java/${module}-${version}.jar -cp $out/share/java/Furniture.jar:$out/share/java/Textures.jar:$out/share/java/Help.jar -d${toString stdenv.hostPlatform.parsed.cpu.bits}" diff --git a/pkgs/applications/misc/sweethome3d/editors.nix b/pkgs/applications/misc/sweethome3d/editors.nix index f12f059e22af..d5cdebb76282 100644 --- a/pkgs/applications/misc/sweethome3d/editors.nix +++ b/pkgs/applications/misc/sweethome3d/editors.nix @@ -3,9 +3,7 @@ , fetchurl , makeWrapper , makeDesktopItem -# sweethome3d 6.5.2 does not yet fully build&run with jdk 9 and later? -, jdk8 -, jre8 +, jdk , ant , gtk3 , gsettings-desktop-schemas @@ -44,7 +42,7 @@ let }; nativeBuildInputs = [ makeWrapper unzip ]; - buildInputs = [ ant jre8 jdk8 gtk3 gsettings-desktop-schemas ]; + buildInputs = [ ant jdk gtk3 gsettings-desktop-schemas ]; postPatch = '' sed -i -e 's,../SweetHome3D,${applicationSrc},g' build.xml @@ -54,7 +52,7 @@ let buildPhase = '' runHook preBuild - ant -lib ${applicationSrc}/libtest -lib ${applicationSrc}/lib -lib ${jdk8}/lib + ant -lib ${applicationSrc}/libtest -lib ${applicationSrc}/lib -lib ${jdk}/lib runHook postBuild ''; @@ -64,7 +62,7 @@ let mkdir -p $out/share/{java,applications} cp ${module}-${version}.jar $out/share/java/. cp "${editorItem}/share/applications/"* $out/share/applications - makeWrapper ${jre8}/bin/java $out/bin/$exec \ + makeWrapper ${jdk}/bin/java $out/bin/$exec \ --prefix XDG_DATA_DIRS : "$XDG_ICON_DIRS:${gtk3.out}/share:${gsettings-desktop-schemas}/share:$out/share:$GSETTINGS_SCHEMAS_PATH" \ --add-flags "-jar $out/share/java/${module}-${version}.jar -d${toString stdenv.hostPlatform.parsed.cpu.bits}" '';