From c1b54d4d8638baaa9fe2b21a9f5c22e5aba03188 Mon Sep 17 00:00:00 2001 From: seth Date: Fri, 7 Jun 2024 17:46:07 -0400 Subject: [PATCH] modrinth-app: use `pnpm.fetchDeps` --- .../mo/modrinth-app-unwrapped/package.nix | 62 +++---------------- 1 file changed, 8 insertions(+), 54 deletions(-) diff --git a/pkgs/by-name/mo/modrinth-app-unwrapped/package.nix b/pkgs/by-name/mo/modrinth-app-unwrapped/package.nix index 3d43797b9b1b..31a9296fd5e1 100644 --- a/pkgs/by-name/mo/modrinth-app-unwrapped/package.nix +++ b/pkgs/by-name/mo/modrinth-app-unwrapped/package.nix @@ -1,27 +1,23 @@ { lib, stdenv, - stdenvNoCC, fetchFromGitHub, rustPlatform, buildGoModule, nix-update-script, modrinth-app-unwrapped, - cacert, cargo-tauri, desktop-file-utils, esbuild, darwin, - jq, libsoup, - moreutils, pnpm_8, nodejs, openssl, pkg-config, webkitgtk_4_0, }: -rustPlatform.buildRustPackage { +rustPlatform.buildRustPackage rec { pname = "modrinth-app-unwrapped"; version = "0.7.1"; @@ -39,46 +35,17 @@ rustPlatform.buildRustPackage { }; }; - 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_8.fetchDeps { + inherit pname version src; + sourceRoot = "${src.name}/theseus_gui"; + hash = "sha256-g/uUGfC9TQh0LE8ed51oFY17FySoeTvfaeEpzpNeMao="; + }; + pnpmRoot = "theseus_gui"; nativeBuildInputs = [ cargo-tauri.hook desktop-file-utils - pnpm_8 + pnpm_8.configHook nodejs pkg-config ]; @@ -116,19 +83,6 @@ rustPlatform.buildRustPackage { ); }; - 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