mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-01-19 11:23:29 +00:00
vencord: 1.9.5 -> 1.10.1 (#332423)
This commit is contained in:
commit
5690cd67f5
5912
pkgs/by-name/ve/vencord/package-lock.json
generated
5912
pkgs/by-name/ve/vencord/package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@ -1,65 +1,103 @@
|
||||
{ buildNpmPackage
|
||||
, fetchFromGitHub
|
||||
, lib
|
||||
, esbuild
|
||||
, buildWebExtension ? false
|
||||
{
|
||||
curl,
|
||||
esbuild,
|
||||
fetchFromGitHub,
|
||||
git,
|
||||
jq,
|
||||
lib,
|
||||
nix-update,
|
||||
nodejs,
|
||||
pnpm,
|
||||
stdenv,
|
||||
writeShellScript,
|
||||
buildWebExtension ? false,
|
||||
}:
|
||||
let
|
||||
version = "1.9.5";
|
||||
gitHash = "5bd10c8";
|
||||
in
|
||||
buildNpmPackage rec {
|
||||
stdenv.mkDerivation (finalAttrs: {
|
||||
pname = "vencord";
|
||||
inherit version;
|
||||
version = "1.10.1";
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "Vendicated";
|
||||
repo = "Vencord";
|
||||
rev = "v${version}";
|
||||
hash = "sha256-7eJkdcZX4D6PUnnpY+iucWWZx9/ned8z/zA0M5TRcaY=";
|
||||
rev = "v${finalAttrs.version}";
|
||||
hash = "sha256-fYLTaxNeixaHP19dS+BPVJwv/xXEV5hmmE2ob7jzS/A=";
|
||||
};
|
||||
|
||||
ESBUILD_BINARY_PATH = lib.getExe (esbuild.overrideAttrs (final: _: {
|
||||
version = "0.15.18";
|
||||
src = fetchFromGitHub {
|
||||
owner = "evanw";
|
||||
repo = "esbuild";
|
||||
rev = "v${final.version}";
|
||||
hash = "sha256-b9R1ML+pgRg9j2yrkQmBulPuLHYLUQvW+WTyR/Cq6zE=";
|
||||
};
|
||||
vendorHash = "sha256-+BfxCyg0KkDQpHt/wycy/8CTG6YBA/VJvJFhhzUnSiQ=";
|
||||
}));
|
||||
pnpmDeps = pnpm.fetchDeps {
|
||||
inherit (finalAttrs) pname src;
|
||||
|
||||
# Supresses an error about esbuild's version.
|
||||
npmRebuildFlags = [ "|| true" ];
|
||||
hash = "sha256-bosCE9gBFCcM3Ww6sJmhps/cl4lovXKMieYpkqAMst8=";
|
||||
};
|
||||
|
||||
makeCacheWritable = true;
|
||||
npmDepsHash = "sha256-GTjL6cjYPoa1ohtqslxDskCN9tKuu1OP1ZWIWtFx+E0=";
|
||||
npmFlags = [ "--legacy-peer-deps" ];
|
||||
npmBuildScript = if buildWebExtension then "buildWeb" else "build";
|
||||
npmBuildFlags = [ "--" "--standalone" "--disable-updater" ];
|
||||
nativeBuildInputs = [
|
||||
git
|
||||
nodejs
|
||||
pnpm.configHook
|
||||
];
|
||||
|
||||
prePatch = ''
|
||||
cp ${./package-lock.json} ./package-lock.json
|
||||
chmod +w ./package-lock.json
|
||||
env = {
|
||||
ESBUILD_BINARY_PATH = lib.getExe (
|
||||
esbuild.overrideAttrs (
|
||||
final: _: {
|
||||
version = "0.15.18";
|
||||
src = fetchFromGitHub {
|
||||
owner = "evanw";
|
||||
repo = "esbuild";
|
||||
rev = "v${final.version}";
|
||||
hash = "sha256-b9R1ML+pgRg9j2yrkQmBulPuLHYLUQvW+WTyR/Cq6zE=";
|
||||
};
|
||||
vendorHash = "sha256-+BfxCyg0KkDQpHt/wycy/8CTG6YBA/VJvJFhhzUnSiQ=";
|
||||
}
|
||||
)
|
||||
);
|
||||
VENCORD_REMOTE = "${finalAttrs.src.owner}/${finalAttrs.src.repo}";
|
||||
# TODO: somehow update this automatically
|
||||
VENCORD_HASH = "deadbeef";
|
||||
};
|
||||
|
||||
buildPhase = ''
|
||||
runHook preBuild
|
||||
|
||||
pnpm run ${if buildWebExtension then "buildWeb" else "build"} \
|
||||
-- --standalone --disable-updater
|
||||
|
||||
runHook postBuild
|
||||
'';
|
||||
|
||||
VENCORD_HASH = gitHash;
|
||||
VENCORD_REMOTE = "${src.owner}/${src.repo}";
|
||||
installPhase = ''
|
||||
runHook preInstall
|
||||
|
||||
installPhase =
|
||||
if buildWebExtension then ''
|
||||
cp -r dist/chromium-unpacked/ $out
|
||||
'' else ''
|
||||
cp -r dist/ $out
|
||||
'';
|
||||
cp -r dist/${lib.optionalString buildWebExtension "chromium-unpacked/"} $out
|
||||
|
||||
passthru.updateScript = ./update.sh;
|
||||
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 = with lib; {
|
||||
description = "Vencord web extension";
|
||||
homepage = "https://github.com/Vendicated/Vencord";
|
||||
license = licenses.gpl3Only;
|
||||
maintainers = with maintainers; [ FlafyDev NotAShelf Scrumplex ];
|
||||
maintainers = with maintainers; [
|
||||
FlafyDev
|
||||
NotAShelf
|
||||
Scrumplex
|
||||
];
|
||||
};
|
||||
}
|
||||
})
|
||||
|
@ -1,24 +0,0 @@
|
||||
#!/usr/bin/env nix-shell
|
||||
#! nix-shell -i bash -p curl jq common-updater-scripts prefetch-npm-deps nodejs
|
||||
set -eou pipefail
|
||||
|
||||
pkgDir="$(dirname "$(readlink -f "$0")")"
|
||||
|
||||
tempDir=$(mktemp -d)
|
||||
|
||||
ghTags=$(curl ${GITHUB_TOKEN:+" -u \":$GITHUB_TOKEN\""} "https://api.github.com/repos/Vendicated/Vencord/tags")
|
||||
latestTag=$(echo "$ghTags" | jq -r .[0].name)
|
||||
gitHash=$(echo "$ghTags" | jq -r .[0].commit.sha)
|
||||
|
||||
pushd "$tempDir"
|
||||
curl "https://raw.githubusercontent.com/Vendicated/Vencord/$latestTag/package.json" -o package.json
|
||||
npm install --legacy-peer-deps -f
|
||||
|
||||
npmDepsHash=$(prefetch-npm-deps ./package-lock.json)
|
||||
popd
|
||||
|
||||
update-source-version vencord "${latestTag#v}"
|
||||
|
||||
sed -E 's#\bgitHash = ".*?"#gitHash = "'"${gitHash:0:7}"'"#' -i "$pkgDir/package.nix"
|
||||
sed -E 's#\bnpmDepsHash = ".*?"#npmDepsHash = "'"$npmDepsHash"'"#' -i "$pkgDir/package.nix"
|
||||
cp "$tempDir/package-lock.json" "$pkgDir/package-lock.json"
|
Loading…
Reference in New Issue
Block a user