2024-05-15 15:35:15 +00:00
|
|
|
{
|
|
|
|
lib,
|
|
|
|
stdenv,
|
|
|
|
fetchFromGitHub,
|
|
|
|
unstableGitUpdater,
|
|
|
|
nodejs,
|
|
|
|
bash,
|
|
|
|
asar,
|
|
|
|
unzip,
|
|
|
|
}:
|
2022-07-14 12:49:19 +00:00
|
|
|
|
2024-05-15 15:35:15 +00:00
|
|
|
stdenv.mkDerivation (finalAttrs: {
|
2022-06-26 10:26:21 +00:00
|
|
|
pname = "openasar";
|
2024-05-15 15:35:15 +00:00
|
|
|
version = "0-unstable-2024-01-13";
|
2022-06-26 10:26:21 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "GooseMod";
|
|
|
|
repo = "OpenAsar";
|
2024-05-15 15:35:15 +00:00
|
|
|
rev = "4f264d860a5a6a32e1862ce26178b9cf6402335d";
|
|
|
|
hash = "sha256-NPUUDqntsMxnT/RN5M9DtLDwJXDyjOED4GlXa1oU8l8=";
|
2022-06-26 10:26:21 +00:00
|
|
|
};
|
|
|
|
|
2022-07-14 12:49:19 +00:00
|
|
|
postPatch = ''
|
|
|
|
# Hardcode unzip path
|
|
|
|
substituteInPlace ./src/updater/moduleUpdater.js \
|
2022-08-12 12:06:08 +00:00
|
|
|
--replace \'unzip\' \'${unzip}/bin/unzip\'
|
2022-07-14 12:49:19 +00:00
|
|
|
# Remove auto-update feature
|
|
|
|
echo "module.exports = async () => log('AsarUpdate', 'Removed');" > ./src/asarUpdate.js
|
|
|
|
'';
|
|
|
|
|
2022-06-26 10:26:21 +00:00
|
|
|
buildPhase = ''
|
|
|
|
runHook preBuild
|
|
|
|
|
|
|
|
bash scripts/injectPolyfills.sh
|
2024-05-15 15:35:15 +00:00
|
|
|
substituteInPlace src/index.js --replace 'nightly' '${finalAttrs.version}'
|
2022-06-26 10:26:21 +00:00
|
|
|
${nodejs}/bin/node scripts/strip.js
|
2023-10-09 19:29:22 +00:00
|
|
|
${asar}/bin/asar pack src app.asar
|
2022-06-26 10:26:21 +00:00
|
|
|
|
|
|
|
runHook postBuild
|
|
|
|
'';
|
|
|
|
|
|
|
|
installPhase = ''
|
|
|
|
runHook preInstall
|
|
|
|
|
|
|
|
install app.asar $out
|
|
|
|
|
|
|
|
runHook postInstall
|
|
|
|
'';
|
|
|
|
|
|
|
|
doCheck = false;
|
|
|
|
|
2024-05-15 15:35:15 +00: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-26 10:26:21 +00:00
|
|
|
meta = with lib; {
|
2024-06-20 14:57:18 +00:00
|
|
|
description = "Open-source alternative of Discord desktop's \"app.asar\"";
|
2022-06-26 10:26:21 +00:00
|
|
|
homepage = "https://openasar.dev";
|
2024-05-15 15:35:15 +00:00
|
|
|
license = licenses.agpl3Only;
|
|
|
|
maintainers = with maintainers; [
|
|
|
|
Scrumplex
|
|
|
|
jopejoe1
|
|
|
|
];
|
2022-06-26 10:26:21 +00:00
|
|
|
platforms = nodejs.meta.platforms;
|
|
|
|
};
|
2024-05-15 15:35:15 +00:00
|
|
|
})
|