Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
1{
2 curl,
3 fetchFromGitHub,
4 git,
5 jq,
6 lib,
7 nix-update,
8 nodejs,
9 pnpm_10,
10 stdenv,
11 writeShellScript,
12 buildWebExtension ? false,
13}:
14
15stdenv.mkDerivation (finalAttrs: {
16 pname = "vencord";
17 version = "1.12.7";
18
19 src = fetchFromGitHub {
20 owner = "Vendicated";
21 repo = "Vencord";
22 rev = "v${finalAttrs.version}";
23 hash = "sha256-MS88KCH8ZdLyKoR0K45CSJutZSKUhz4FAE2VtrSx0ic=";
24 };
25
26 pnpmDeps = pnpm_10.fetchDeps {
27 inherit (finalAttrs) pname src;
28 fetcherVersion = 2;
29 hash = "sha256-JP9HOaP3DG+2F89tC77JZFD0ls35u/MzxNmvMCbBo9Y=";
30 };
31
32 nativeBuildInputs = [
33 git
34 nodejs
35 pnpm_10.configHook
36 ];
37
38 env = {
39 VENCORD_REMOTE = "${finalAttrs.src.owner}/${finalAttrs.src.repo}";
40 VENCORD_HASH = "${finalAttrs.version}";
41 };
42
43 buildPhase = ''
44 runHook preBuild
45
46 pnpm run ${if buildWebExtension then "buildWeb" else "build"} \
47 -- --standalone --disable-updater
48
49 runHook postBuild
50 '';
51
52 installPhase = ''
53 runHook preInstall
54
55 cp -r dist/${lib.optionalString buildWebExtension "chromium-unpacked/"} $out
56 cp package.json $out # Presence is checked by Vesktop.
57
58 runHook postInstall
59 '';
60
61 # We need to fetch the latest *tag* ourselves, as nix-update can only fetch the latest *releases* from GitHub
62 # Vencord had a single "devbuild" release that we do not care about
63 passthru.updateScript = writeShellScript "update-vencord" ''
64 export PATH="${
65 lib.makeBinPath [
66 curl
67 jq
68 nix-update
69 ]
70 }:$PATH"
71 ghTags=$(curl ''${GITHUB_TOKEN:+" -u \":$GITHUB_TOKEN\""} "https://api.github.com/repos/Vendicated/Vencord/tags")
72 latestTag=$(echo "$ghTags" | jq -r .[0].name)
73
74 echo "Latest tag: $latestTag"
75
76 exec nix-update --version "$latestTag" "$@"
77 '';
78
79 meta = {
80 description = "Vencord web extension";
81 homepage = "https://github.com/Vendicated/Vencord";
82 license = lib.licenses.gpl3Only;
83 maintainers = with lib.maintainers; [
84 donteatoreo
85 FlafyDev
86 Gliczy
87 NotAShelf
88 Scrumplex
89 ];
90 };
91})