2024-04-30 18:06:13 +02:00
|
|
|
{
|
|
|
|
lib,
|
|
|
|
stdenv,
|
|
|
|
fetchFromGitHub,
|
|
|
|
unstableGitUpdater,
|
|
|
|
nodejs,
|
|
|
|
bash,
|
|
|
|
asar,
|
|
|
|
unzip,
|
|
|
|
}:
|
2022-07-01 23:55:49 +02:00
|
|
|
|
2024-04-30 18:06:13 +02:00
|
|
|
stdenv.mkDerivation (finalAttrs: {
|
2022-06-23 21:34:12 +02:00
|
|
|
pname = "openasar";
|
2024-04-29 22:22:55 +02:00
|
|
|
version = "0-unstable-2024-01-13";
|
2022-06-23 21:34:12 +02:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "GooseMod";
|
|
|
|
repo = "OpenAsar";
|
2024-04-29 22:22:55 +02:00
|
|
|
rev = "4f264d860a5a6a32e1862ce26178b9cf6402335d";
|
|
|
|
hash = "sha256-NPUUDqntsMxnT/RN5M9DtLDwJXDyjOED4GlXa1oU8l8=";
|
2022-06-23 21:34:12 +02:00
|
|
|
};
|
|
|
|
|
2022-07-01 23:55:49 +02:00
|
|
|
postPatch = ''
|
|
|
|
# Hardcode unzip path
|
|
|
|
substituteInPlace ./src/updater/moduleUpdater.js \
|
2022-07-05 00:34:59 +02:00
|
|
|
--replace \'unzip\' \'${unzip}/bin/unzip\'
|
2022-07-01 23:55:49 +02:00
|
|
|
# Remove auto-update feature
|
|
|
|
echo "module.exports = async () => log('AsarUpdate', 'Removed');" > ./src/asarUpdate.js
|
|
|
|
'';
|
|
|
|
|
2022-06-23 21:34:12 +02:00
|
|
|
buildPhase = ''
|
|
|
|
runHook preBuild
|
|
|
|
|
|
|
|
bash scripts/injectPolyfills.sh
|
2024-04-30 18:06:13 +02:00
|
|
|
substituteInPlace src/index.js --replace 'nightly' '${finalAttrs.version}'
|
2022-06-23 21:34:12 +02:00
|
|
|
${nodejs}/bin/node scripts/strip.js
|
2023-08-27 04:56:59 +02:00
|
|
|
${asar}/bin/asar pack src app.asar
|
2022-06-23 21:34:12 +02:00
|
|
|
|
|
|
|
runHook postBuild
|
|
|
|
'';
|
|
|
|
|
|
|
|
installPhase = ''
|
|
|
|
runHook preInstall
|
|
|
|
|
|
|
|
install app.asar $out
|
|
|
|
|
|
|
|
runHook postInstall
|
|
|
|
'';
|
|
|
|
|
|
|
|
doCheck = false;
|
|
|
|
|
2024-04-29 22:21:01 +02:00
|
|
|
passthru.updateScript = unstableGitUpdater {
|
|
|
|
# Only has a "nightly" tag (untaged version 0.2 is latest) see https://github.com/GooseMod/OpenAsar/commit/8f79dcef9b1f7732421235a392f06e5bd7382659
|
|
|
|
hardcodeZeroVersion = true;
|
|
|
|
};
|
|
|
|
|
2022-06-23 21:34:12 +02:00
|
|
|
meta = with lib; {
|
|
|
|
description = "Open-source alternative of Discord desktop's \"app.asar\".";
|
|
|
|
homepage = "https://openasar.dev";
|
2024-04-29 22:26:02 +02:00
|
|
|
license = licenses.agpl3Only;
|
2024-04-30 18:06:13 +02:00
|
|
|
maintainers = with maintainers; [
|
|
|
|
Scrumplex
|
|
|
|
jopejoe1
|
|
|
|
];
|
2022-06-23 21:34:12 +02:00
|
|
|
platforms = nodejs.meta.platforms;
|
|
|
|
};
|
2024-04-30 18:06:13 +02:00
|
|
|
})
|