{ lib, stdenv, fetchFromGitHub, nodejs, bash, nodePackages, unzip }: stdenv.mkDerivation rec { pname = "openasar"; version = "unstable-2023-05-01"; src = fetchFromGitHub { owner = "GooseMod"; repo = "OpenAsar"; rev = "a8b07392808032f95ac3a7c5856e76d2619c91ae"; hash = "sha256-moHeSrWvVOb9+vNhC2YunjTC3Ojh10APt/tvG/AuNco="; }; 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 ${nodePackages.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; }; }