chromium,chromedriver: 129.0.6668.91 -> 129.0.6668.100
[NixPkgs.git] / pkgs / by-name / ve / vencord / package.nix
blob7ca50671c419cd1f9c0369195c6dcc8030969240
2   curl,
3   esbuild,
4   fetchFromGitHub,
5   git,
6   jq,
7   lib,
8   nix-update,
9   nodejs,
10   pnpm,
11   stdenv,
12   writeShellScript,
13   buildWebExtension ? false,
15 stdenv.mkDerivation (finalAttrs: {
16   pname = "vencord";
17   version = "1.10.4";
19   src = fetchFromGitHub {
20     owner = "Vendicated";
21     repo = "Vencord";
22     rev = "v${finalAttrs.version}";
23     hash = "sha256-lAMcvJzKFpIvA4QzCnhJddu8EL2SE4iYNvkqesHzsb8=";
24   };
26   pnpmDeps = pnpm.fetchDeps {
27     inherit (finalAttrs) pname src;
29     hash = "sha256-bosCE9gBFCcM3Ww6sJmhps/cl4lovXKMieYpkqAMst8=";
30   };
32   nativeBuildInputs = [
33     git
34     nodejs
35     pnpm.configHook
36   ];
38   env = {
39     ESBUILD_BINARY_PATH = lib.getExe (
40       esbuild.overrideAttrs (
41         final: _: {
42           version = "0.15.18";
43           src = fetchFromGitHub {
44             owner = "evanw";
45             repo = "esbuild";
46             rev = "v${final.version}";
47             hash = "sha256-b9R1ML+pgRg9j2yrkQmBulPuLHYLUQvW+WTyR/Cq6zE=";
48           };
49           vendorHash = "sha256-+BfxCyg0KkDQpHt/wycy/8CTG6YBA/VJvJFhhzUnSiQ=";
50         }
51       )
52     );
53     VENCORD_REMOTE = "${finalAttrs.src.owner}/${finalAttrs.src.repo}";
54     # TODO: somehow update this automatically
55     VENCORD_HASH = "deadbeef";
56   };
58   buildPhase = ''
59     runHook preBuild
61     pnpm run ${if buildWebExtension then "buildWeb" else "build"} \
62       -- --standalone --disable-updater
64     runHook postBuild
65   '';
67   installPhase = ''
68     runHook preInstall
70     cp -r dist/${lib.optionalString buildWebExtension "chromium-unpacked/"} $out
72     runHook postInstall
73   '';
75   # We need to fetch the latest *tag* ourselves, as nix-update can only fetch the latest *releases* from GitHub
76   # Vencord had a single "devbuild" release that we do not care about
77   passthru.updateScript = writeShellScript "update-vencord" ''
78     export PATH="${
79       lib.makeBinPath [
80         curl
81         jq
82         nix-update
83       ]
84     }:$PATH"
85     ghTags=$(curl ''${GITHUB_TOKEN:+" -u \":$GITHUB_TOKEN\""} "https://api.github.com/repos/Vendicated/Vencord/tags")
86     latestTag=$(echo "$ghTags" | jq -r .[0].name)
88     echo "Latest tag: $latestTag"
90     exec nix-update --version "$latestTag" "$@"
91   '';
93   meta = with lib; {
94     description = "Vencord web extension";
95     homepage = "https://github.com/Vendicated/Vencord";
96     license = licenses.gpl3Only;
97     maintainers = with maintainers; [
98       FlafyDev
99       NotAShelf
100       Scrumplex
101     ];
102   };