fix(pkgs/gr/grimoire): fix hash for grimoire and grimoire-social

This commit is contained in:
2026-08-17 14:05:23 +02:00
parent 99784e0928
commit 7eba4f3313
+89 -90
View File
@@ -15,9 +15,8 @@
callPackage, callPackage,
makeDesktopItem, makeDesktopItem,
copyDesktopItems, copyDesktopItems,
}: }: let
let sources = callPackage ../../../../_sources/generated.nix {};
sources = callPackage ../../../../_sources/generated.nix { };
src = sources.grimoire.src; src = sources.grimoire.src;
version = src.rev; version = src.rev;
@@ -27,14 +26,14 @@ let
owner = "Slush97"; owner = "Slush97";
repo = "grimoire-social"; repo = "grimoire-social";
rev = "main"; rev = "main";
hash = "sha256-f+wUZOR7dqigxd/IZtay1BrLS5rcSnaDage3NXxqsPE="; hash = "sha256-AR2rTNDuge19t+VAqL/I6dmB8f5niIqINmNnRL70k94=";
}; };
pnpmDeps = pnpm.fetchDeps { pnpmDeps = pnpm.fetchDeps {
pname = "grimoire"; pname = "grimoire";
inherit version src; inherit version src;
fetcherVersion = 4; fetcherVersion = 4;
hash = "sha256-Mqvvemc3oDCiuY/UnDOc73P+dLqMEFnwQotodVhrPao="; hash = "sha256-7Lh4Y3sr50tIO7vsVwfJNC2zKyiqMz6EO81egS/DC2k=";
# hash = lib.fakeHash; # hash = lib.fakeHash;
}; };
@@ -42,107 +41,107 @@ let
name = "grimoire"; name = "grimoire";
exec = "grimoire %u"; exec = "grimoire %u";
desktopName = "Grimoire"; desktopName = "Grimoire";
categories = [ "Utility" ]; categories = ["Utility"];
mimeTypes = [ "x-scheme-handler/grimoire" ]; mimeTypes = ["x-scheme-handler/grimoire"];
}; };
in in
stdenv.mkDerivation { stdenv.mkDerivation {
pname = "grimoire"; pname = "grimoire";
inherit version src; inherit version src;
nativeBuildInputs = [ nativeBuildInputs = [
nodejs_22 nodejs_22
pnpm pnpm
pnpm.configHook pnpm.configHook
python3 python3
gcc gcc
gnumake gnumake
pkg-config pkg-config
makeWrapper makeWrapper
electron_41 electron_41
copyDesktopItems copyDesktopItems
]; ];
desktopItems = [ desktopItem ]; desktopItems = [desktopItem];
buildInputs = [ buildInputs = [
sqlite sqlite
]; ];
inherit pnpmDeps; inherit pnpmDeps;
env = { env = {
GRIMOIRE_SOCIAL_BASE_URL = "https://grimoire-social.slusheliott.workers.dev"; GRIMOIRE_SOCIAL_BASE_URL = "https://grimoire-social.slusheliott.workers.dev";
# electron-builder must not try to fetch an Electron binary over the # electron-builder must not try to fetch an Electron binary over the
# network; we hand it the Nix one via --config.electronDist below. # network; we hand it the Nix one via --config.electronDist below.
ELECTRON_SKIP_BINARY_DOWNLOAD = "1"; ELECTRON_SKIP_BINARY_DOWNLOAD = "1";
}; };
postPatch = '' postPatch = ''
cp -r ${grimoire-social-src} ../grimoire-social cp -r ${grimoire-social-src} ../grimoire-social
chmod -R u+w ../grimoire-social chmod -R u+w ../grimoire-social
mkdir -p resources/vpkmerge mkdir -p resources/vpkmerge
cp ${vpkmerge}/bin/vpkmerge resources/vpkmerge/vpkmerge-linux-x86_64 cp ${vpkmerge}/bin/vpkmerge resources/vpkmerge/vpkmerge-linux-x86_64
chmod +x resources/vpkmerge/vpkmerge-linux-x86_64 chmod +x resources/vpkmerge/vpkmerge-linux-x86_64
''; '';
buildPhase = '' buildPhase = ''
runHook preBuild runHook preBuild
mkdir -p ../grimoire-social/node_modules mkdir -p ../grimoire-social/node_modules
ln -sfn "$(realpath node_modules/zod)" ../grimoire-social/node_modules/zod ln -sfn "$(realpath node_modules/zod)" ../grimoire-social/node_modules/zod
# Rebuild the better-sqlite3 native addon against the Electron ABI. We do # Rebuild the better-sqlite3 native addon against the Electron ABI. We do
# this ourselves (and disable electron-builder's own rebuild below) so no # this ourselves (and disable electron-builder's own rebuild below) so no
# network fetch of Electron headers is needed inside the sandbox. # network fetch of Electron headers is needed inside the sandbox.
( (
cd node_modules/better-sqlite3 cd node_modules/better-sqlite3
patch -p1 < ${./patches/better-sqlite3-thistogetthis.patch} patch -p1 < ${./patches/better-sqlite3-thistogetthis.patch}
HOME="$TMPDIR" node \ HOME="$TMPDIR" node \
"${nodejs_22}/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" \ "${nodejs_22}/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" \
rebuild \ rebuild \
--nodedir="${electron_41.headers}" --nodedir="${electron_41.headers}"
) )
# Package the app the same way upstream CI does (release.yml): # Package the app the same way upstream CI does (release.yml):
# `electron-vite build && electron-builder`. We stop at the unpacked # `electron-vite build && electron-builder`. We stop at the unpacked
# `--dir` output instead of building AppImage/deb installers, then wrap # `--dir` output instead of building AppImage/deb installers, then wrap
# the Nix Electron around the produced app.asar. Building through # the Nix Electron around the produced app.asar. Building through
# electron-builder (rather than launching Electron on the raw dist/) # electron-builder (rather than launching Electron on the raw dist/)
# makes `app.isPackaged` true, which is what disables the dev-only # makes `app.isPackaged` true, which is what disables the dev-only
# DevTools auto-open and the dev vpkmerge lookup path. # DevTools auto-open and the dev vpkmerge lookup path.
export HOME="$TMPDIR" export HOME="$TMPDIR"
pnpm exec electron-vite build pnpm exec electron-vite build
pnpm exec electron-builder --linux dir \ pnpm exec electron-builder --linux dir \
--config.npmRebuild=false \ --config.npmRebuild=false \
--config.electronDist=${electron_41.dist} \ --config.electronDist=${electron_41.dist} \
--config.electronVersion=${electron_41.version} --config.electronVersion=${electron_41.version}
runHook postBuild runHook postBuild
''; '';
installPhase = '' installPhase = ''
runHook preInstall runHook preInstall
mkdir -p $out/lib/grimoire mkdir -p $out/lib/grimoire
# electron-builder emits the packaged app (app.asar, app.asar.unpacked, # electron-builder emits the packaged app (app.asar, app.asar.unpacked,
# and extraResources such as vpkmerge) under release/linux-unpacked/resources. # and extraResources such as vpkmerge) under release/linux-unpacked/resources.
cp -r release/linux-unpacked/resources $out/lib/grimoire/resources cp -r release/linux-unpacked/resources $out/lib/grimoire/resources
# Launch the Nix Electron against the packaged asar. process.resourcesPath # Launch the Nix Electron against the packaged asar. process.resourcesPath
# resolves to the directory holding app.asar, so the bundled vpkmerge at # resolves to the directory holding app.asar, so the bundled vpkmerge at
# resources/vpkmerge/ is found at runtime. # resources/vpkmerge/ is found at runtime.
mkdir -p $out/bin mkdir -p $out/bin
makeWrapper ${electron_41}/bin/electron $out/bin/grimoire \ makeWrapper ${electron_41}/bin/electron $out/bin/grimoire \
--add-flags "$out/lib/grimoire/resources/app.asar" \ --add-flags "$out/lib/grimoire/resources/app.asar" \
--set NODE_ENV production --set NODE_ENV production
runHook postInstall runHook postInstall
''; '';
meta = { meta = {
description = "Grimoire Electron-based mod manager"; description = "Grimoire Electron-based mod manager";
platforms = [ "x86_64-linux" ]; platforms = ["x86_64-linux"];
}; };
} }