1
0
Fork 1
mirror of https://github.com/NixOS/nixpkgs.git synced 2024-09-11 15:08:33 +01:00

vesktop: use pnpm.fetchDeps

Signed-off-by: Sefa Eyeoglu <contact@scrumplex.net>
This commit is contained in:
Sefa Eyeoglu 2024-05-17 11:17:35 +02:00
parent 728d48285e
commit 444b9863a9
No known key found for this signature in database
GPG key ID: E13DFD4B47127951
2 changed files with 10 additions and 76 deletions

View file

@ -1,7 +1,6 @@
{
lib,
stdenv,
stdenvNoCC,
fetchFromGitHub,
substituteAll,
makeWrapper,
@ -10,13 +9,11 @@
vencord,
electron,
libicns,
jq,
moreutils,
cacert,
nodePackages,
pipewire,
libpulseaudio,
autoPatchelfHook,
pnpm,
nodejs,
withTTS ? true,
# Enables the use of vencord from nixpkgs instead of
# letting vesktop manage it's own version
@ -33,66 +30,17 @@ stdenv.mkDerivation (finalAttrs: {
hash = "sha256-cZOyydwpIW9Xq716KVi1RGtSlgVnOP3w8vXDwouS70E=";
};
# NOTE: This requires pnpm 8.10.0 or newer
# https://github.com/pnpm/pnpm/pull/7214
pnpmDeps =
assert lib.versionAtLeast nodePackages.pnpm.version "8.10.0";
stdenvNoCC.mkDerivation {
pname = "${finalAttrs.pname}-pnpm-deps";
inherit (finalAttrs)
src
version
patches
ELECTRON_SKIP_BINARY_DOWNLOAD
;
nativeBuildInputs = [
cacert
jq
moreutils
nodePackages.pnpm
];
# inspired by https://github.com/NixOS/nixpkgs/blob/763e59ffedb5c25774387bf99bc725df5df82d10/pkgs/applications/misc/pot/default.nix#L56
# and based on https://github.com/NixOS/nixpkgs/pull/290715
installPhase = ''
runHook preInstall
export HOME=$(mktemp -d)
pnpm config set store-dir $out
# Some packages produce platform dependent outputs. We do not want to cache those in the global store
pnpm config set side-effects-cache false
# pnpm is going to warn us about using --force
# --force allows us to fetch all dependencies including ones that aren't meant for our host platform
pnpm install --force --frozen-lockfile --ignore-script
'';
fixupPhase = ''
runHook preFixup
# Remove timestamp and sort the json files
rm -rf $out/v3/tmp
for f in $(find $out -name "*.json"); do
sed -i -E -e 's/"checkedAt":[0-9]+,//g' $f
jq --sort-keys . $f | sponge $f
done
runHook postFixup
'';
dontConfigure = true;
dontBuild = true;
outputHashMode = "recursive";
outputHash = "sha256-PogE8uf3W5cKSCqFHMz7FOvT7ONUP4FiFWGBgtk3UC8=";
};
pnpmDeps = pnpm.fetchDeps {
inherit (finalAttrs) pname version src patches;
hash = "sha256-PogE8uf3W5cKSCqFHMz7FOvT7ONUP4FiFWGBgtk3UC8=";
};
nativeBuildInputs = [
autoPatchelfHook
copyDesktopItems
makeWrapper
nodePackages.pnpm
nodePackages.nodejs
nodejs
pnpm.configHook
];
buildInputs = [
@ -110,22 +58,6 @@ stdenv.mkDerivation (finalAttrs: {
ELECTRON_SKIP_BINARY_DOWNLOAD = 1;
configurePhase = ''
runHook preConfigure
export HOME=$(mktemp -d)
export STORE_PATH=$(mktemp -d)
cp -Tr "$pnpmDeps" "$STORE_PATH"
chmod -R +w "$STORE_PATH"
pnpm config set store-dir "$STORE_PATH"
pnpm install --frozen-lockfile --ignore-script --offline
patchShebangs node_modules/{*,.*}
runHook postConfigure
'';
buildPhase = ''
runHook preBuild

View file

@ -24773,6 +24773,8 @@ with pkgs;
vencord-web-extension = callPackage ../by-name/ve/vencord/package.nix { buildWebExtension = true; };
vesktop = callPackage ../by-name/ve/vesktop/package.nix { pnpm = pnpm_8; };
vid-stab = callPackage ../development/libraries/vid-stab {
inherit (llvmPackages) openmp;
};