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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
|
{
curl,
esbuild,
fetchFromGitHub,
git,
jq,
lib,
nix-update,
nodejs,
pnpm_10,
stdenv,
writeShellScript,
buildWebExtension ? false,
}:
stdenv.mkDerivation (finalAttrs: {
pname = "vencord";
version = "1.11.8";
src = fetchFromGitHub {
owner = "Vendicated";
repo = "Vencord";
rev = "v${finalAttrs.version}";
hash = "sha256-Ej04ONaeNt55mbQ5RTKM4MySYsw3UJky9ZK9h1gMEzo=";
};
pnpmDeps = pnpm_10.fetchDeps {
inherit (finalAttrs) pname src;
hash = "sha256-hO6QKRr4jTfesRDAEGcpFeJmGTGLGMw6EgIvD23DNzw=";
};
nativeBuildInputs = [
git
nodejs
pnpm_10.configHook
];
env = {
ESBUILD_BINARY_PATH = lib.getExe (
esbuild.overrideAttrs (
final: _: {
version = "0.25.1";
src = fetchFromGitHub {
owner = "evanw";
repo = "esbuild";
rev = "v${final.version}";
hash = "sha256-vrhtdrvrcC3dQoJM6hWq6wrGJLSiVww/CNPlL1N5kQ8=";
};
vendorHash = "sha256-+BfxCyg0KkDQpHt/wycy/8CTG6YBA/VJvJFhhzUnSiQ=";
}
)
);
VENCORD_REMOTE = "${finalAttrs.src.owner}/${finalAttrs.src.repo}";
VENCORD_HASH = "${finalAttrs.version}";
};
buildPhase = ''
runHook preBuild
pnpm run ${if buildWebExtension then "buildWeb" else "build"} \
-- --standalone --disable-updater
runHook postBuild
'';
installPhase = ''
runHook preInstall
cp -r dist/${lib.optionalString buildWebExtension "chromium-unpacked/"} $out
runHook postInstall
'';
# We need to fetch the latest *tag* ourselves, as nix-update can only fetch the latest *releases* from GitHub
# Vencord had a single "devbuild" release that we do not care about
passthru.updateScript = writeShellScript "update-vencord" ''
export PATH="${
lib.makeBinPath [
curl
jq
nix-update
]
}:$PATH"
ghTags=$(curl ''${GITHUB_TOKEN:+" -u \":$GITHUB_TOKEN\""} "https://api.github.com/repos/Vendicated/Vencord/tags")
latestTag=$(echo "$ghTags" | jq -r .[0].name)
echo "Latest tag: $latestTag"
exec nix-update --version "$latestTag" "$@"
'';
meta = {
description = "Vencord web extension";
homepage = "https://github.com/Vendicated/Vencord";
license = lib.licenses.gpl3Only;
maintainers = with lib.maintainers; [
donteatoreo
FlafyDev
NotAShelf
Scrumplex
];
};
})
|