From 444b9863a94dbc5f0040e6a615f5c0c2b15e57f2 Mon Sep 17 00:00:00 2001 From: Sefa Eyeoglu Date: Fri, 17 May 2024 11:17:35 +0200 Subject: [PATCH] vesktop: use pnpm.fetchDeps Signed-off-by: Sefa Eyeoglu --- pkgs/by-name/ve/vesktop/package.nix | 84 +++-------------------------- pkgs/top-level/all-packages.nix | 2 + 2 files changed, 10 insertions(+), 76 deletions(-) diff --git a/pkgs/by-name/ve/vesktop/package.nix b/pkgs/by-name/ve/vesktop/package.nix index 9e45802d392e..d133fe56ca12 100644 --- a/pkgs/by-name/ve/vesktop/package.nix +++ b/pkgs/by-name/ve/vesktop/package.nix @@ -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 diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 38b3978aabc3..bef4d9234dcd 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -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; };