51 lines
1.2 KiB
Nix
51 lines
1.2 KiB
Nix
{ lib, stdenv, fetchFromGitHub, nodejs, bash, asar, unzip }:
|
|
|
|
stdenv.mkDerivation rec {
|
|
pname = "openasar";
|
|
version = "unstable-2023-07-07";
|
|
|
|
src = fetchFromGitHub {
|
|
owner = "GooseMod";
|
|
repo = "OpenAsar";
|
|
rev = "5ac246dc92e9a2a9b314d899df728f37096c482b";
|
|
hash = "sha256-ODeVru4LCSl3rIeJCdezAwqzKP6IRo5WDaaUymqEcBs=";
|
|
};
|
|
|
|
postPatch = ''
|
|
# Hardcode unzip path
|
|
substituteInPlace ./src/updater/moduleUpdater.js \
|
|
--replace \'unzip\' \'${unzip}/bin/unzip\'
|
|
# Remove auto-update feature
|
|
echo "module.exports = async () => log('AsarUpdate', 'Removed');" > ./src/asarUpdate.js
|
|
'';
|
|
|
|
buildPhase = ''
|
|
runHook preBuild
|
|
|
|
bash scripts/injectPolyfills.sh
|
|
substituteInPlace src/index.js --replace 'nightly' '${version}'
|
|
${nodejs}/bin/node scripts/strip.js
|
|
${asar}/bin/asar pack src app.asar
|
|
|
|
runHook postBuild
|
|
'';
|
|
|
|
installPhase = ''
|
|
runHook preInstall
|
|
|
|
install app.asar $out
|
|
|
|
runHook postInstall
|
|
'';
|
|
|
|
doCheck = false;
|
|
|
|
meta = with lib; {
|
|
description = "Open-source alternative of Discord desktop's \"app.asar\".";
|
|
homepage = "https://openasar.dev";
|
|
license = licenses.mit;
|
|
maintainers = with maintainers; [ pedrohlc ];
|
|
platforms = nodejs.meta.platforms;
|
|
};
|
|
}
|