From 8f9744c8cef366374be1531f11984afcfb3cfae9 Mon Sep 17 00:00:00 2001 From: Hythera <87016780+Hythera@users.noreply.github.com> Date: Mon, 15 Dec 2025 18:26:49 +0100 Subject: [PATCH] noriskclient-launcher-unwrapped: init at 0.6.14 --- .../disable-bundling.patch | 22 +++++ .../java-from-path.patch | 34 +++++++ .../package.nix | 93 +++++++++++++++++++ 3 files changed, 149 insertions(+) create mode 100644 pkgs/by-name/no/noriskclient-launcher-unwrapped/disable-bundling.patch create mode 100644 pkgs/by-name/no/noriskclient-launcher-unwrapped/java-from-path.patch create mode 100644 pkgs/by-name/no/noriskclient-launcher-unwrapped/package.nix diff --git a/pkgs/by-name/no/noriskclient-launcher-unwrapped/disable-bundling.patch b/pkgs/by-name/no/noriskclient-launcher-unwrapped/disable-bundling.patch new file mode 100644 index 000000000000..8666b86ddfef --- /dev/null +++ b/pkgs/by-name/no/noriskclient-launcher-unwrapped/disable-bundling.patch @@ -0,0 +1,22 @@ +diff --git a/src-tauri/tauri.conf.json b/src-tauri/tauri.conf.json +index bb58d13..c1046f8 100644 +--- a/src-tauri/tauri.conf.json ++++ b/src-tauri/tauri.conf.json +@@ -100,7 +100,7 @@ + } + } + }, +- "active": true, ++ "active": false, + "targets": ["app", "dmg", "deb", "appimage", "nsis"], + "icon": [ + "icons/32x32.png", +@@ -109,7 +109,7 @@ + "icons/icon.icns", + "icons/icon.ico" + ], +- "createUpdaterArtifacts": true, ++ "createUpdaterArtifacts": false, + "fileAssociations": [ + { + "ext": ["noriskpack"], diff --git a/pkgs/by-name/no/noriskclient-launcher-unwrapped/java-from-path.patch b/pkgs/by-name/no/noriskclient-launcher-unwrapped/java-from-path.patch new file mode 100644 index 000000000000..3403c305ee2c --- /dev/null +++ b/pkgs/by-name/no/noriskclient-launcher-unwrapped/java-from-path.patch @@ -0,0 +1,34 @@ +diff --git a/src-tauri/src/minecraft/downloads/java_download.rs b/src-tauri/src/minecraft/downloads/java_download.rs +index 25ab9b2..d1af896 100644 +--- a/src-tauri/src/minecraft/downloads/java_download.rs ++++ b/src-tauri/src/minecraft/downloads/java_download.rs +@@ -9,6 +9,7 @@ use flate2::read::GzDecoder; + use futures::future::try_join_all; + use log::{debug, error, info}; + use reqwest; ++use std::env; + use std::fs::File; + use std::io::Cursor; + use std::path::PathBuf; +@@ -526,6 +527,21 @@ impl JavaDownloadService { + ], + }; + ++ let target = format!("openjdk-{}", version); ++ match env::var_os("PATH") { ++ Some(paths) => { ++ for path in env::split_paths(&paths) { ++ if let Some(path_str) = path.to_str() { ++ if path_str.contains(&target) { ++ debug!("Found Java binary at: {:?}", path); ++ return Ok(path) ++ } ++ } ++ } ++ } ++ none => debug!("PATH is not defined"), ++ } ++ + // Try all possible paths + for java_binary in java_binary_paths { + debug!("Checking for Java binary at: {:?}", java_binary); diff --git a/pkgs/by-name/no/noriskclient-launcher-unwrapped/package.nix b/pkgs/by-name/no/noriskclient-launcher-unwrapped/package.nix new file mode 100644 index 000000000000..107fee8ecac5 --- /dev/null +++ b/pkgs/by-name/no/noriskclient-launcher-unwrapped/package.nix @@ -0,0 +1,93 @@ +{ + cargo-tauri, + desktop-file-utils, + fetchFromGitHub, + fetchYarnDeps, + glib, + gtk3, + libayatana-appindicator, + lib, + nix-update-script, + nodejs, + openssl, + pkg-config, + rustPlatform, + stdenv, + webkitgtk_4_1, + yarnConfigHook, +}: + +rustPlatform.buildRustPackage (finalAttrs: { + pname = "noriskclient-launcher-unwrapped"; + version = "0.6.14"; + + src = fetchFromGitHub { + owner = "NoRiskClient"; + repo = "noriskclient-launcher"; + tag = "v${finalAttrs.version}"; + hash = "sha256-9UUNIS8r/695maQ2j2+Wj2L5qy55Wfs/MNhKJnwC6GI="; + }; + + yarnOfflineCache = fetchYarnDeps { + yarnLock = "${finalAttrs.src}/yarn.lock"; + hash = "sha256-IWgP4VEyEBNsxALKGMpk8WZCIc76qcEu5K+kYqsdYkQ="; + }; + + patches = [ + # The tauri.conf.json is configured to build multiple apps. We don't want that here. + ./disable-bundling.patch + + # Make the launcher find java from PATH, instead of downloading its own, which is not going to work on NixOS. + ./java-from-path.patch + ]; + + postPatch = lib.optionalString stdenv.hostPlatform.isLinux '' + substituteInPlace $cargoDepsCopy/libappindicator-sys-*/src/lib.rs \ + --replace-fail "libayatana-appindicator3.so.1" "${libayatana-appindicator}/lib/libayatana-appindicator3.so.1" + ''; + + cargoHash = "sha256-heSUEW7r9Lt26Fu68Jo/7BHW6Qmp8GrRSavukCS+ySk="; + + cargoRoot = "src-tauri"; + buildAndTestSubdir = finalAttrs.cargoRoot; + + nativeBuildInputs = [ + cargo-tauri.hook + desktop-file-utils + nodejs + pkg-config + yarnConfigHook + ]; + + buildInputs = [ + glib + gtk3 + libayatana-appindicator + openssl + webkitgtk_4_1 + ]; + + postInstall = '' + desktop-file-edit \ + --set-name "NoRiskClient Launcher" \ + --set-comment "Launcher for NoRiskClient" \ + --set-key="Categories" --set-value="Game" \ + --set-key="Keywords" --set-value="nrc;minecraft;mc;" \ + $out/share/applications/NoRisk\ Launcher.desktop + ''; + + passthru.updateScript = nix-update-script { }; + + meta = { + description = "Minecraft Launcher for NoRisk Client"; + homepage = "https://norisk.gg"; + license = lib.licenses.gpl3; + longDescription = '' + An easy way to launch the NoRisk Client, create modpacks, + manage content for Minecraft, and much more - written in tauri. + ''; + maintainers = with lib.maintainers; [ hythera ]; + mainProgram = "noriskclient-launcher-v3"; + platforms = lib.platforms.linux; + }; +})