modrinth-app: 0.7.1 -> 0.8.2 (#336494)

This commit is contained in:
Aleksana 2024-10-27 12:11:15 +08:00 committed by GitHub
commit 03067726ee
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 1230 additions and 1292 deletions

File diff suppressed because it is too large Load Diff

View File

@ -1,86 +1,55 @@
{
lib,
stdenv,
stdenvNoCC,
fetchFromGitHub,
rustPlatform,
buildGoModule,
nix-update-script,
modrinth-app-unwrapped,
cacert,
cargo-tauri,
desktop-file-utils,
esbuild,
darwin,
jq,
desktop-file-utils,
libsoup,
moreutils,
pnpm_8,
nodejs,
openssl,
pkg-config,
pnpm_9,
turbo,
webkitgtk_4_0,
}:
rustPlatform.buildRustPackage {
let
pnpm = pnpm_9;
in
rustPlatform.buildRustPackage rec {
pname = "modrinth-app-unwrapped";
version = "0.7.1";
version = "0.8.2";
src = fetchFromGitHub {
owner = "modrinth";
repo = "theseus";
rev = "v${modrinth-app-unwrapped.version}";
hash = "sha256-JWR0e2vOBvOLosr22Oo2mAlR0KAhL+261RRybhNctlM=";
repo = "code";
rev = "a0bd011b808cdc998ef27960f610a8d99550c914";
hash = "sha256-zpFJq7if5gOx7jvwpE73lqH4Vpif0MJMPIGsgtThKVk=";
};
cargoLock = {
lockFile = ./Cargo.lock;
outputHashes = {
"tauri-plugin-single-instance-0.0.0" = "sha256-Mf2/cnKotd751ZcSHfiSLNe2nxBfo4dMBdoCwQhe7yI=";
"sqlx-0.8.0-alpha.0" = "sha256-M1bumCMTzgDcQlgSYB6ypPp794e35ZSQCLzkbrFV4qY=";
"tauri-plugin-single-instance-0.0.0" = "sha256-DZWTO2/LevbQJCJbeHbTc2rhesV3bNrs+BoYm2eMakA=";
};
};
pnpm-deps = stdenvNoCC.mkDerivation (finalAttrs: {
pname = "${modrinth-app-unwrapped.pname}-pnpm-deps";
inherit (modrinth-app-unwrapped) version src;
sourceRoot = "${finalAttrs.src.name}/theseus_gui";
dontConfigure = true;
dontBuild = true;
doCheck = false;
nativeBuildInputs = [
cacert
jq
moreutils
pnpm_8
];
# https://github.com/NixOS/nixpkgs/blob/763e59ffedb5c25774387bf99bc725df5df82d10/pkgs/applications/misc/pot/default.nix#L56
installPhase = ''
export HOME=$(mktemp -d)
pnpm config set store-dir "$out"
pnpm install --frozen-lockfile --ignore-script --force
# remove timestamp and sort json files
rm -rf "$out"/v3/tmp
for f in $(find "$out" -name "*.json"); do
sed -i -E -e 's/"checkedAt":[0-9]+,//g' $f
jq --sort-keys . "$f" | sponge "$f"
done
'';
dontFixup = true;
outputHashMode = "recursive";
outputHash = "sha256-g/uUGfC9TQh0LE8ed51oFY17FySoeTvfaeEpzpNeMao=";
});
pnpmDeps = pnpm.fetchDeps {
inherit pname version src;
hash = "sha256-Ye9GHvkO+xZj87NIc1JLmhIJFqdkJMg7HvfTltx9krw=";
};
nativeBuildInputs = [
cacert # required for turbo
cargo-tauri.hook
desktop-file-utils
pnpm_8
nodejs
pkg-config
pnpm.configHook
];
buildInputs =
@ -100,35 +69,9 @@ rustPlatform.buildRustPackage {
);
env = {
ESBUILD_BINARY_PATH = lib.getExe (
esbuild.override {
buildGoModule = args: buildGoModule (args // rec {
version = "0.20.2";
src = fetchFromGitHub {
owner = "evanw";
repo = "esbuild";
rev = "v${version}";
hash = "sha256-h/Vqwax4B4nehRP9TaYbdixAZdb1hx373dNxNHvDrtY=";
};
vendorHash = "sha256-+BfxCyg0KkDQpHt/wycy/8CTG6YBA/VJvJFhhzUnSiQ=";
});
}
);
TURBO_BINARY_PATH = lib.getExe turbo;
};
postPatch = ''
export HOME=$(mktemp -d)
export STORE_PATH=$(mktemp -d)
pushd theseus_gui
cp -rT ${modrinth-app-unwrapped.pnpm-deps} "$STORE_PATH"
chmod -R +w "$STORE_PATH"
pnpm config set store-dir "$STORE_PATH"
pnpm install --offline --frozen-lockfile --ignore-script
popd
'';
postInstall =
lib.optionalString stdenv.hostPlatform.isDarwin ''
mv "$out"/Applications/Modrinth\ App.app/Contents/MacOS/Modrinth\ App "$out"/bin/modrinth-app
@ -144,25 +87,20 @@ rustPlatform.buildRustPackage {
$out/share/applications/modrinth-app.desktop
'';
passthru = {
updateScript = nix-update-script { };
};
meta = {
description = "Modrinth's game launcher";
longDescription = ''
A unique, open source launcher that allows you to play your favorite mods,
and keep them up to date, all in one neat little package
'';
mainProgram = "modrinth-app";
homepage = "https://modrinth.com";
changelog = "https://github.com/modrinth/theseus/releases/tag/v${modrinth-app-unwrapped.version}";
license = with lib.licenses; [
gpl3Plus
unfreeRedistributable
];
maintainers = with lib.maintainers; [ getchoo ];
platforms = lib.platforms.linux ++ lib.platforms.darwin;
mainProgram = "modrinth-app";
platforms = with lib; platforms.linux ++ platforms.darwin;
# this builds on architectures like aarch64, but the launcher itself does not support them yet
broken = !stdenv.hostPlatform.isx86_64;
};

View File

@ -3,10 +3,9 @@
stdenv,
symlinkJoin,
modrinth-app-unwrapped,
wrapGAppsHook3,
addDriverRunpath,
alsa-lib,
flite,
glib,
glib-networking,
jdk8,
jdk17,
@ -17,10 +16,14 @@
jdk21
],
libGL,
libjack2,
libpulseaudio,
pipewire,
udev,
wrapGAppsHook3,
xorg,
}:
symlinkJoin rec {
name = "${pname}-${version}";
pname = "modrinth-app";
@ -28,37 +31,44 @@ symlinkJoin rec {
paths = [ modrinth-app-unwrapped ];
buildInputs = [
glib
glib-networking
];
nativeBuildInputs = [ wrapGAppsHook3 ];
nativeBuildInputs = [
wrapGAppsHook3
];
buildInputs = [ glib-networking ];
runtimeDependencies = lib.optionalString stdenv.hostPlatform.isLinux (lib.makeLibraryPath [
addDriverRunpath.driverLink
flite # narrator support
runtimeDependencies = lib.optionalString stdenv.hostPlatform.isLinux (
lib.makeLibraryPath [
addDriverRunpath.driverLink
udev # oshi
# glfw
libGL
xorg.libX11
xorg.libXcursor
xorg.libXext
xorg.libXrandr
xorg.libXxf86vm
# lwjgl
libGL
libpulseaudio
stdenv.cc.cc.lib
xorg.libX11
xorg.libXcursor
xorg.libXext
xorg.libXxf86vm
xorg.libXrandr
]);
# lwjgl
stdenv.cc.cc.lib
# narrator support
flite
# openal
alsa-lib
libjack2
libpulseaudio
pipewire
# oshi
udev
]
);
postBuild = ''
gappsWrapperArgs+=(
--prefix PATH : ${lib.makeSearchPath "bin/java" jdks}
${lib.optionalString stdenv.hostPlatform.isLinux ''
--prefix PATH : ${lib.makeBinPath [xorg.xrandr]}
--prefix PATH : ${lib.makeBinPath [ xorg.xrandr ]}
--set LD_LIBRARY_PATH $runtimeDependencies
''}
)
@ -66,5 +76,16 @@ symlinkJoin rec {
wrapGAppsHook
'';
inherit (modrinth-app-unwrapped) meta;
meta = {
inherit (modrinth-app-unwrapped.meta)
description
longDescription
homepage
license
maintainers
mainProgram
platforms
broken
;
};
}