blob: 5c1ddb9a9f76167d0d3f5b9430510224af246688 (
plain) (
blame)
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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
|
{
lib,
stdenv,
fetchFromGitHub,
unstableGitUpdater,
nodejs,
bash,
asar,
unzip,
}:
stdenv.mkDerivation (finalAttrs: {
pname = "openasar";
version = "0-unstable-2024-06-30";
src = fetchFromGitHub {
owner = "GooseMod";
repo = "OpenAsar";
rev = "5c875eb048e96543f1ec711fae522ace5e4a836c";
hash = "sha256-dlf4X+2W2GfL2E46ZM35PqpcoKHoZ4fhroOCLpye1D0=";
};
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' '${finalAttrs.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;
passthru.updateScript = unstableGitUpdater {
# Only has a "nightly" tag (untaged version 0.2 is latest) see https://github.com/GooseMod/OpenAsar/commit/8f79dcef9b1f7732421235a392f06e5bd7382659
hardcodeZeroVersion = true;
};
meta = with lib; {
description = "Open-source alternative of Discord desktop's \"app.asar\"";
homepage = "https://openasar.dev";
license = licenses.agpl3Only;
maintainers = with maintainers; [
Scrumplex
jopejoe1
];
platforms = nodejs.meta.platforms;
};
})
|