blob: c6a64212b558ca67d1d7589a51d975e65ffbc753 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
|
{ lib, stdenv, fetchFromGitHub, nodejs, bash, nodePackages, unzip }:
stdenv.mkDerivation rec {
pname = "openasar";
version = "unstable-2022-08-07";
src = fetchFromGitHub {
owner = "GooseMod";
repo = "OpenAsar";
rev = "e0870784008a584229d3094e0988f5da155c7fd7";
hash = "sha256-t0b2SFlDDBSQEkOCQME0jsLJ8NvoXROTxoQgnoXM9eQ=";
};
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;
};
}
|